class AbstractTestingEWS(AbstractEarlyWarningSystem, EarlyWarningSystemTaskDelegate): def begin_work_queue(self): # FIXME: This violates abstraction self._tool._port = self.port AbstractEarlyWarningSystem.begin_work_queue(self) self._expected_failures = ExpectedFailures() self._layout_test_results_reader = LayoutTestResultsReader(self._tool, self._log_directory()) def _post_reject_message_on_bug(self, task, patch): results_link = self._tool.status_server.results_url_for_status(task.failure_status_id) message = "Attachment %s did not pass %s:\nOutput: %s" % (patch.id(), self.name, results_link) results = task.results_from_patch_test_run(patch) unexpected_failures = self._expected_failures.unexpected_failures(results) if unexpected_failures: message += "\nNew failing tests:\n%s" % "\n".join(unexpected_failures) self._tool.bugs.post_comment_to_bug(patch.bug_id(), message, cc=self.watchers) def review_patch(self, patch): task = EarlyWarningSystemTask(self, patch) if not task.validate(): self._did_error(patch, "%s did not process patch." % self.name) return False try: return task.run() except UnableToApplyPatch, e: self._did_error(patch, "%s unable to apply patch." % self.name) return False except ScriptError, e: # FIXME: This should just use CommitterValidator.reject_patch_from_commit_queue self._post_reject_message_on_bug(task, patch) results_archive = task.results_archive_from_patch_test_run(patch) if results_archive: self._upload_results_archive_for_patch(patch, results_archive) self._did_fail(patch) # FIXME: We're supposed to be able to raise e again here and have # one of our base classes mark the patch as fail, but there seems # to be an issue with the exit_code. return False
def test_unexpected_failures(self): failures = ExpectedFailures() failures.grow_expected_failures(MockResults(['foo.html'])) self.assertEquals(failures.unexpected_failures(MockResults(['foo.html', 'bar.html'])), set(['bar.html'])) self.assertEquals(failures.unexpected_failures(MockResults(['baz.html'])), set(['baz.html']))