Index: scripts/slave/recipe_modules/test_utils/api.py |
diff --git a/scripts/slave/recipe_modules/test_utils/api.py b/scripts/slave/recipe_modules/test_utils/api.py |
index aeae85f7aa3380e4304ae4e62aefbebdbdcc282a..d95798127e57f62985fb6181e23e279bef9eb342 100644 |
--- a/scripts/slave/recipe_modules/test_utils/api.py |
+++ b/scripts/slave/recipe_modules/test_utils/api.py |
@@ -54,7 +54,8 @@ class TestUtilsApi(recipe_api.RecipeApi): |
return ''.join(step_text) |
# TODO(martinis) rewrite this. can be written better using 1.5 syntax. |
- def determine_new_failures(self, caller_api, tests, deapply_patch_fn): |
+ def determine_new_failures(self, caller_api, tests, deapply_patch_fn, |
+ amp_tests=[]): |
""" |
Utility function for running steps with a patch applied, and retrying |
failing steps without the patch. Failures from the run without the patch are |
@@ -65,11 +66,13 @@ class TestUtilsApi(recipe_api.RecipeApi): |
is different than in the caller (different recipe modules |
get injected depending on caller's DEPS vs. this module's |
DEPS) |
+ amp_tests - iterable of objects of type AMPGTestTest |
Paweł Hajdan Jr.
2015/04/22 16:25:09
This shouldn't be needed - see my comment in steps
|
tests - iterable of objects implementing the Test interface above |
deapply_patch_fn - function that takes a list of failing tests |
and undoes any effect of the previously applied patch |
""" |
# Convert iterable to list, since it is enumerated multiple times. |
+ amp_tests = list(amp_tests) |
tests = list(tests) |
failing_tests = [] |
@@ -94,14 +97,21 @@ class TestUtilsApi(recipe_api.RecipeApi): |
except caller_api.step.StepFailure: # pragma: no cover |
pass |
- run('with patch', tests) |
+ with_patch_prefix = 'with patch' |
+ for t in amp_tests: |
+ t.trigger(caller_api, with_patch_prefix) |
+ |
+ run(with_patch_prefix, tests) |
+ |
+ for t in amp_tests: |
+ t.collect(caller_api, with_patch_prefix) |
with self.m.step.defer_results(): |
- for t in tests: |
- if not t.has_valid_results(caller_api, 'with patch'): |
+ for t in (amp_tests + tests): |
+ if not t.has_valid_results(caller_api, with_patch_prefix): |
self.m.tryserver.maybe_set_transient_failure_tryjob_result() |
self.m.python.failing_step(t.name, 'TEST RESULTS WERE INVALID') |
- elif t.failures(caller_api, 'with patch'): |
+ elif t.failures(caller_api, with_patch_prefix): |
failing_tests.append(t) |
if not failing_tests: |
return |
@@ -112,6 +122,7 @@ class TestUtilsApi(recipe_api.RecipeApi): |
self.m.tryserver.set_transient_failure_tryjob_result() |
raise |
finally: |
+ # Failing AMP tests will be run locally without the patch |
run('without patch', failing_tests) |
with self.m.step.defer_results(): |
for t in failing_tests: |