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

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: Rebasing, addressing 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 'git diff to analyze patch', 386 'git diff to analyze patch',
387 api.raw_io.stream_output('tools/perf/benchmarks/sunspider.py')) + 387 api.raw_io.stream_output('tools/perf/benchmarks/sunspider.py')) +
388 api.step_data('buildbucket.put', 388 api.step_data('buildbucket.put',
389 stdout=api.json.output(buildbucket_put_response)) + 389 stdout=api.json.output(buildbucket_put_response)) +
390 api.step_data('buildbucket.get', 390 api.step_data('buildbucket.get',
391 stdout=api.json.output(buildbucket_get_response))) 391 stdout=api.json.output(buildbucket_get_response)))
392 392
393 bisect_config = { 393 bisect_config = {
394 'test_type': 'perf', 394 'test_type': 'perf',
395 'command': './tools/perf/run_benchmark -v ' 395 'command': './tools/perf/run_benchmark -v '
396 '--browser=android-chromium page_cycler.intl_ar_fa_he', 396 '--browser=android-chromium --output-format=valueset '
397 'page_cycler.intl_ar_fa_he',
eakuefner 2016/09/09 20:35:42 strictly speaking, this should be page_cycler_v2 -
RobertoCN 2016/09/13 22:11:41 Done.
397 'metric': 'warm_times/page_load_time', 398 'metric': 'warm_times/page_load_time',
398 'repeat_count': '2', 399 'repeat_count': '2',
399 'max_time_minutes': '5', 400 'max_time_minutes': '5',
400 'truncate_percent': '25', 401 'truncate_percent': '25',
401 'bug_id': '425582', 402 'bug_id': '425582',
402 'gs_bucket': 'chrome-perf', 403 'gs_bucket': 'chrome-perf',
403 'builder_host': 'master4.golo.chromium.org', 404 'builder_host': 'master4.golo.chromium.org',
404 'builder_port': '8341' 405 'builder_port': '8341'
405 } 406 }
406 yield (api.test('basic_recipe_' + buildername) + 407 yield (api.test('basic_recipe_' + buildername) +
407 api.properties.tryserver( 408 api.properties.tryserver(
408 path_config='kitchen', 409 path_config='kitchen',
409 mastername='tryserver.chromium.perf', 410 mastername='tryserver.chromium.perf',
410 buildername=buildername) + 411 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( 412 api.properties(
418 bisect_config=bisect_config) + api.properties( 413 bisect_config=bisect_config) + api.properties(
419 job_name='f7a7b4135624439cbd27fdd5133d74ec') + 414 job_name='f7a7b4135624439cbd27fdd5133d74ec') +
420 api.bisect_tester(tempfile='/tmp/dummy') + 415 api.bisect_tester(tempfile='/tmp/dummy') +
421 api.properties(parent_got_revision='1111111') + api.properties( 416 api.properties(parent_got_revision='1111111') + api.properties(
422 parent_build_archive_url='gs://test-domain/test-archive.zip')) 417 parent_build_archive_url='gs://test-domain/test-archive.zip'))
423 418
424 local_bisect_config = { 419 local_bisect_config = {
425 'test_type': 'perf', 420 'test_type': 'perf',
426 'command': './tools/perf/run_benchmark -v ' 421 'command': './tools/perf/run_benchmark -v '
427 '--browser=android-chromium page_cycler.intl_ar_fa_he', 422 '--browser=android-chromium --output-format=valueset '
423 'page_cycler.intl_ar_fa_he',
eakuefner 2016/09/09 20:35:42 and here
RobertoCN 2016/09/13 22:11:41 Done.
428 'metric': 'warm_times/page_load_time', 424 'metric': 'warm_times/page_load_time',
429 'repeat_count': '2', 425 'repeat_count': '2',
430 'max_time_minutes': '5', 426 'max_time_minutes': '5',
431 'truncate_percent': '25', 427 'truncate_percent': '25',
432 'bug_id': '425582', 428 'bug_id': '425582',
433 'gs_bucket': 'chrome-perf', 429 'gs_bucket': 'chrome-perf',
434 'builder_host': 'master4.golo.chromium.org', 430 'builder_host': 'master4.golo.chromium.org',
435 'builder_port': '8341', 431 'builder_port': '8341',
436 'good_revision': '306475', 432 'good_revision': '306475',
437 'bad_revision': '306476', 433 'bad_revision': '306476',
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 api.properties.tryserver( 559 api.properties.tryserver(
564 mastername='tryserver.chromium.perf', buildername=buildername) + 560 mastername='tryserver.chromium.perf', buildername=buildername) +
565 api.properties( 561 api.properties(
566 path_config='kitchen', 562 path_config='kitchen',
567 bisect_config=local_bisect_config, 563 bisect_config=local_bisect_config,
568 job_name='f7a7b4135624439cbd27fdd5133d74ec', 564 job_name='f7a7b4135624439cbd27fdd5133d74ec',
569 local_test=True, 565 local_test=True,
570 parent_got_revision='1111111', 566 parent_got_revision='1111111',
571 parent_build_archive_url='gs://test-domain/test-archive.zip') + 567 parent_build_archive_url='gs://test-domain/test-archive.zip') +
572 api.bisect_tester(tempfile='/tmp/dummy') + 568 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', 569 api.override_step_data('device_status',
580 api.json.output(two_devices)) + 570 api.json.output(two_devices)) +
581 api.override_step_data('device_status (2)', 571 api.override_step_data('device_status (2)',
582 api.json.output(two_devices)) + 572 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', 573 api.step_data('Post bisect results',
597 stdout=api.json.output({'status_code': 200}))) 574 stdout=api.json.output({'status_code': 200})) +
575 api.auto_bisect([
576 {
577 'hash': 'e28dc0d49c331def2a3bbf3ddd0096eb51551155',
578 'commit_pos': '306475',
579 'parsed_values': [12, 13, 14, 15, 16],
580 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
581 },
582 {
583 'hash': 'fc6dfc7ff5b1073408499478969261b826441144',
584 'commit_pos': '306476',
585 'parsed_values': [212, 213, 214, 215, 216],
586 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
587 }]))
598 588
599 # simulate the scenario when the no device is connected. 589 # simulate the scenario when the no device is connected.
600 yield (api.test('local_basic_recipe_no_device') + 590 yield (api.test('local_basic_recipe_no_device') +
601 api.properties.tryserver( 591 api.properties.tryserver(
602 mastername='tryserver.chromium.perf', buildername=buildername) + 592 mastername='tryserver.chromium.perf', buildername=buildername) +
603 api.properties( 593 api.properties(
604 path_config='kitchen', 594 path_config='kitchen',
605 bisect_config=local_bisect_config, 595 bisect_config=local_bisect_config,
606 job_name='f7a7b4135624439cbd27fdd5133d74ec', 596 job_name='f7a7b4135624439cbd27fdd5133d74ec',
607 local_test=True, 597 local_test=True,
608 parent_got_revision='1111111', 598 parent_got_revision='1111111',
609 parent_build_archive_url='gs://test-domain/test-archive.zip') + 599 parent_build_archive_url='gs://test-domain/test-archive.zip') +
610 api.bisect_tester(tempfile='/tmp/dummy') + 600 api.bisect_tester(tempfile='/tmp/dummy') +
611 api.override_step_data('device_status', api.json.output([])) + 601 api.override_step_data('device_status', api.json.output([])) +
612 api.override_step_data('device_status (2)', api.json.output([]))) 602 api.override_step_data('device_status (2)', api.json.output([])) +
603 api.auto_bisect([
604 {
605 'hash': 'e28dc0d49c331def2a3bbf3ddd0096eb51551155',
606 'commit_pos': '306475',
607 },
608 {
609 'hash': 'fc6dfc7ff5b1073408499478969261b826441144',
610 'commit_pos': '306476',
611 }]))
613 612
614 # simulate the scenario when tests fail not because of device 613 # simulate the scenario when tests fail not because of device
615 # disconnection. 614 # disconnection.
616 yield (api.test('local_basic_recipe_failed_device') + 615 yield (api.test('local_basic_recipe_failed_device') +
617 api.properties.tryserver( 616 api.properties.tryserver(
618 mastername='tryserver.chromium.perf', buildername=buildername) + 617 mastername='tryserver.chromium.perf', buildername=buildername) +
619 api.properties( 618 api.properties(
620 path_config='kitchen', 619 path_config='kitchen',
621 bisect_config=local_bisect_config, 620 bisect_config=local_bisect_config,
622 job_name='f7a7b4135624439cbd27fdd5133d74ec', 621 job_name='f7a7b4135624439cbd27fdd5133d74ec',
623 local_test=True, 622 local_test=True,
624 parent_got_revision='1111111', 623 parent_got_revision='1111111',
625 parent_build_archive_url='gs://test-domain/test-archive.zip') + 624 parent_build_archive_url='gs://test-domain/test-archive.zip') +
626 api.bisect_tester(tempfile='/tmp/dummy') + 625 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', 626 api.override_step_data('device_status',
634 api.json.output(working_device)) + 627 api.json.output(working_device)) +
635 api.override_step_data('device_status (2)', 628 api.override_step_data('device_status (2)',
636 api.json.output(working_device)) + 629 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) + 630 api.step_data('Debug Info', retcode=1) +
651 api.step_data('Post bisect results', 631 api.step_data('Post bisect results',
652 stdout=api.json.output({'status_code': 200})) + 632 stdout=api.json.output({'status_code': 200})) +
653 api.override_step_data('device_status (3)', 633 api.override_step_data('device_status (3)',
654 api.json.output(working_device))) 634 api.json.output(working_device)) +
635 api.auto_bisect([
636 {
637 'hash': 'e28dc0d49c331def2a3bbf3ddd0096eb51551155',
638 'commit_pos': '306475',
639 'parsed_values': [12, 13, 14, 15, 16],
640 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
641 },
642 {
643 'hash': 'fc6dfc7ff5b1073408499478969261b826441144',
644 'commit_pos': '306476',
645 'parsed_values': [212, 213, 214, 215, 216],
646 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
647 }]))
655 648
656 # simulate the scenario when tests fail because of device disconnection. 649 # simulate the scenario when tests fail because of device disconnection.
657 yield (api.test('local_basic_recipe_disconnected_device') + 650 yield (api.test('local_basic_recipe_disconnected_device') +
658 api.properties.tryserver( 651 api.properties.tryserver(
659 mastername='tryserver.chromium.perf', buildername=buildername) + 652 mastername='tryserver.chromium.perf', buildername=buildername) +
660 api.properties( 653 api.properties(
661 path_config='kitchen', 654 path_config='kitchen',
655 bisect_config={
656 'test_type': 'perf',
657 'command': './tools/perf/run_benchmark -v '
658 '--browser=android-chromium --output-format=valueset '
659 'page_cycler.intl_ar_fa_he',
eakuefner 2016/09/09 20:35:42 and here
RobertoCN 2016/09/13 22:11:41 Done.
660 'metric': 'warm_times/page_load_time',
661 'bug_id': '425582',
662 'gs_bucket': 'chrome-perf',
663 'good_revision': '306474',
664 'bad_revision': '306476',
665 },
666 job_name='f7a7b4135624439cbd27fdd5133d74ec',
667 local_test=True,
668 parent_got_revision='1111111',
669 parent_build_archive_url='gs://test-domain/test-archive.zip') +
670 api.bisect_tester(tempfile='/tmp/dummy') +
671 api.override_step_data('device_status',
672 api.json.output(two_devices)) +
673 api.override_step_data('device_status (2)',
674 api.json.output(two_devices)) +
675 # Simulating disconnect by raising failure and changing the output of
676 # multiple_device_status
677 api.step_data('Debug Info', retcode=1) +
678 api.override_step_data('device_status (3)',
679 api.json.output(working_device)) +
680 api.step_data('Post bisect results',
681 stdout=api.json.output({'status_code': 200})) +
682 api.auto_bisect([
683 {
684 'hash': '0000000000000000000000000000000000000000',
685 'commit_pos': '306474',
686 'parsed_values': [12, 13, 14, 15, 16],
687 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
688 },
689 {
690 'hash': 'e28dc0d49c331def2a3bbf3ddd0096eb51551155',
691 'commit_pos': '306475',
692 'parsed_values': [12, 13, 14, 15, 16],
693 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 1}],
694 },
695 {
696 'hash': 'fc6dfc7ff5b1073408499478969261b826441144',
697 'commit_pos': '306476',
698 'parsed_values': [212, 213, 214, 215, 216],
699 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
700 }]))
701
702 yield (api.test('failure_in_ref_range') +
703 api.properties.tryserver(
704 mastername='tryserver.chromium.perf', buildername=buildername) +
705 api.properties(
706 path_config='kitchen',
662 bisect_config=local_bisect_config, 707 bisect_config=local_bisect_config,
663 job_name='f7a7b4135624439cbd27fdd5133d74ec', 708 job_name='f7a7b4135624439cbd27fdd5133d74ec',
664 local_test=True, 709 local_test=True,
665 parent_got_revision='1111111', 710 parent_got_revision='1111111',
666 parent_build_archive_url='gs://test-domain/test-archive.zip') + 711 parent_build_archive_url='gs://test-domain/test-archive.zip') +
667 api.bisect_tester(tempfile='/tmp/dummy') + 712 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', 713 api.override_step_data('device_status',
681 api.json.output(two_devices)) + 714 api.json.output(two_devices)) +
682 api.override_step_data('device_status (2)', 715 api.override_step_data('device_status (2)',
683 api.json.output(two_devices)) + 716 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', 717 api.step_data('Post bisect results',
707 stdout=api.json.output({'status_code': 200}))) 718 stdout=api.json.output({'status_code': 200})) +
719 api.auto_bisect([
720 {
721 'hash': 'e28dc0d49c331def2a3bbf3ddd0096eb51551155',
722 'commit_pos': '306475',
723 'parsed_values': [12, 13, 14, 15, 16],
724 'test_results': 5 * [{'stdout': 'benchmark text', 'retcode': 0}],
725 },
726 {
727 'hash': 'fc6dfc7ff5b1073408499478969261b826441144',
728 'commit_pos': '306476',
729 'parsed_values': [212, 213, 214, 215, 216],
730 'test_results': 5 * [{'stdout': 'benchmark fail', 'retcode': 1}],
731 }]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698