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

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

Issue 940123005: Adding ability to bisect recipe to bisect into dependency repos. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@hax
Patch Set: Further expansion of example.py for auto_bisect. Created 5 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 import json
6
7 DEPS = [
8 'auto_bisect',
9 'path',
10 'properties',
11 'raw_io',
12 ]
13
14
15 def GenSteps(api):
qyearsley 2015/02/27 23:12:02 General question: When in example.GenSteps called?
RobertoCN 2015/03/03 21:45:30 Example is just a recipe like any other. GenSteps
16 # Setting `api.path['checkout']` would ordinarily be done by
17 # `api.chromium_tests.sync_and_configure_build`
18 fake_checkout_path = api.path.mkdtemp('fake_checkout')
19 api.path['checkout'] = fake_checkout_path
20 # Create a bisector
21 bisector = api.auto_bisect.create_bisector(api.properties['bisect_config'])
22 # Request builds
23 bisector.good_rev.start_job()
24 bisector.bad_rev.start_job()
25 # Wait for builds and tests to finish
26 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev])
27
28 # TODO(robertocn): Add examples for the following operations
29 # Check improvement direction
30 assert bisector.check_improvement_direction()
31 # Check regression confidence
qyearsley 2015/02/27 23:12:02 Some of these comments are probably unnecessary.
RobertoCN 2015/03/03 21:45:30 Done.
32 assert bisector.check_regression_confidence()
33 # Get revisions to check
34 revisions_to_check = bisector.get_revisions_to_eval(1)
35 assert len(revisions_to_check) == 1
36 revisions_to_check[0].start_job()
37 bisector.wait_for_any(revisions_to_check)
38 # Check if bisect is finished
39 bisector.check_bisect_finished(revisions_to_check[0])
40 # Abort unnecesary jobs
41 # Print results
42
43
44 def GenTests(api):
45 yield _basic_test(api)
46
47
48 def _basic_test(api):
49 test_data = [
50 {
51 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
52 'commit_pos': '314015',
53 'test_results': {
54 'results':{
55 'mean': 20,
56 'std_err': 1,
57 'values': [19, 20, 21],
58 }
59 },
60 "DEPS": ("vars={'v8_revision': '001'};"
61 "deps = {'src/v8': 'v8.git@' + Var('v8_revision'),"
62 "'src/third_party/WebKit': 'webkit.git@010'}"),
63 'git_diff': {
64 '002': 'Dummy .diff contents 001 - 002',
65 '003': 'Dummy .diff contents 001 - 003',
66 },
67 },
68 {
69 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
70 'commit_pos': '314016',
71 'test_results': {
72 'results':{
73 'mean': 15,
74 'std_err': 1,
75 'values': [14, 15, 16],
76 }
77 },
78 'DEPS_change': 'True',
79 "DEPS": ("vars={'v8_revision': '004'};"
80 "deps = {'src/v8': 'v8.git@' + Var('v8_revision'),"
81 "'src/third_party/WebKit': 'webkit.git@010'}"),
82 'DEPS_interval': {'v8': '004 003 002'.split()},
83 },
84 {
85 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
86 'commit_pos': '314017',
87 'test_results': {
88 'results':{
89 'mean': 15,
90 'std_err': 1,
91 'values': [14, 15, 16],
92 }
93 }
94 },
95 ]
96 basic_test = api.test('basic')
97 for revision_data in test_data:
98 for step_data in _get_step_data_for_revision(api, revision_data):
99 basic_test += step_data
iannucci 2015/03/18 23:43:28 basic_test += sum(_get_step_data_for_revision(api,
robertocn1 2015/03/19 21:48:23 Done.
100 basic_test += api.properties(bisect_config=_get_default_config())
101 return basic_test
102
103
104 def _get_default_config():
105 example_config = {
106 'test_type':'perf',
107 'command':
108 ('src/tools/perf/run_benchmark -v --browser=release smoothness.'
109 'tough_scrolling_cases'),
110 'good_revision': '314015',
111 'bad_revision': '314017',
112 'metric': 'mean_input_event_latency/mean_input_event_latency',
113 'repeat_count': '2',
114 'max_time_minutes': '5',
115 'truncate_percent': '0',
116 'bug_id': '',
117 'gs_bucket': 'chrome-perf',
118 'builder_host': 'master4.golo.chromium.org',
119 'builder_port': '8341',
120 'dummy_builds': 'True',
121 }
122 return example_config
123
124
125 def _get_step_data_for_revision(api, revision_data, include_build_steps=True):
126 """Generator that produces step patches for fake results."""
127 commit_pos = revision_data['commit_pos']
128 commit_hash = revision_data['hash']
129 test_results = revision_data['test_results']
130
131 step_name ='resolving commit_pos ' + commit_pos
132 yield api.step_data(step_name, stdout=api.raw_io.output('hash:' +
133 commit_hash))
qyearsley 2015/02/27 23:12:02 Style nit: indentation seems off.
RobertoCN 2015/03/03 21:45:30 Done.
134
135 step_name ='resolving hash ' + commit_hash
qyearsley 2015/02/27 23:12:02 Style nit: space after "=".
RobertoCN 2015/03/03 21:45:30 Done.
136 commit_pos_str = 'refs/heads/master@{#%s}' % commit_pos
137 yield api.step_data(step_name, stdout=api.raw_io.output(commit_pos_str))
138
139 if include_build_steps:
140 step_name ='gsutil Get test results for build ' + commit_hash
qyearsley 2015/02/27 23:12:03 Style nit: space after "=".
RobertoCN 2015/03/03 21:45:30 Done.
141 yield api.step_data(step_name, stdout=api.raw_io.output(json.dumps(
142 test_results)))
143
144 step_name = 'Get test status for build ' + commit_hash
145 yield api.step_data(step_name, stdout=api.raw_io.output('Complete'))
146
147 step_name = 'gsutil Get test status url for build ' + commit_hash
148 yield api.step_data(step_name, stdout=api.raw_io.output('dummy/url'))
149
150 if revision_data.get('DEPS', False):
qyearsley 2015/02/27 23:12:02 Equivalent: if revision_data.get('DEPS'): ...
RobertoCN 2015/03/03 21:45:30 Done.
151 step_name = 'git cat-file %s:DEPS' % commit_hash
152 yield api.step_data(step_name, stdout=api.raw_io.output(
153 revision_data['DEPS']))
154
155 if revision_data.get('git_diff', False):
156 for deps_rev, diff_file in revision_data['git_diff'].iteritems():
157 step_name = 'Generating patch for %s:DEPS to %s'
158 step_name %= (commit_hash, deps_rev)
159 yield api.step_data(step_name, stdout=api.raw_io.output(diff_file))
160
161 if revision_data.get('DEPS_change', False):
162 step_name = 'Checking DEPS for ' + commit_hash
163 yield api.step_data(step_name, stdout=api.raw_io.output('DEPS'))
164
165 if revision_data.get('DEPS_interval', False):
166 for depot_name, interval in revision_data['DEPS_interval'].iteritems():
167 for item in interval[1:]:
168 step_name = 'Hashing modified DEPS file with revision ' + item
169 yield api.step_data(step_name, stdout=api.raw_io.output('f412e8458'))
170 step_name = 'Expanding revision range for revision %s on depot %s'
171 step_name %= (interval[0], depot_name)
172 stdout=api.raw_io.output('\n'.join(interval))
qyearsley 2015/02/27 23:12:03 Style nit: spaces around "=".
RobertoCN 2015/03/03 21:45:30 Done.
173 yield api.step_data(step_name, stdout=stdout)
174
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698