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

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

Issue 1782333002: Add bisect config validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 9 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/bisector.py
diff --git a/scripts/slave/recipe_modules/auto_bisect/bisector.py b/scripts/slave/recipe_modules/auto_bisect/bisector.py
index e6caa9b47da7853f5ece3715996a20bd77c01c86..83b31642f346e895f03dbe81a775a9d839be1a75 100644
--- a/scripts/slave/recipe_modules/auto_bisect/bisector.py
+++ b/scripts/slave/recipe_modules/auto_bisect/bisector.py
@@ -7,6 +7,7 @@ import re
import time
import urllib
+from . import config_validation
from . import depot_config
from . import revision_state
@@ -75,11 +76,11 @@ class Bisector(object):
"""
super(Bisector, self).__init__()
self._api = api
+ self.result_codes = set()
self.ensure_sync_master_branch()
self.bisect_config = bisect_config
self.config_step()
self.revision_class = revision_class
- self.result_codes = set()
self.last_tested_revision = None
# Test-only properties.
@@ -189,8 +190,9 @@ class Bisector(object):
return significantly_different
def config_step(self):
- """Yields a simple echo step that outputs the bisect config."""
+ """Validates the config and yields a step that prints the bisect config."""
api = self.api
+
# bisect_config may come as a FrozenDict (which is not serializable).
bisect_config = dict(self.bisect_config)
@@ -201,12 +203,19 @@ class Bisector(object):
for k, v in bisect_config.iteritems():
if isinstance(v, basestring):
bisect_config[k] = fix_windows_backslashes(v)
+
+ step = api.m.step('config', [])
+ try:
+ config_validation.validate_config(bisect_config)
+ except config_validation.ValidationFail as error:
+ self.surface_result('BAD_CONFIG')
+ raise self.api.m.step.StepFailure(error.message)
qyearsley 2016/03/11 01:41:34 Would this provide everything in the buildbot job
RobertoCN 2016/03/14 01:26:23 Just set the step to failed as well before raising
qyearsley 2016/03/18 22:50:19 Done; making it it's own step may make it be clear
+
# We sort the keys to prevent problems with orders changing when
# recipe_simulation_test compares against expectation files.
config_string = json.dumps(bisect_config, indent=2, sort_keys=True)
- result = api.m.step('config', [])
config_lines = config_string.splitlines()
- result.presentation.logs['Bisect job configuration'] = config_lines
+ step.presentation.logs['Bisect job configuration'] = config_lines
@property
def api(self):

Powered by Google App Engine
This is Rietveld 408576698