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

Side by Side Diff: scripts/slave/recipe_modules/auto_bisect/bisector.py

Issue 1062583003: Adding config step to output the bisect config dictionary. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@hax
Patch Set: Sorting keys. Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/auto_bisect/example.expected/bad_deps_syntax.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import json
5 import re 6 import re
6 7
7 from . import bisect_results 8 from . import bisect_results
8 from . import depot_config 9 from . import depot_config
9 10
10 _DEPS_SHA_PATCH = """ 11 _DEPS_SHA_PATCH = """
11 diff --git DEPS.sha DEPS.sha 12 diff --git DEPS.sha DEPS.sha
12 new file mode 100644 13 new file mode 100644
13 --- /dev/null 14 --- /dev/null
14 +++ DEPS.sha 15 +++ DEPS.sha
(...skipping 10 matching lines...) Expand all
25 26
26 def __init__(self, api, bisect_config, revision_class, init_revisions=True): 27 def __init__(self, api, bisect_config, revision_class, init_revisions=True):
27 """Initializes the state of a new bisect job from a dictionary. 28 """Initializes the state of a new bisect job from a dictionary.
28 29
29 Note that the initial good_rev and bad_rev MUST resolve to a commit position 30 Note that the initial good_rev and bad_rev MUST resolve to a commit position
30 in the chromium repo. 31 in the chromium repo.
31 """ 32 """
32 super(Bisector, self).__init__() 33 super(Bisector, self).__init__()
33 self._api = api 34 self._api = api
34 self.bisect_config = bisect_config 35 self.bisect_config = bisect_config
36 self.config_step()
35 self.revision_class = revision_class 37 self.revision_class = revision_class
36 38
37 # Test-only properties. 39 # Test-only properties.
38 # TODO: Replace these with proper mod_test_data 40 # TODO: Replace these with proper mod_test_data
39 self.dummy_regression_confidence = bisect_config.get( 41 self.dummy_regression_confidence = bisect_config.get(
40 'dummy_regression_confidence') 42 'dummy_regression_confidence')
41 self.dummy_builds = bisect_config.get('dummy_builds', False) 43 self.dummy_builds = bisect_config.get('dummy_builds', False)
42 44
43 # Loading configuration items 45 # Loading configuration items
44 self.test_type = bisect_config.get('test_type', 'perf') 46 self.test_type = bisect_config.get('test_type', 'perf')
(...skipping 19 matching lines...) Expand all
64 66
65 # Initial revision range 67 # Initial revision range
66 self.revisions = [] 68 self.revisions = []
67 self.bad_rev = revision_class(bisect_config['bad_revision'], self) 69 self.bad_rev = revision_class(bisect_config['bad_revision'], self)
68 self.bad_rev.bad = True 70 self.bad_rev.bad = True
69 self.good_rev = revision_class(bisect_config['good_revision'], self) 71 self.good_rev = revision_class(bisect_config['good_revision'], self)
70 self.good_rev.good = True 72 self.good_rev.good = True
71 if init_revisions: 73 if init_revisions:
72 self._expand_revision_range() 74 self._expand_revision_range()
73 75
76 def config_step(self):
77 """Yields a simple echo step that outputs the bisect config."""
78 api = self.api
79 # bisect_config may come as a FrozenDict (which is not serializable).
80 bisect_config = dict(self.bisect_config)
81
82 def fix_windows_backslashes(s):
83 backslash_regex = re.compile(r'(?<!\\)\\(?!\\)')
84 return backslash_regex.sub(r'\\', s)
85
86 for k, v in bisect_config.iteritems():
87 if isinstance(v, basestring):
88 bisect_config[k] = fix_windows_backslashes(v)
89 # We sort the keys to prevent problems with orders changing when
90 # recipe_simulation_test compares against expectation files.
91 api.m.step('config', ['echo', json.dumps(bisect_config, indent=2,
92 sort_keys=True)])
93
74 @property 94 @property
75 def api(self): 95 def api(self):
76 return self._api 96 return self._api
77 97
78 @staticmethod 98 @staticmethod
79 def _commit_pos_range(a, b): 99 def _commit_pos_range(a, b):
80 """Given 2 commit positions, returns a list with the ones between.""" 100 """Given 2 commit positions, returns a list with the ones between."""
81 a, b = sorted(map(int, [a, b])) 101 a, b = sorted(map(int, [a, b]))
82 return xrange(a + 1, b) 102 return xrange(a + 1, b)
83 103
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 return 'linux_perf_tester' 501 return 'linux_perf_tester'
482 502
483 def get_builder_bot_for_this_platform(self): 503 def get_builder_bot_for_this_platform(self):
484 # TODO: Actually look at the current platform. 504 # TODO: Actually look at the current platform.
485 return 'linux_perf_bisect_builder' 505 return 'linux_perf_bisect_builder'
486 506
487 def get_platform_gs_prefix(self): 507 def get_platform_gs_prefix(self):
488 # TODO: Actually check the current platform 508 # TODO: Actually check the current platform
489 return 'gs://chrome-perf/Linux Builder/full-build-linux_' 509 return 'gs://chrome-perf/Linux Builder/full-build-linux_'
490 510
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/auto_bisect/example.expected/bad_deps_syntax.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698