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

Side by Side Diff: scripts/slave/recipes/bisection/android_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: Addressing all early 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 # Copyright (c) 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 from recipe_engine.types import freeze 5 from recipe_engine.types import freeze
6 6
7 DEPS = [ 7 DEPS = [
8 'auto_bisect', 8 'auto_bisect',
9 'bisect_tester', 9 'bisect_tester',
10 'depot_tools/bot_update', 10 'depot_tools/bot_update',
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 bot_db = api.chromium_tests.create_bot_db_from_master_dict(mastername, 117 bot_db = api.chromium_tests.create_bot_db_from_master_dict(mastername,
118 master_dict) 118 master_dict)
119 119
120 api.auto_bisect.start_try_job(api, update_step=update_step, bot_db=bot_db, 120 api.auto_bisect.start_try_job(api, update_step=update_step, bot_db=bot_db,
121 do_not_nest_wait_for_revision=True) 121 do_not_nest_wait_for_revision=True)
122 122
123 123
124 def GenTests(api): 124 def GenTests(api):
125 config_json_main = { 125 config_json_main = {
126 'command': ('./tools/perf/run_benchmark -v --browser=android-chrome ' 126 'command': ('./tools/perf/run_benchmark -v --browser=android-chrome '
127 'sunspider'), 127 '--output-format=chartjson sunspider'),
128 'max_time_minutes': '25', 128 'max_time_minutes': '25',
129 'client_operation_id': '12345726327327', 129 'client_operation_id': '12345726327327',
130 'repeat_count': '1', 130 'repeat_count': '1',
131 'truncate_percent': '25', 131 'truncate_percent': '25',
132 'target_arch': 'ia32', 132 'target_arch': 'ia32',
133 } 133 }
134 134
135 results_with_patch = """*RESULT dummy: dummy= [5.83,6.013,5.573]ms 135 results_with_patch = """*RESULT dummy: dummy= [5.83,6.013,5.573]ms
136 Avg dummy: 5.907711ms 136 Avg dummy: 5.907711ms
137 Sd dummy: 0.255921ms 137 Sd dummy: 0.255921ms
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 "updated_utc": "Mon Jun 13 19:32:37 2016", 180 "updated_utc": "Mon Jun 13 19:32:37 2016",
181 "url": "http://build.chromium.org/p/tryserver.chromium.perf/builders/linux _perf_bisect/builds/6537", 181 "url": "http://build.chromium.org/p/tryserver.chromium.perf/builders/linux _perf_bisect/builds/6537",
182 "utcnow_utc": "Tue Jun 21 21:33:56 2016" 182 "utcnow_utc": "Tue Jun 21 21:33:56 2016"
183 } 183 }
184 } 184 }
185 185
186 186
187 for _, master_dict in BUILDERS.items(): 187 for _, master_dict in BUILDERS.items():
188 for buildername in master_dict.get('builders', {}): 188 for buildername in master_dict.get('builders', {}):
189 config_json = config_json_main.copy() 189 config_json = config_json_main.copy()
190 yield (api.test('basic_' + buildername) + api.properties.tryserver(
191 path_config='kitchen',
192 mastername='tryserver.chromium.perf',
193 buildername=buildername,
194 patch_storage='rietveld',
195 patchset='20001',
196 issue='12345',
197 is_test=True,
198 rietveld="https://codereview.chromium.org") + api.override_step_data(
199 'git diff to analyze patch',
200 api.raw_io.stream_output('tools/auto_bisect/bisect.cfg')))
201 190
202 yield ( 191 yield (
203 api.test('basic_perf_tryjob_' + buildername) + 192 api.test('basic_perf_tryjob_' + buildername) +
204 api.properties.tryserver( 193 api.properties.tryserver(
205 path_config='kitchen', 194 path_config='kitchen',
206 mastername='tryserver.chromium.perf', 195 mastername='tryserver.chromium.perf',
207 buildername=buildername, 196 buildername=buildername,
208 patch_storage='rietveld', 197 patch_storage='rietveld',
209 patchset='20001', 198 patchset='20001',
210 issue='12345', 199 issue='12345',
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 'git diff to analyze patch', 375 'git diff to analyze patch',
387 api.raw_io.stream_output('tools/perf/benchmarks/sunspider.py')) + 376 api.raw_io.stream_output('tools/perf/benchmarks/sunspider.py')) +
388 api.step_data('buildbucket.put', 377 api.step_data('buildbucket.put',
389 stdout=api.json.output(buildbucket_put_response)) + 378 stdout=api.json.output(buildbucket_put_response)) +
390 api.step_data('buildbucket.get', 379 api.step_data('buildbucket.get',
391 stdout=api.json.output(buildbucket_get_response))) 380 stdout=api.json.output(buildbucket_get_response)))
392 381
393 bisect_config = { 382 bisect_config = {
394 'test_type': 'perf', 383 'test_type': 'perf',
395 'command': './tools/perf/run_benchmark -v ' 384 'command': './tools/perf/run_benchmark -v '
396 '--browser=android-chromium page_cycler.intl_ar_fa_he', 385 '--browser=android-chromium --output-format=valueset '
386 'page_cycler_v2.intl_ar_fa_he',
397 'metric': 'warm_times/page_load_time', 387 'metric': 'warm_times/page_load_time',
398 'repeat_count': '2', 388 'repeat_count': '2',
399 'max_time_minutes': '5', 389 'max_time_minutes': '5',
400 'truncate_percent': '25', 390 'truncate_percent': '25',
401 'bug_id': '425582', 391 'bug_id': '425582',
402 'gs_bucket': 'chrome-perf', 392 'gs_bucket': 'chrome-perf',
403 'builder_host': 'master4.golo.chromium.org', 393 'builder_host': 'master4.golo.chromium.org',
404 'builder_port': '8341' 394 'builder_port': '8341'
405 } 395 }
406 yield (api.test('basic_recipe_' + buildername) + 396 yield (api.test('basic_recipe_' + buildername) +
407 api.properties.tryserver( 397 api.properties.tryserver(
408 path_config='kitchen', 398 path_config='kitchen',
409 mastername='tryserver.chromium.perf', 399 mastername='tryserver.chromium.perf',
410 buildername=buildername) + 400 buildername=buildername) +
411 api.step_data(
412 'saving url to temp file',
413 stdout=api.raw_io.output('/tmp/dummy1')) +
414 api.step_data(
415 'saving json to temp file',
416 stdout=api.raw_io.output('/tmp/dummy2')) +
417 api.properties( 401 api.properties(
418 bisect_config=bisect_config) + api.properties( 402 bisect_config=bisect_config) + api.properties(
419 job_name='f7a7b4135624439cbd27fdd5133d74ec') + 403 job_name='f7a7b4135624439cbd27fdd5133d74ec') +
420 api.bisect_tester(tempfile='/tmp/dummy') + 404 api.bisect_tester(tempfile='/tmp/dummy') +
421 api.properties(parent_got_revision='1111111') + api.properties( 405 api.properties(parent_got_revision='1111111') + api.properties(
422 parent_build_archive_url='gs://test-domain/test-archive.zip')) 406 parent_build_archive_url='gs://test-domain/test-archive.zip'))
423 407
424 local_bisect_config = { 408 local_bisect_config = {
425 'test_type': 'perf', 409 'test_type': 'perf',
426 'command': './tools/perf/run_benchmark -v ' 410 'command': './tools/perf/run_benchmark -v '
427 '--browser=android-chromium page_cycler.intl_ar_fa_he', 411 '--browser=android-chromium --output-format=valueset '
412 'page_cycler_v2.intl_ar_fa_he',
428 'metric': 'warm_times/page_load_time', 413 'metric': 'warm_times/page_load_time',
429 'repeat_count': '2', 414 'repeat_count': '2',
430 'max_time_minutes': '5', 415 'max_time_minutes': '5',
431 'truncate_percent': '25', 416 'truncate_percent': '25',
432 'bug_id': '425582', 417 'bug_id': '425582',
433 'gs_bucket': 'chrome-perf', 418 'gs_bucket': 'chrome-perf',
434 'builder_host': 'master4.golo.chromium.org', 419 'builder_host': 'master4.golo.chromium.org',
435 'builder_port': '8341', 420 'builder_port': '8341',
436 'good_revision': '306475', 421 'good_revision': '306475',
437 'bad_revision': '306476', 422 'bad_revision': '306476',
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 api.properties.tryserver( 548 api.properties.tryserver(
564 mastername='tryserver.chromium.perf', buildername=buildername) + 549 mastername='tryserver.chromium.perf', buildername=buildername) +
565 api.properties( 550 api.properties(
566 path_config='kitchen', 551 path_config='kitchen',
567 bisect_config=local_bisect_config, 552 bisect_config=local_bisect_config,
568 job_name='f7a7b4135624439cbd27fdd5133d74ec', 553 job_name='f7a7b4135624439cbd27fdd5133d74ec',
569 local_test=True, 554 local_test=True,
570 parent_got_revision='1111111', 555 parent_got_revision='1111111',
571 parent_build_archive_url='gs://test-domain/test-archive.zip') + 556 parent_build_archive_url='gs://test-domain/test-archive.zip') +
572 api.bisect_tester(tempfile='/tmp/dummy') + 557 api.bisect_tester(tempfile='/tmp/dummy') +
573 api.step_data(
574 'Gathering reference values.saving json to temp file',
575 stdout=api.raw_io.output('/tmp/dummy3')) +
576 api.step_data(
577 'Gathering reference values.saving json to temp file (2)',
578 stdout=api.raw_io.output('/tmp/dummy4')) +
579 api.override_step_data('device_status', 558 api.override_step_data('device_status',
580 api.json.output(two_devices)) + 559 api.json.output(two_devices)) +
581 api.override_step_data('device_status (2)', 560 api.override_step_data('device_status (2)',
582 api.json.output(two_devices)) + 561 api.json.output(two_devices)) +
583 api.step_data('Resolving reference range.crrev get commit hash for ' +
584 ('refs/heads/master@{#%s}' % local_bisect_config['bad_revision']),
585 stdout=api.json.output(
586 {'git_sha': bad_revision_hash}))+
587 api.step_data('Resolving reference range.crrev get commit hash for ' +
588 ('refs/heads/master@{#%s}' % local_bisect_config[
589 'good_revision']),
590 stdout=api.json.output(
591 {'git_sha': good_revision_hash}))+
592 api.step_data('Expanding revision range.for revisions %s:%s' % (
593 good_revision_hash, bad_revision_hash),
594 stdout=api.json.output([[bad_revision_hash, 'ignored'],
595 [good_revision_hash, 'ignored']])) +
596 api.step_data('Post bisect results', 562 api.step_data('Post bisect results',
597 stdout=api.json.output({'status_code': 200}))) 563 stdout=api.json.output({'status_code': 200})) +
564 api.auto_bisect([
565 {
566 'hash': 'e28dc0d49c331def2a3bbf3ddd0096eb51551155',
567 'commit_pos': '306475',
568 'parsed_values': [12, 13, 14, 15, 16],
569 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
570 },
571 {
572 'hash': 'fc6dfc7ff5b1073408499478969261b826441144',
573 'commit_pos': '306476',
574 'parsed_values': [212, 213, 214, 215, 216],
575 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
576 }]))
598 577
599 # simulate the scenario when the no device is connected. 578 # simulate the scenario when the no device is connected.
600 yield (api.test('local_basic_recipe_no_device') + 579 yield (api.test('local_basic_recipe_no_device') +
601 api.properties.tryserver( 580 api.properties.tryserver(
602 mastername='tryserver.chromium.perf', buildername=buildername) + 581 mastername='tryserver.chromium.perf', buildername=buildername) +
603 api.properties( 582 api.properties(
604 path_config='kitchen', 583 path_config='kitchen',
605 bisect_config=local_bisect_config, 584 bisect_config=local_bisect_config,
606 job_name='f7a7b4135624439cbd27fdd5133d74ec', 585 job_name='f7a7b4135624439cbd27fdd5133d74ec',
607 local_test=True, 586 local_test=True,
608 parent_got_revision='1111111', 587 parent_got_revision='1111111',
609 parent_build_archive_url='gs://test-domain/test-archive.zip') + 588 parent_build_archive_url='gs://test-domain/test-archive.zip') +
610 api.bisect_tester(tempfile='/tmp/dummy') + 589 api.bisect_tester(tempfile='/tmp/dummy') +
611 api.override_step_data('device_status', api.json.output([])) + 590 api.override_step_data('device_status', api.json.output([])) +
612 api.override_step_data('device_status (2)', api.json.output([]))) 591 api.override_step_data('device_status (2)', api.json.output([])) +
592 api.auto_bisect([
593 {
594 'hash': 'e28dc0d49c331def2a3bbf3ddd0096eb51551155',
595 'commit_pos': '306475',
596 },
597 {
598 'hash': 'fc6dfc7ff5b1073408499478969261b826441144',
599 'commit_pos': '306476',
600 }]))
613 601
614 # simulate the scenario when tests fail not because of device 602 # simulate the scenario when tests fail not because of device
615 # disconnection. 603 # disconnection.
616 yield (api.test('local_basic_recipe_failed_device') + 604 yield (api.test('local_basic_recipe_failed_device') +
617 api.properties.tryserver( 605 api.properties.tryserver(
618 mastername='tryserver.chromium.perf', buildername=buildername) + 606 mastername='tryserver.chromium.perf', buildername=buildername) +
619 api.properties( 607 api.properties(
620 path_config='kitchen', 608 path_config='kitchen',
621 bisect_config=local_bisect_config, 609 bisect_config=local_bisect_config,
622 job_name='f7a7b4135624439cbd27fdd5133d74ec', 610 job_name='f7a7b4135624439cbd27fdd5133d74ec',
623 local_test=True, 611 local_test=True,
624 parent_got_revision='1111111', 612 parent_got_revision='1111111',
625 parent_build_archive_url='gs://test-domain/test-archive.zip') + 613 parent_build_archive_url='gs://test-domain/test-archive.zip') +
626 api.bisect_tester(tempfile='/tmp/dummy') + 614 api.bisect_tester(tempfile='/tmp/dummy') +
627 api.step_data(
628 'Gathering reference values.saving json to temp file',
629 stdout=api.raw_io.output('/tmp/dummy3')) +
630 api.step_data(
631 'Gathering reference values.saving json to temp file (2)',
632 stdout=api.raw_io.output('/tmp/dummy4')) +
633 api.override_step_data('device_status', 615 api.override_step_data('device_status',
634 api.json.output(working_device)) + 616 api.json.output(working_device)) +
635 api.override_step_data('device_status (2)', 617 api.override_step_data('device_status (2)',
636 api.json.output(working_device)) + 618 api.json.output(working_device)) +
637 api.step_data('Resolving reference range.crrev get commit hash for ' +
638 ('refs/heads/master@{#%s}' % local_bisect_config['bad_revision']),
639 stdout=api.json.output(
640 {'git_sha': bad_revision_hash}))+
641 api.step_data('Resolving reference range.crrev get commit hash for ' +
642 ('refs/heads/master@{#%s}' % local_bisect_config[
643 'good_revision']),
644 stdout=api.json.output(
645 {'git_sha': good_revision_hash}))+
646 api.step_data('Expanding revision range.for revisions %s:%s' % (
647 good_revision_hash, bad_revision_hash),
648 stdout=api.json.output([[bad_revision_hash, 'ignored'],
649 [good_revision_hash, 'ignored']])) +
650 api.step_data('Debug Info', retcode=1) + 619 api.step_data('Debug Info', retcode=1) +
651 api.step_data('Post bisect results', 620 api.step_data('Post bisect results',
652 stdout=api.json.output({'status_code': 200})) + 621 stdout=api.json.output({'status_code': 200})) +
653 api.override_step_data('device_status (3)', 622 api.override_step_data('device_status (3)',
654 api.json.output(working_device))) 623 api.json.output(working_device)) +
624 api.auto_bisect([
625 {
626 'hash': 'e28dc0d49c331def2a3bbf3ddd0096eb51551155',
627 'commit_pos': '306475',
628 'parsed_values': [12, 13, 14, 15, 16],
629 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
630 },
631 {
632 'hash': 'fc6dfc7ff5b1073408499478969261b826441144',
633 'commit_pos': '306476',
634 'parsed_values': [212, 213, 214, 215, 216],
635 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
636 }]))
655 637
656 # simulate the scenario when tests fail because of device disconnection. 638 # simulate the scenario when tests fail because of device disconnection.
657 yield (api.test('local_basic_recipe_disconnected_device') + 639 yield (api.test('local_basic_recipe_disconnected_device') +
658 api.properties.tryserver( 640 api.properties.tryserver(
659 mastername='tryserver.chromium.perf', buildername=buildername) + 641 mastername='tryserver.chromium.perf', buildername=buildername) +
660 api.properties( 642 api.properties(
661 path_config='kitchen', 643 path_config='kitchen',
644 bisect_config={
645 'test_type': 'perf',
646 'command': './tools/perf/run_benchmark -v '
647 '--browser=android-chromium --output-format=valueset '
648 'page_cycler_v2.intl_ar_fa_he',
649 'metric': 'warm_times/page_load_time',
650 'bug_id': '425582',
651 'gs_bucket': 'chrome-perf',
652 'good_revision': '306474',
653 'bad_revision': '306476',
654 },
655 job_name='f7a7b4135624439cbd27fdd5133d74ec',
656 local_test=True,
657 parent_got_revision='1111111',
658 parent_build_archive_url='gs://test-domain/test-archive.zip') +
659 api.bisect_tester(tempfile='/tmp/dummy') +
660 api.override_step_data('device_status',
661 api.json.output(two_devices)) +
662 api.override_step_data('device_status (2)',
663 api.json.output(two_devices)) +
664 # Simulating disconnect by raising failure and changing the output of
665 # multiple_device_status
666 api.step_data('Debug Info', retcode=1) +
667 api.override_step_data('device_status (3)',
668 api.json.output(working_device)) +
669 api.step_data('Post bisect results',
670 stdout=api.json.output({'status_code': 200})) +
671 api.auto_bisect([
672 {
673 'hash': '0000000000000000000000000000000000000000',
674 'commit_pos': '306474',
675 'parsed_values': [12, 13, 14, 15, 16],
676 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
677 },
678 {
679 'hash': 'e28dc0d49c331def2a3bbf3ddd0096eb51551155',
680 'commit_pos': '306475',
681 'parsed_values': [12, 13, 14, 15, 16],
682 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 1}],
683 },
684 {
685 'hash': 'fc6dfc7ff5b1073408499478969261b826441144',
686 'commit_pos': '306476',
687 'parsed_values': [212, 213, 214, 215, 216],
688 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
689 }]))
690
691 yield (api.test('failure_in_ref_range') +
692 api.properties.tryserver(
693 mastername='tryserver.chromium.perf', buildername=buildername) +
694 api.properties(
695 path_config='kitchen',
662 bisect_config=local_bisect_config, 696 bisect_config=local_bisect_config,
663 job_name='f7a7b4135624439cbd27fdd5133d74ec', 697 job_name='f7a7b4135624439cbd27fdd5133d74ec',
664 local_test=True, 698 local_test=True,
665 parent_got_revision='1111111', 699 parent_got_revision='1111111',
666 parent_build_archive_url='gs://test-domain/test-archive.zip') + 700 parent_build_archive_url='gs://test-domain/test-archive.zip') +
667 api.bisect_tester(tempfile='/tmp/dummy') + 701 api.bisect_tester(tempfile='/tmp/dummy') +
668 api.step_data(
669 'Gathering reference values.saving json to temp file',
670 stdout=api.raw_io.output('/tmp/dummy3')) +
671 api.step_data(
672 'Gathering reference values.saving json to temp file (2)',
673 stdout=api.raw_io.output('/tmp/dummy4')) +
674 api.step_data(
675 'Gathering reference values.saving json to temp file (3)',
676 stdout=api.raw_io.output('/tmp/dummy5')) +
677 api.step_data(
678 'Gathering reference values.saving json to temp file (4)',
679 stdout=api.raw_io.output('/tmp/dummy6')) +
680 api.override_step_data('device_status', 702 api.override_step_data('device_status',
681 api.json.output(two_devices)) + 703 api.json.output(two_devices)) +
682 api.override_step_data('device_status (2)', 704 api.override_step_data('device_status (2)',
683 api.json.output(two_devices)) + 705 api.json.output(two_devices)) +
684 api.step_data('Resolving reference range.crrev get commit hash for ' +
685 ('refs/heads/master@{#%s}' % local_bisect_config['bad_revision']),
686 stdout=api.json.output(
687 {'git_sha': bad_revision_hash}))+
688 api.step_data('Resolving reference range.crrev get commit hash for ' +
689 ('refs/heads/master@{#%s}' % local_bisect_config[
690 'good_revision']),
691 stdout=api.json.output(
692 {'git_sha': good_revision_hash}))+
693 api.step_data('Expanding revision range.for revisions %s:%s' % (
694 good_revision_hash, bad_revision_hash),
695 stdout=api.json.output([[bad_revision_hash, 'ignored'], [
696 good_revision_hash, 'ignored']])) +
697 # Simulating disconnect by raising failure and changing the output of
698 # multiple_device_status
699 api.step_data('Debug Info', retcode=1) +
700 api.override_step_data('device_status (3)',
701 api.json.output(working_device)) +
702 api.step_data('Expanding revision range.for revisions %s:%s (2)' % (
703 good_revision_hash, bad_revision_hash),
704 stdout=api.json.output([[bad_revision_hash, 'ignored'], [
705 good_revision_hash, 'ignored']])) +
706 api.step_data('Post bisect results', 706 api.step_data('Post bisect results',
707 stdout=api.json.output({'status_code': 200}))) 707 stdout=api.json.output({'status_code': 200})) +
708 api.auto_bisect([
709 {
710 'hash': 'e28dc0d49c331def2a3bbf3ddd0096eb51551155',
711 'commit_pos': '306475',
712 'parsed_values': [12, 13, 14, 15, 16],
713 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
714 },
715 {
716 'hash': 'fc6dfc7ff5b1073408499478969261b826441144',
717 'commit_pos': '306476',
718 'parsed_values': [212, 213, 214, 215, 216],
719 'test_results': 5 * [{'stdout': 'benchmark fail', 'retcode': 1}],
720 }]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698