Index: scripts/slave/recipes/bisection/android_bisect_staging.py |
diff --git a/scripts/slave/recipes/bisection/android_bisect_staging.py b/scripts/slave/recipes/bisection/android_bisect_staging.py |
index 43f669ae4de16b9b9b2b0e2478d6079fed2a9752..a9e8a3f00cbd889e196c13f8600814473c3d28ce 100644 |
--- a/scripts/slave/recipes/bisection/android_bisect_staging.py |
+++ b/scripts/slave/recipes/bisection/android_bisect_staging.py |
@@ -2,6 +2,8 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
+import contextlib |
+ |
from recipe_engine.types import freeze |
DEPS = [ |
@@ -127,6 +129,35 @@ def RunSteps(api, mastername, buildername): |
api.chromium_android.use_devil_adb() |
+ @contextlib.contextmanager |
+ def android_bisect_build_wrapper(new_api): |
+ """A context manager for use as auto_bisect's build_context_mgr. |
+ |
+ This wraps each individual bisect test. We use new_api here to |
+ disambiguate from RunSteps' api object. Otherwise calling |
+ auto_bisect_staging from within auto_bisect_staging causes a module |
+ to require itself. |
+ """ |
+ with api.chromium_android.android_build_wrapper()(new_api): |
+ try: |
+ yield |
+ finally: |
+ api.auto_bisect_staging.ensure_checkout() |
+ |
+ @contextlib.contextmanager |
+ def android_bisect_test_wrapper(api): |
jbudorick
2016/11/11 01:15:55
You have api here and new_api above. I'm guessing
ghost stip (do not use)
2016/11/11 02:19:18
sure, why not
|
+ """A context manager for use as auto_bisect's test_context_mgr. |
+ |
+ This wraps each individual bisect test. |
+ """ |
+ api.chromium_android.use_devil_adb() |
+ with api.chromium_android.android_test_wrapper()(api): |
+ yield |
+ |
+ # Make sure the bisect build and individual test runs are wrapped. |
+ api.auto_bisect_staging.build_context_mgr = android_bisect_build_wrapper |
+ api.auto_bisect_staging.test_context_mgr = android_bisect_test_wrapper |
+ |
api.auto_bisect_staging.start_try_job(api, update_step=update_step, |
bot_db=bot_db, |
do_not_nest_wait_for_revision=True) |