Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: scripts/slave/recipe_modules/auto_bisect/local_bisect.py

Issue 2247373002: Refactor stages 1, 2 and test_api overhaul. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Rebasing, addressing feedback. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: scripts/slave/recipe_modules/auto_bisect/local_bisect.py
diff --git a/scripts/slave/recipe_modules/auto_bisect/local_bisect.py b/scripts/slave/recipe_modules/auto_bisect/local_bisect.py
index 0f4e6a97873287e6446ca8d19e34f14463810a66..a19adf846cdd10250c2325adcebdcb6fea1be61c 100644
--- a/scripts/slave/recipe_modules/auto_bisect/local_bisect.py
+++ b/scripts/slave/recipe_modules/auto_bisect/local_bisect.py
@@ -6,6 +6,7 @@ import base64
import collections
import json
+from . import exceptions
def perform_bisect(api, **flags):
# Try catch all the exceptions thrown in bisection so that recipe can
@@ -34,9 +35,13 @@ def perform_bisect(api, **flags):
continue
else:
raise
- except: # pylint: disable=bare-except
+ except exceptions.InconclusiveBisectException:
if bisect_attempts:
- bisect_attempts[-1].post_result(halt_on_failure=True)
+ bisect_attempts[-1].post_result()
+ raise api.m.step.StepFailure('Bisect cannot identify a culprit')
+ except Exception: # pylint: disable=bare-except
+ if bisect_attempts:
+ bisect_attempts[-1].post_result()
raise
def _perform_single_bisect(api, bisect_attempts, **flags):
@@ -47,9 +52,10 @@ def _perform_single_bisect(api, bisect_attempts, **flags):
bisector = api.create_bisector(bisect_config, **flags)
bisect_attempts.append(bisector)
with api.m.step.nest('Gathering reference values'):
- _gather_reference_range(api, bisector)
+ _gather_reference_range(bisector)
if (not bisector.failed and bisector.check_improvement_direction() and
bisector.check_initial_confidence()):
+ bisector.compute_relative_change()
if bisector.check_reach_adjacent_revision(
bisector.good_rev): # pragma: no cover
# Only show this step if bisect has reached adjacent revisions.
@@ -68,22 +74,19 @@ def _get_connected_devices(api):
api.m.chromium_android.device_status()
return api.m.chromium_android.devices
-def _gather_reference_range(api, bisector): # pragma: no cover
+def _gather_reference_range(bisector): # pragma: no cover
bisector.good_rev.start_job()
bisector.bad_rev.start_job()
- bisector.wait_for_all([bisector.good_rev, bisector.bad_rev])
if bisector.good_rev.failed:
bisector.surface_result('REF_RANGE_FAIL')
- api.m.halt('Testing the "good" revision failed')
bisector.failed = True
+ raise exceptions.InconclusiveBisectException(
+ 'Testing the "good" revision failed')
elif bisector.bad_rev.failed:
bisector.surface_result('REF_RANGE_FAIL')
- api.m.halt('Testing the "bad" revision failed')
bisector.failed = True
- api.m.halt('Testing the "good" revision failed')
- else:
- bisector.compute_relative_change()
-
+ raise exceptions.InconclusiveBisectException(
+ 'Testing the "bad" revision failed')
def _bisect_main_loop(bisector): # pragma: no cover
"""This is the main bisect loop.
@@ -101,7 +104,6 @@ def _bisect_main_loop(bisector): # pragma: no cover
revision_to_check.revision_string())):
bisector.post_result(halt_on_failure=False)
revision_to_check.start_job()
- bisector.wait_for(revision_to_check)
if bisector.check_reach_adjacent_revision(revision_to_check):
# Only show this step if bisect has reached adjacent revisions.

Powered by Google App Engine
This is Rietveld 408576698