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

Side by Side Diff: scripts/slave/recipe_modules/auto_bisect/example.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: Got full coverage for new and changed code. 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 unified diff | Download patch
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 json
6 6
7 DEPS = [ 7 DEPS = [
8 'auto_bisect', 8 'auto_bisect',
9 'chromium',
9 'chromium_tests', 10 'chromium_tests',
10 'recipe_engine/json', 11 'recipe_engine/json',
12 'depot_tools/gclient',
11 'recipe_engine/path', 13 'recipe_engine/path',
14 'recipe_engine/platform',
12 'recipe_engine/properties', 15 'recipe_engine/properties',
13 'recipe_engine/raw_io', 16 'recipe_engine/raw_io',
14 'recipe_engine/step', 17 'recipe_engine/step',
15 ] 18 ]
16 19
17 """This file is a recipe demonstrating the auto_bisect recipe module. 20 """This file is a recipe demonstrating the auto_bisect recipe module.
18 21
19 For more information about recipes, see: https://goo.gl/xKnjz6 22 For more information about recipes, see: https://goo.gl/xKnjz6
20 """ 23 """
21 24
22 25
23 def RunSteps(api): 26 def RunSteps(api):
24 fake_checkout_path = api.path.mkdtemp('fake_checkout') 27 # Dupe of bisection/desktop_bisect recipe.
25 api.path['checkout'] = fake_checkout_path 28 mastername = api.properties.get('mastername')
26 bisector = api.auto_bisect.create_bisector(api.properties['bisect_config'], 29 buildername = api.properties.get('buildername')
27 do_not_nest_wait_for_revision=True) 30 bot_config = api.chromium_tests.create_bot_config_object(mastername,
28 31 buildername)
29 # Request builds and tests for initial range and wait. 32 api.chromium_tests.configure_build(bot_config)
30 bisector.good_rev.start_job() 33 api.gclient.apply_config('perf')
31 bisector.bad_rev.start_job() 34 api.gclient.c.got_revision_mapping.pop('catapult', None)
32 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) 35 update_step, bot_db = api.chromium_tests.prepare_checkout(bot_config)
33 36 api.path.c.dynamic_paths['catapult'] = api.auto_bisect.working_dir.join(
34 if bisector.good_rev.failed or bisector.bad_rev.failed: 37 'catapult')
35 return 38 api.auto_bisect.start_try_job(api, update_step=update_step, bot_db=bot_db,
36 39 do_not_nest_wait_for_revision=True)
37 assert bisector.check_improvement_direction()
38 assert bisector.check_initial_confidence()
39 revision_to_check = bisector.get_revision_to_eval()
40 revision_to_check.start_job()
41 bisector.wait_for(revision_to_check)
42 bisector.check_bisect_finished(revision_to_check)
43
44 # Evaluate inserted DEPS-modified revisions.
45 revision_to_check = bisector.get_revision_to_eval()
46 if revision_to_check:
47 revision_to_check.start_job()
48 # Only added for coverage.
49 revision_to_check.read_deps(bisector.get_perf_tester_name())
50 api.auto_bisect.query_revision_info(revision_to_check)
51 else:
52 raise api.step.StepFailure('Expected revision to check.')
53 # TODO(robertocn): Add examples for the following operations:
54 # Abort unnecessary jobs
55 # Print results (may be done in a unit test)
56
57 # Test runner for classic bisect script; calls bisect script in recipe
58 # wrapper with extra_src and path_to_config to override default behavior for
59 # android-chrome bisect jobs.
60 if api.properties.get('mastername'):
61 # TODO(akuegel): Load the config explicitly instead of relying on the
62 # builders.py entries in chromium_tests.
63 mastername = api.properties.get('mastername')
64 buildername = api.properties.get('buildername')
65 bot_config = api.chromium_tests.create_bot_config_object(
66 mastername, buildername)
67 api.chromium_tests.configure_build(bot_config)
68 api.chromium_tests.prepare_checkout(bot_config)
69 kwargs = {
70 'extra_src': 'dummy_extra_src',
71 'path_to_config': '/dummy/path/',
72 }
73 api.auto_bisect.run_bisect_script(**kwargs)
74
75 40
76 def GenTests(api): 41 def GenTests(api):
77 dummy_gs_location = ('gs://chrome-perf/bisect-results/' 42 yield (
78 'a6298e4afedbf2cd461755ea6f45b0ad64222222-test.results') 43 api.test('basic_linux_bisect')
79 basic_test = _make_test(api, _get_basic_test_data(), 'basic') 44 + api.properties(
80 yield basic_test 45 mastername='tryserver.chromium.perf',
81 46 buildername='linux_perf_bisect',
82 invalid_config_test = api.test('invalid_config') 47 slavename='dummyslave',
83 invalid_config_test += api.properties( 48 bisect_config={
84 bisect_config=_get_config({'good_revision': 'not a valid revision'})) 49 'test_type': 'perf',
85 yield invalid_config_test 50 'command':
86 51 ('src/tools/perf/run_benchmark -v --browser=release '
87 failed_build_test = _make_test( 52 '--output-format=valueset smoothness.tough_scrolling_cases'),
88 api, _get_ref_range_only_test_data(), 'failed_build_test', 53 'good_revision': '314015',
89 extra_config={'dummy_builds': None}) 54 'bad_revision': '314017',
90 failed_build_test += api.step_data('gsutil ls', retcode=1) 55 'metric': 'mean_input_event_latency/mean_input_event_latency',
91 failed_build_test += api.step_data('gsutil ls (2)' , retcode=1) 56 'bug_id': '-1',
92 failed_build_test += api.step_data('gsutil ls (3)' , retcode=1) 57 'gs_bucket': 'chrome-perf',
93 failed_build_test += api.step_data( 58 'dummy_tests': 'True',
94 'buildbucket.get', stdout=api.json.output( 59 'dummy_job_names': 'True',
95 {'build':{'status': 'COMPLETE', 'result': 'FAILED'}})) 60 'bypass_stats_check': 'True',
96 yield failed_build_test 61 'skip_gclient_ops': 'True',
97 62 'recipe_tester_name': 'linux_perf_tester'
98 63 })
99 delayed_build_test = _make_test( 64 + api.auto_bisect([
100 api, _get_ref_range_only_test_data(), 'delayed_build_test', 65 {
101 extra_config={'dummy_builds': None}) 66 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
102 delayed_build_test += api.step_data('gsutil ls', retcode=1) 67 'commit_pos': '314015',
103 delayed_build_test += api.step_data('gsutil ls (2)', retcode=1) 68 'parsed_values': [19, 20, 23],
104 delayed_build_test += api.step_data('gsutil ls (3)', retcode=1) 69 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
105 delayed_build_test += api.step_data('gsutil ls (4)', retcode=1) 70 'gsutil_exists': 10 * [False]
106 delayed_build_test += api.step_data('gsutil ls (5)', retcode=1) 71 },
107 delayed_build_test += api.step_data('gsutil ls (6)', retcode=1) 72 {
108 delayed_build_test += api.step_data( 73 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
109 'buildbucket.get', stdout=api.json.output( 74 'commit_pos': '314016',
110 {'build':{'status': 'PENDING'}})) 75 'parsed_values': [12, 13, 16],
111 yield delayed_build_test 76 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
112 77 'gsutil_exists': [True],
113 missing_metric_test = _make_test( 78 'cl_info': {
114 api, _get_ref_range_only_missing_metric_test_data(), 79 'author': 'DummyAuthor',
115 'missing_metric_test') 80 'email': 'dummy@nowhere.com',
116 yield missing_metric_test 81 'subject': 'Some random CL',
117 82 'date': '01/01/2015',
118 windows_test = _make_test( 83 'body': ('A long description for a CL.\n'
119 api, _get_basic_test_data(), 'windows_bisector', platform='windows') 84 'Containing multiple lines'),
120 yield windows_test
121
122 winx64_test = _make_test(
123 api, _get_basic_test_data(), 'windows_x64_bisector', platform='win_x64')
124 yield winx64_test
125
126 mac_test = _make_test(
127 api, _get_basic_test_data(), 'mac_bisector', platform='mac')
128 yield mac_test
129
130 android_test = _make_test(
131 api, _get_basic_test_data(), 'android_bisector', platform='android')
132 yield android_test
133
134 android_arm64_test = _make_test(
135 api, _get_basic_test_data(), 'android_arm64_bisector',
136 platform='android_arm64')
137 yield android_arm64_test
138
139 failed_data = _get_basic_test_data()
140 failed_data[0].pop('DEPS')
141 failed_data[1]['test_results']['results']['errors'] = ['Dummy error.']
142 failed_data[1].pop('DEPS_change')
143 failed_data[1].pop('DEPS')
144 failed_data[1].pop('DEPS_interval')
145 failed_data[0].pop('git_diff')
146 failed_data[0].pop('cl_info')
147 yield _make_test(api, failed_data, 'failed_test')
148
149 yield _make_test(api, _get_reversed_basic_test_data(), 'reversed_basic')
150
151 bad_git_hash_data = _get_basic_test_data()
152 bad_git_hash_data[1]['interned_hashes'] = {'003': '12345', '002': 'Bad Hash'}
153
154 bisect_script_test = _make_test(
155 api, _get_basic_test_data(), 'basic_bisect_script')
156
157 yield bisect_script_test
158
159
160 def _get_ref_range_only_test_data():
161 return [
162 {
163 'refrange': True,
164 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
165 'commit_pos': '314015',
166 'fail_to_build': True,
167 },
168 {
169 'refrange': True,
170 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
171 'commit_pos': '314017',
172 },
173 ]
174
175
176 def _get_ref_range_only_missing_metric_test_data():
177 return [
178 {
179 'refrange': True,
180 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
181 'commit_pos': '314015',
182 'test_results': {
183 'results': {
184 'values': [],
185 }, 85 },
186 'retcodes': [0], 86 },
187 } 87 {
188 }, 88 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
189 { 89 'commit_pos': '314017',
190 'refrange': True, 90 'parsed_values': [12, 13, 14, 15, 16],
191 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111', 91 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
192 'commit_pos': '314017', 92 }]))
193 'test_results': { 93 yield (
194 'results': { 94 api.test('basic_win64_bisect')
195 'values': [], 95 + api.platform('win', 64)
96 + api.properties(
97 mastername='tryserver.chromium.perf',
98 buildername='winx64_zen_perf_bisect',
99 slavename='dummyslave',
100 bisect_config={
101 'test_type': 'perf',
102 'command':
103 ('src/tools/perf/run_benchmark -v --browser=release '
104 '--output-format=valueset smoothness.tough_scrolling_cases'),
105 'good_revision': '314015',
106 'bad_revision': '314017',
107 'metric': 'mean_input_event_latency/mean_input_event_latency',
108 'bug_id': '-1',
109 'gs_bucket': 'chrome-perf',
110 'dummy_builds': 'True',
111 'dummy_tests': 'True',
112 'dummy_job_names': 'True',
113 'bypass_stats_check': 'True',
114 'skip_gclient_ops': 'True',
115 'recipe_tester_name': 'winx64_perf_tester'
116 })
117 + api.auto_bisect([
118 {
119 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
120 'commit_pos': '314015',
121 'parsed_values': [19, 20, 21, 22, 23],
122 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
123 'gsutil_exists': 5 * [False]
124 },
125 {
126 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
127 'commit_pos': '314016',
128 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
129 'cl_info': {
130 'author': 'DummyAuthor',
131 'email': 'dummy@nowhere.com',
132 'subject': 'Some random CL',
133 'date': '01/01/2015',
134 'body': ('A long description for a CL.\n'
135 'Containing multiple lines'),
196 }, 136 },
197 'retcodes': [0], 137 },
198 } 138 {
199 }, 139 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
200 ] 140 'commit_pos': '314017',
201 141 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
202 142 }]))
203 def _get_basic_test_data(): 143 yield (
204 return [ 144 api.test('basic_win32_bisect')
205 { 145 + api.platform('win', 32)
206 'refrange': True, 146 + api.properties(
207 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222', 147 mastername='tryserver.chromium.perf',
208 'commit_pos': '314015', 148 buildername='win_perf_bisect',
209 'test_results': { 149 slavename='dummyslave',
210 'results':{ 150 bisect_config={
211 'values': [19, 20, 21, 22, 23], 151 'test_type': 'perf',
152 'command':
153 ('src/tools/perf/run_benchmark -v --browser=release '
154 '--output-format=valueset smoothness.tough_scrolling_cases'),
155 'good_revision': '314015',
156 'bad_revision': '314017',
157 'metric': 'mean_input_event_latency/mean_input_event_latency',
158 'bug_id': '-1',
159 'gs_bucket': 'chrome-perf',
160 'dummy_builds': 'True',
161 'dummy_tests': 'True',
162 'dummy_job_names': 'True',
163 'bypass_stats_check': 'True',
164 'skip_gclient_ops': 'True',
165 'recipe_tester_name': 'win_perf_tester'
166 })
167 + api.auto_bisect([
168 {
169 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
170 'commit_pos': '314015',
171 'parsed_values': [19, 20, 21, 22, 23],
172 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
173 'gsutil_exists': 5 * [False]
174 },
175 {
176 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
177 'commit_pos': '314016',
178 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
179 'cl_info': {
180 'author': 'DummyAuthor',
181 'email': 'dummy@nowhere.com',
182 'subject': 'Some random CL',
183 'date': '01/01/2015',
184 'body': ('A long description for a CL.\n'
185 'Containing multiple lines'),
212 }, 186 },
213 'retcodes': [0], 187 },
214 }, 188 {
215 "DEPS": ("vars={'v8_revision': '001'};" 189 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
216 "deps = {'src/v8': 'v8.git@' + Var('v8_revision')," 190 'commit_pos': '314017',
217 "'src/third_party/WebKit': 'webkit.git@010'}"), 191 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
218 'git_diff': { 192 }]))
219 '002': 'Dummy .diff contents 001 - 002', 193 yield (
220 '003': 'Dummy .diff contents 001 - 003', 194 api.test('basic_mac_bisect')
221 }, 195 + api.platform('mac', 64)
222 'cl_info': { 196 + api.properties(
223 'author': 'DummyAuthor', 197 mastername='tryserver.chromium.perf',
224 'email': 'dummy@nowhere.com', 198 buildername='mac_10_11_perf_bisect',
225 'subject': 'Some random CL', 199 slavename='dummyslave',
226 'date': '01/01/2015', 200 bisect_config={
227 'body': ('A long description for a CL.\n' 201 'test_type': 'perf',
228 'Containing multiple lines'), 202 'command':
229 }, 203 ('src/tools/perf/run_benchmark -v --browser=release '
230 }, 204 '--output-format=valueset smoothness.tough_scrolling_cases'),
231 { 205 'good_revision': '314015',
232 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988', 206 'bad_revision': '314017',
233 'commit_pos': '314016', 207 'metric': 'mean_input_event_latency/mean_input_event_latency',
234 'test_results': { 208 'bug_id': '-1',
235 'results': { 209 'gs_bucket': 'chrome-perf',
236 'values': [12, 13, 14, 15, 16], 210 'dummy_builds': 'True',
211 'dummy_tests': 'True',
212 'dummy_job_names': 'True',
213 'bypass_stats_check': 'True',
214 'skip_gclient_ops': 'True',
215 'recipe_tester_name': 'mac_10_11_perf_bisect'
216 })
217 + api.auto_bisect([
218 {
219 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
220 'commit_pos': '314015',
221 'parsed_values': [19, 20, 21, 22, 23],
222 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
223 'gsutil_exists': 5 * [False]
224 },
225 {
226 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
227 'commit_pos': '314016',
228 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
229 'cl_info': {
230 'author': 'DummyAuthor',
231 'email': 'dummy@nowhere.com',
232 'subject': 'Some random CL',
233 'date': '01/01/2015',
234 'body': ('A long description for a CL.\n'
235 'Containing multiple lines'),
237 }, 236 },
238 'retcodes': [0], 237 },
239 }, 238 {
240 'DEPS_change': 'True', 239 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
241 "DEPS": ("vars={'v8_revision': '004'};" 240 'commit_pos': '314017',
242 "deps = {'src/v8': 'v8.git@' + Var('v8_revision')," 241 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
243 "'src/third_party/WebKit': 'webkit.git@010'}"), 242 }]))
244 'DEPS_interval': {'v8': '002 003 004'.split()}, 243 yield (
245 }, 244 api.test('v8_roll_bisect_bis')
246 { 245 + api.properties(
247 'refrange': True, 246 mastername='tryserver.chromium.perf',
248 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111', 247 buildername='linux_perf_bisect',
249 'commit_pos': '314017', 248 slavename='dummyslave',
250 'test_results': { 249 bisect_config={
251 'results': { 250 'test_type': 'perf',
252 'values': [12, 13, 14, 15, 16], 251 'command':
252 ('src/tools/perf/run_benchmark -v --browser=release '
253 '--output-format=valueset smoothness.tough_scrolling_cases'),
254 'good_revision': '314015',
255 'bad_revision': '314017',
256 'metric': 'mean_input_event_latency/mean_input_event_latency',
257 'bug_id': '-1',
258 'gs_bucket': 'chrome-perf',
259 'dummy_builds': 'True',
260 'dummy_tests': 'True',
261 'dummy_job_names': 'True',
262 'bypass_stats_check': 'True',
263 'skip_gclient_ops': 'True',
264 'recipe_tester_name': 'linux_perf_tester'
265 })
266 + api.auto_bisect([
267 {
268 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
269 'commit_pos': '314015',
270 'parsed_values': [19, 20, 21, 22, 23],
271 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
272 },
273 {
274 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
275 'commit_pos': '314016',
276 'parsed_values': [19, 20, 21, 22, 23],
277 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
278 "DEPS": ("vars={'v8_revision': '001'};"
279 "deps = {'src/v8': 'v8.git@' + Var('v8_revision'),"
280 "'src/third_party/WebKit': 'webkit.git@010'}"),
281 },
282 {
283 'depot':'v8',
284 'hash': '002',
285 'parsed_values': [12, 13, 14, 15, 16],
286 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
287 'gsutil_exists': 10 * [False],
288 'cl_info': {
289 'author': 'DummyAuthor',
290 'email': 'dummy@nowhere.com',
291 'subject': 'Some random CL',
292 'date': '01/01/2015',
293 'body': ('A long description for a CL.\n'
294 'Containing multiple lines'),
253 }, 295 },
254 'retcodes': [0], 296 },
255 } 297 {
256 }, 298 'depot':'v8',
257 ] 299 'hash': '003',
258 300 'parsed_values': [12, 13, 14, 15, 16],
259 301 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
260 def _get_reversed_basic_test_data(): 302 },
261 return [ 303 {
262 { 304 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
263 'refrange': True, 305 'commit_pos': '314017',
264 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111', 306 'parsed_values': [12, 13, 14, 15, 16],
265 'commit_pos': '314015', 307 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
266 'test_results': { 308 'DEPS_change': 'True',
267 'results': { 309 "DEPS": ("vars={'v8_revision': '004'};"
268 'values': [19, 20, 21, 22, 23], 310 "deps = {'src/v8': 'v8.git@' + Var('v8_revision'),"
311 "'src/third_party/WebKit': 'webkit.git@010'}"),
312 'DEPS_interval': {'v8': '002 003 004'.split()},
313 }]))
314 yield (
315 api.test('v8_roll_bisect')
316 + api.properties(
317 mastername='tryserver.chromium.perf',
318 buildername='linux_perf_bisect',
319 slavename='dummyslave',
320 bisect_config={
321 'test_type': 'perf',
322 'command':
323 ('src/tools/perf/run_benchmark -v --browser=release '
324 '--output-format=valueset smoothness.tough_scrolling_cases'),
325 'good_revision': '314015',
326 'bad_revision': '314017',
327 'metric': 'mean_input_event_latency/mean_input_event_latency',
328 'bug_id': '-1',
329 'gs_bucket': 'chrome-perf',
330 'dummy_builds': 'True',
331 'dummy_tests': 'True',
332 'dummy_job_names': 'True',
333 'bypass_stats_check': 'True',
334 'skip_gclient_ops': 'True',
335 'recipe_tester_name': 'linux_perf_tester'
336 })
337 + api.auto_bisect([
338 {
339 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
340 'commit_pos': '314015',
341 'parsed_values': [19, 20, 21, 22, 23],
342 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
343 "DEPS": ("vars={'v8_revision': '001'};"
344 "deps = {'src/v8': 'v8.git@' + Var('v8_revision'),"
345 "'src/third_party/WebKit': 'webkit.git@010'}"),
346 },
347 {
348 'depot':'v8',
349 'hash': '002',
350 'parsed_values': [12, 13, 14, 15, 16],
351 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
352 'gsutil_exists': 10 * [False],
353 'cl_info': {
354 'author': 'DummyAuthor',
355 'email': 'dummy@nowhere.com',
356 'subject': 'Some random CL',
357 'date': '01/01/2015',
358 'body': ('A long description for a CL.\n'
359 'Containing multiple lines'),
269 }, 360 },
270 'retcodes': [0], 361 },
271 }, 362 {
272 'cl_info': { 363 'depot':'v8',
273 'author': 'DummyAuthor', 364 'hash': '003',
274 'email': 'dummy@nowhere.com', 365 'parsed_values': [12, 13, 14, 15, 16],
275 'subject': 'Some random CL', 366 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
276 'date': '01/01/2015', 367 },
277 'body': ('A long description for a CL.\n' 368 {
278 'Containing multiple lines'), 369 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
279 }, 370 'commit_pos': '314016',
280 }, 371 'parsed_values': [12, 13, 14, 15, 16],
281 { 372 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
282 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222', 373 'DEPS_change': 'True',
283 'commit_pos': '314016', 374 "DEPS": ("vars={'v8_revision': '004'};"
284 'test_results': { 375 "deps = {'src/v8': 'v8.git@' + Var('v8_revision'),"
285 'results': { 376 "'src/third_party/WebKit': 'webkit.git@010'}"),
286 'values': [19, 20, 21, 22, 23], 377 'DEPS_interval': {'v8': '002 003 004'.split()},
378 },
379 {
380 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
381 'commit_pos': '314017',
382 'parsed_values': [12, 13, 14, 15, 16],
383 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
384 }]))
385 yield (
386 api.test('retest_bisect')
387 + api.properties(
388 mastername='tryserver.chromium.perf',
389 buildername='linux_perf_bisect',
390 slavename='dummyslave',
391 bisect_config={
392 'test_type': 'perf',
393 'command':
394 ('src/tools/perf/run_benchmark -v --browser=release '
395 '--output-format=valueset smoothness.tough_scrolling_cases'),
396 'good_revision': '314015',
397 'bad_revision': '314017',
398 'metric': 'mean_input_event_latency/mean_input_event_latency',
399 'bug_id': '-1',
400 'gs_bucket': 'chrome-perf',
401 'dummy_builds': 'True',
402 'dummy_tests': 'True',
403 'dummy_job_names': 'True',
404 'skip_gclient_ops': 'True',
405 'recipe_tester_name': 'linux_perf_tester'
406 })
407 + api.auto_bisect([
408 {
409 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
410 'commit_pos': '314015',
411 'parsed_values': [20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412 1],
413 },
414 {
415 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
416 'commit_pos': '314016',
417 'parsed_values': [20, 1, 1, 10, 10, 10, 10, 10, 10, 10, 10, 10,
418 10, 10, 10, 10, 10, 1],
419 },
420 {
421 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
422 'commit_pos': '314017',
423 'parsed_values': [20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 11],
425 }]))
426 yield (
427 api.test('bad_config')
428 + api.properties(
429 mastername='tryserver.chromium.perf',
430 buildername='linux_perf_bisect',
431 slavename='dummyslave',
432 bisect_config={
433 'test_type': 'perf',
434 'command':
435 ('src/tools/perf/run_benchmark -v --browser=release '
436 '--output-format=valueset smoothness.tough_scrolling_cases'),
437 'good_revision': '314015',
438 'bad_revision': '314016',
439 'metric': 'mean_input_event_latency/mean_input_event_latency',
440 'bug_id': 'crbug.com/123123',
441 'gs_bucket': 'chrome-perf',
442 'dummy_builds': 'True',
443 'dummy_tests': 'True',
444 'dummy_job_names': 'True',
445 'bypass_stats_check': 'True',
446 'skip_gclient_ops': 'True',
447 'recipe_tester_name': 'linux_perf_tester'
448 }))
449 yield (
450 api.test('return_code')
451 + api.properties(
452 mastername='tryserver.chromium.perf',
453 buildername='linux_perf_bisect',
454 slavename='dummyslave',
455 bisect_config={
456 'test_type': 'return_code',
457 'command':
458 ('src/tools/perf/run_benchmark -v --browser=release '
459 '--output-format=valueset smoothness.tough_scrolling_cases'),
460 'good_revision': '314014',
461 'bad_revision': '314017',
462 'bug_id': '-1',
463 'gs_bucket': 'chrome-perf',
464 'dummy_builds': 'True',
465 'dummy_tests': 'True',
466 'dummy_job_names': 'True',
467 'bypass_stats_check': 'True',
468 'skip_gclient_ops': 'True',
469 'recipe_tester_name': 'linux_perf_tester'
470 })
471 + api.auto_bisect([
472 {
473 'hash': '0a1b2c3d4f0a1b2c3d4f0a1b2c3d4f0a1b2c3d4f',
474 'commit_pos': '314014',
475 'parsed_values': [19, 20, 23],
476 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
477 },
478 {
479 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
480 'commit_pos': '314015',
481 'parsed_values': [19, 20, 23],
482 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
483 },
484 {
485 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
486 'commit_pos': '314016',
487 'parsed_values': [20, 19, 23],
488 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 1}],
489 },
490 {
491 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
492 'commit_pos': '314017',
493 'parsed_values': [20, 19, 23],
494 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 1}],
495 }]))
496 yield (
497 api.test('basic_bisect_other_direction')
498 + api.properties(
499 mastername='tryserver.chromium.perf',
500 buildername='linux_perf_bisect',
501 slavename='dummyslave',
502 bisect_config={
503 'test_type': 'perf',
504 'command':
505 ('src/tools/perf/run_benchmark -v --browser=release '
506 '--output-format=valueset smoothness.tough_scrolling_cases'),
507 'good_revision': '314015',
508 'bad_revision': '314017',
509 'metric': 'mean_input_event_latency/mean_input_event_latency',
510 'bug_id': '-1',
511 'gs_bucket': 'chrome-perf',
512 'dummy_builds': 'True',
513 'dummy_tests': 'True',
514 'dummy_job_names': 'True',
515 'bypass_stats_check': 'True',
516 'skip_gclient_ops': 'True',
517 'recipe_tester_name': 'linux_perf_tester'
518 })
519 + api.auto_bisect([
520 {
521 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
522 'commit_pos': '314015',
523 'parsed_values': [19, 20, 23],
524 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
525 },
526 {
527 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
528 'commit_pos': '314016',
529 'parsed_values': [19, 20, 23],
530 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
531 },
532 {
533 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
534 'commit_pos': '314017',
535 'parsed_values': [12, 13, 14, 15, 16],
536 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
537 'cl_info': {
538 'author': 'DummyAuthor',
539 'email': 'dummy@nowhere.com',
540 'subject': 'Some random CL',
541 'date': '01/01/2015',
542 'body': ('A long description for a CL.\n'
543 'Containing multiple lines'),
287 }, 544 },
288 'retcodes': [0], 545 }]))
289 }, 546 yield (
290 "DEPS": ("vars={'v8_revision': '001'};" 547 api.test('failed_revision')
291 "deps = {'src/v8': 'v8.git@' + Var('v8_revision')," 548 + api.properties(
292 "'src/third_party/WebKit': 'webkit.git@010'}"), 549 mastername='tryserver.chromium.perf',
293 'git_diff': { 550 buildername='linux_perf_bisect',
294 '002': 'Dummy .diff contents 001 - 002', 551 slavename='dummyslave',
295 '003': 'Dummy .diff contents 001 - 003', 552 bisect_config={
296 }, 553 'test_type': 'perf',
297 }, 554 'command':
298 { 555 ('src/tools/perf/run_benchmark -v --browser=release '
299 'refrange': True, 556 '--output-format=valueset smoothness.tough_scrolling_cases'),
300 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988', 557 'good_revision': '314015',
301 'commit_pos': '314017', 558 'bad_revision': '314017',
302 'test_results': { 559 'metric': 'mean_input_event_latency/mean_input_event_latency',
303 'results': { 560 'bug_id': '-1',
304 'values': [12, 13, 14, 15, 16], 561 'gs_bucket': 'chrome-perf',
305 }, 562 'dummy_builds': 'True',
306 'retcodes': [0], 563 'dummy_tests': 'True',
307 }, 564 'dummy_job_names': 'True',
308 'DEPS_change': 'True', 565 'bypass_stats_check': 'True',
309 "DEPS": ("vars={'v8_revision': '004'};" 566 'skip_gclient_ops': 'True',
310 "deps = {'src/v8': 'v8.git@' + Var('v8_revision')," 567 'recipe_tester_name': 'linux_perf_tester'
311 "'src/third_party/WebKit': 'webkit.git@010'}"), 568 })
312 'DEPS_interval': {'v8': '002 003 004'.split()}, 569 + api.auto_bisect([
313 }, 570 {
314 ] 571 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
315 572 'commit_pos': '314015',
316 573 'parsed_values': [19, 20, 23],
317 def _make_test(api, test_data, test_name, platform='linux', extra_config=None): 574 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
318 basic_test = api.test(test_name) 575 },
319 basic_test += api.properties(mastername='tryserver.chromium.perf', 576 {
320 buildername='linux_perf_bisect', 577 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
321 slavename='dummyslave') 578 'commit_pos': '314016',
322 basic_test += _get_revision_range_step_data(api, test_data) 579 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 1}],
323 for revision_data in test_data: 580 },
324 for step_data in _get_step_data_for_revision(api, revision_data): 581 {
325 basic_test += step_data 582 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111',
326 if 'win_x64' in platform: 583 'commit_pos': '314017',
327 basic_test += api.properties(bisect_config=_get_config({ 584 'parsed_values': [12, 13, 14, 15, 16],
328 'command': ('src/tools/perf/run_benchmark -v --browser=release_x64' 585 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
329 ' smoothness.tough_scrolling_cases'), 586 }]))
330 'recipe_tester_name': 'chromium_rel_win7_x64'})) 587 yield (
331 elif 'win' in platform: 588 api.test('failed_reference_range')
332 basic_test += api.properties(bisect_config=_get_config( 589 + api.properties(
333 {'recipe_tester_name': 'chromium_rel_win7'})) 590 mastername='tryserver.chromium.perf',
334 elif 'mac' in platform: 591 buildername='linux_perf_bisect',
335 basic_test += api.properties(bisect_config=_get_config( 592 slavename='dummyslave',
336 {'recipe_tester_name': 'chromium_rel_mac'})) 593 bisect_config={
337 elif 'android_arm64' in platform: 594 'test_type': 'perf',
338 basic_test += api.properties(bisect_config=_get_config({ 595 'command':
339 'command': ('src/tools/perf/run_benchmark -v --browser=android-chromium' 596 ('src/tools/perf/run_benchmark -v --browser=release '
340 ' smoothness.tough_scrolling_cases'), 597 '--output-format=valueset smoothness.tough_scrolling_cases'),
341 'recipe_tester_name': 'android-nexus9'})) 598 'good_revision': '314015',
342 elif 'android' in platform: 599 'bad_revision': '314016',
343 basic_test += api.properties(bisect_config=_get_config({ 600 'metric': 'mean_input_event_latency/mean_input_event_latency',
344 'command': ('src/tools/perf/run_benchmark -v --browser=android-chromium' 601 'bug_id': '-1',
345 ' smoothness.tough_scrolling_cases'), 602 'gs_bucket': 'chrome-perf',
346 'recipe_tester_name': 'android-nexus7'})) 603 'dummy_builds': 'True',
347 else: 604 'dummy_tests': 'True',
348 basic_test += api.properties(bisect_config=_get_config(extra_config)) 605 'dummy_job_names': 'True',
349 basic_test += api.properties( 606 'bypass_stats_check': 'True',
350 buildbotURL= 'https://build.chromium.org/p/tryserver.chromium.perf') 607 'skip_gclient_ops': 'True',
351 return basic_test 608 'recipe_tester_name': 'linux_perf_tester'
352 609 })
353 610 + api.auto_bisect([
354 def _get_revision_range_step_data(api, range_data): 611 {
355 """Adds canned output for fetch_intervening_revisions.py.""" 612 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
356 min_rev = range_data[0]['hash'] 613 'commit_pos': '314015',
357 max_rev = range_data[-1]['hash'] 614 'parsed_values': [19, 20, 23],
358 output = [[r['hash'], 'ignored'] for r in range_data[1:]] 615 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
359 step_name = ('Expanding revision range.for revisions %s:%s' % 616 },
360 (min_rev, max_rev)) 617 {
361 return api.step_data(step_name, stdout=api.json.output(output)) 618 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
362 619 'commit_pos': '314016',
363 620 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 1}],
364 def _get_config(params=None): 621 },
365 """Returns a sample bisect config dict with some fields overridden.""" 622 ]))
366 example_config = { 623 yield (
367 'test_type': 'perf', 624 api.test('no_repro')
368 'command': ( 625 + api.properties(
369 'src/tools/perf/run_benchmark -v --browser=release smoothness.' 626 mastername='tryserver.chromium.perf',
370 'tough_scrolling_cases'), 627 buildername='linux_perf_bisect',
371 'good_revision': '314015', 628 slavename='dummyslave',
372 'bad_revision': '314017', 629 bisect_config={
373 'metric': 'mean_input_event_latency/mean_input_event_latency', 630 'test_type': 'perf',
374 'repeat_count': '2', 631 'command':
375 'bug_id': '-1', 632 ('src/tools/perf/run_benchmark -v --browser=release '
376 'max_time_minutes': '5', 633 '--output-format=valueset smoothness.tough_scrolling_cases'),
377 'gs_bucket': 'chrome-perf', 634 'good_revision': '314015',
378 'builder_host': 'master4.golo.chromium.org', 635 'bad_revision': '314016',
379 'builder_port': '8341', 636 'metric': 'mean_input_event_latency/mean_input_event_latency',
380 'dummy_builds': 'True', 637 'bug_id': '-1',
381 'dummy_tests': 'True', 638 'gs_bucket': 'chrome-perf',
382 'dummy_job_names': 'True', 639 'dummy_builds': 'True',
383 'bypass_stats_check': 'True', 640 'dummy_tests': 'True',
384 'skip_gclient_ops': 'True', 641 'dummy_job_names': 'True',
385 'recipe_tester_name': 'linux_perf_tester', 642 'bypass_stats_check': 'True',
386 } 643 'skip_gclient_ops': 'True',
387 if params: 644 'recipe_tester_name': 'linux_perf_tester'
388 example_config.update(params) 645 })
389 return example_config 646 + api.auto_bisect([
390 647 {
391 648 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
392 def _get_step_data_for_revision(api, revision_data, include_build_steps=True): 649 'commit_pos': '314015',
393 """Generator that produces step patches for fake results.""" 650 'parsed_values': [19, 20, 23],
394 commit_pos_number = revision_data['commit_pos'] 651 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
395 commit_hash = revision_data['hash'] 652 },
396 test_results = revision_data.get('test_results') 653 {
397 654 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
398 if 'refrange' in revision_data: 655 'commit_pos': '314016',
399 parent_step = 'Resolving reference range.' 656 'parsed_values': [19, 20, 23],
400 commit_pos = 'refs/heads/master@{#%s}' % commit_pos_number 657 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
401 step_name = parent_step + 'crrev get commit hash for ' + commit_pos 658 },
402 yield api.step_data( 659 ]))
403 step_name, 660 yield (
404 stdout=api.json.output({'git_sha': commit_hash})) 661 api.test('failed_build')
405 662 + api.properties(
406 if include_build_steps: 663 mastername='tryserver.chromium.perf',
407 if test_results: 664 buildername='linux_perf_bisect',
408 step_name = ('gsutil Get test results for build %s') % commit_hash 665 slavename='dummyslave',
409 yield api.step_data(step_name, stdout=api.json.output(test_results)) 666 bisect_config={
410 667 'test_type': 'perf',
411 if revision_data.get('DEPS', False): 668 'command':
412 step_name = 'fetch file %s:DEPS' % commit_hash 669 ('src/tools/perf/run_benchmark -v --browser=release '
413 yield api.step_data(step_name, stdout=api.raw_io.output( 670 '--output-format=valueset smoothness.tough_scrolling_cases'),
414 revision_data['DEPS'])) 671 'good_revision': '314015',
415 672 'bad_revision': '314016',
416 if 'git_diff' in revision_data: 673 'metric': 'mean_input_event_latency/mean_input_event_latency',
417 for deps_rev, diff_file in revision_data['git_diff'].iteritems(): 674 'bug_id': '-1',
418 step_name = 'Generating patch for %s:DEPS to %s' 675 'gs_bucket': 'chrome-perf',
419 step_name %= (commit_hash, deps_rev) 676 'dummy_builds': 'True',
420 yield api.step_data(step_name, stdout=api.raw_io.output(diff_file)) 677 'dummy_tests': 'True',
421 678 'dummy_job_names': 'True',
422 if 'DEPS_change' in revision_data: 679 'bypass_stats_check': 'True',
423 step_name = 'Checking DEPS for ' + commit_hash 680 'skip_gclient_ops': 'True',
424 yield api.step_data(step_name, stdout=api.raw_io.output('DEPS')) 681 'recipe_tester_name': 'linux_perf_tester'
425 682 })
426 if 'DEPS_interval' in revision_data: 683 + api.auto_bisect([
427 for depot_name, interval in revision_data['DEPS_interval'].iteritems(): 684 {
428 for item in reversed(interval[:-1]): 685 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222',
429 step_name = 'Hashing modified DEPS file with revision ' + item 686 'commit_pos': '314015',
430 file_hash = 'f412e8458' 687 'parsed_values': [19, 20, 23],
431 yield api.step_data(step_name, stdout=api.raw_io.output(file_hash)) 688 'gsutil_exists': 2 * [False],
432 step_name = 'Expanding revision range for revision %s on depot %s' 689 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
433 step_name %= (interval[-1], depot_name) 690 'build_status': [{'build': {'status': 'SCHEDULED'}},
434 stdout = api.json.output([(r, 0) for r in interval[:-1]]) 691 {'build': {'status': 'COMPLETED',
435 yield api.step_data(step_name, stdout=stdout) 692 'result': 'SUCCESS'}}],
436 693 },
437 if 'cl_info' in revision_data: 694 {
438 step_name = 'Reading culprit cl information.' 695 'hash': 'dcdcdc0ff1122212323134879ddceeb1240b0988',
439 stdout = api.json.output(revision_data['cl_info']) 696 'commit_pos': '314016',
440 yield api.step_data(step_name, stdout=stdout) 697 'gsutil_exists': 10 * [False],
698 'build_status': [{'build': {'status': 'SCHEDULED'}},
699 {'build': {'status': 'COMPLETED',
700 'result': 'FAILED'}}],
701 },
702 ]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698