Modified: trunk/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py (87600 => 87601)
--- trunk/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py 2011-05-28 04:42:09 UTC (rev 87600)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py 2011-05-28 04:48:28 UTC (rev 87601)
@@ -106,6 +106,12 @@
return results
+# We use GoldenScriptError to make sure that the code under test throws the
+# correct (i.e., golden) exception.
+class GoldenScriptError(ScriptError):
+ pass
+
+
class CommitQueueTaskTest(unittest.TestCase):
def _run_through_task(self, commit_queue, expected_stderr, expected_exception=None, expect_retry=False):
tool = MockTool(log_executive=True)
@@ -158,7 +164,7 @@
commit_queue = MockCommitQueue([
None,
None,
- ScriptError("MOCK apply failure"),
+ GoldenScriptError("MOCK apply failure"),
])
expected_stderr = """run_webkit_patch: ['clean']
command_passed: success_message='Cleaned working directory' patch='197'
@@ -167,14 +173,14 @@
run_webkit_patch: ['apply-attachment', '--no-update', '--non-interactive', 197]
command_failed: failure_message='Patch does not apply' script_error='MOCK apply failure' patch='197'
"""
- self._run_through_task(commit_queue, expected_stderr, ScriptError)
+ self._run_through_task(commit_queue, expected_stderr, GoldenScriptError)
def test_build_failure(self):
commit_queue = MockCommitQueue([
None,
None,
None,
- ScriptError("MOCK build failure"),
+ GoldenScriptError("MOCK build failure"),
])
expected_stderr = """run_webkit_patch: ['clean']
command_passed: success_message='Cleaned working directory' patch='197'
@@ -187,7 +193,7 @@
run_webkit_patch: ['build', '--force-clean', '--no-update', '--build-style=both']
command_passed: success_message='Able to build without patch' patch='197'
"""
- self._run_through_task(commit_queue, expected_stderr, ScriptError)
+ self._run_through_task(commit_queue, expected_stderr, GoldenScriptError)
def test_red_build_failure(self):
commit_queue = MockCommitQueue([
@@ -311,7 +317,7 @@
None,
None,
None,
- ScriptError("MOCK test failure"),
+ GoldenScriptError("MOCK test failure"),
ScriptError("MOCK test failure again"),
])
expected_stderr = """run_webkit_patch: ['clean']
@@ -331,7 +337,7 @@
run_webkit_patch: ['build-and-test', '--force-clean', '--no-update', '--build', '--test', '--non-interactive']
command_passed: success_message='Able to pass tests without patch' patch='197'
"""
- self._run_through_task(commit_queue, expected_stderr, ScriptError)
+ self._run_through_task(commit_queue, expected_stderr, GoldenScriptError)
def test_red_test_failure(self):
commit_queue = FailingTestCommitQueue([
@@ -415,7 +421,7 @@
None,
None,
None,
- ScriptError("MOCK test failure"),
+ GoldenScriptError("MOCK test failure"),
ScriptError("MOCK test failure again"),
ScriptError("MOCK clean test failure"),
], [
@@ -443,7 +449,7 @@
run_webkit_patch: ['build-and-test', '--force-clean', '--no-update', '--build', '--test', '--non-interactive']
command_failed: failure_message='Unable to pass tests without patch (tree is red?)' script_error='MOCK clean test failure' patch='197'
"""
- task = self._run_through_task(commit_queue, expected_stderr, ScriptError)
+ task = self._run_through_task(commit_queue, expected_stderr, GoldenScriptError)
self.assertEqual(task.results_from_patch_test_run(task._patch).failing_tests(), ["foo.html", "bar.html"])
def test_land_failure(self):
@@ -453,7 +459,7 @@
None,
None,
None,
- ScriptError("MOCK land failure"),
+ GoldenScriptError("MOCK land failure"),
])
expected_stderr = """run_webkit_patch: ['clean']
command_passed: success_message='Cleaned working directory' patch='197'
@@ -469,7 +475,7 @@
command_failed: failure_message='Unable to land patch' script_error='MOCK land failure' patch='197'
"""
# FIXME: This should really be expect_retry=True for a better user experiance.
- self._run_through_task(commit_queue, expected_stderr, ScriptError)
+ self._run_through_task(commit_queue, expected_stderr, GoldenScriptError)
def _expect_validate(self, patch, is_valid):
class MockDelegate(object):
Modified: trunk/Tools/Scripts/webkitpy/tool/bot/patchanalysistask.py (87600 => 87601)
--- trunk/Tools/Scripts/webkitpy/tool/bot/patchanalysistask.py 2011-05-28 04:42:09 UTC (rev 87600)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/patchanalysistask.py 2011-05-28 04:48:28 UTC (rev 87601)
@@ -184,6 +184,7 @@
# We could remove this dependency by building the layout_test_results from the archive.
first_results = self._delegate.layout_test_results()
first_results_archive = self._delegate.archive_last_layout_test_results(self._patch)
+ first_script_error = self._script_error
if self._expected_failures.failures_were_expected(first_results):
return True
@@ -209,7 +210,7 @@
if self._build_and_test_without_patch():
# The error from the previous ._test() run is real, report it.
- return self.report_failure(first_results_archive, first_results)
+ return self.report_failure(first_results_archive, first_results, first_script_error)
clean_tree_results = self._delegate.layout_test_results()
self._expected_failures.grow_expected_failures(clean_tree_results)
@@ -221,7 +222,7 @@
# Now that we have updated information about failing tests with a clean checkout, we can
# tell if our original failures were unexpected and fail the patch if necessary.
if self._expected_failures.unexpected_failures_observed(first_results):
- return self.report_failure(first_results_archive, first_results)
+ return self.report_failure(first_results_archive, first_results, first_script_error)
# We don't know what's going on. The tree is likely very red (beyond our layout-test-results
# failure limit), just keep retrying the patch. until someone fixes the tree.
@@ -235,12 +236,12 @@
assert(self._patch.id() == patch.id()) # PatchAnalysisTask is not currently re-useable.
return self._results_from_patch_test_run
- def report_failure(self, results_archive=None, results=None):
+ def report_failure(self, results_archive=None, results=None, script_error=None):
if not self.validate():
return False
self._results_archive_from_patch_test_run = results_archive
self._results_from_patch_test_run = results
- raise self._script_error
+ raise script_error or self._script_error
def validate(self):
raise NotImplementedError("subclasses must implement")