OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 | 5 |
6 # Recipe module for Skia Swarming trigger. | 6 # Recipe module for Skia Swarming trigger. |
7 | 7 |
8 | 8 |
9 import json | 9 import json |
10 | 10 |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 api.gsutil.upload( | 554 api.gsutil.upload( |
555 name='upload line-by-line coverage data', | 555 name='upload line-by-line coverage data', |
556 source=dst_lbl_file, | 556 source=dst_lbl_file, |
557 bucket='skia-infra', | 557 bucket='skia-infra', |
558 dest='/'.join(('coverage-json-v1', gs_json_path, | 558 dest='/'.join(('coverage-json-v1', gs_json_path, |
559 dst_lbl_file_basename)), | 559 dst_lbl_file_basename)), |
560 env={'AWS_CREDENTIAL_FILE': None, 'BOTO_CONFIG': None}, | 560 env={'AWS_CREDENTIAL_FILE': None, 'BOTO_CONFIG': None}, |
561 ) | 561 ) |
562 | 562 |
563 | 563 |
| 564 def cipd_pkg(api, infrabots_dir, asset_name): |
| 565 """Find and return the CIPD package info for the given asset.""" |
| 566 version_file = infrabots_dir.join('assets', asset_name, 'VERSION') |
| 567 version = api.skia._readfile(version_file, |
| 568 name='read %s VERSION' % asset_name, |
| 569 test_data='0').rstrip() |
| 570 version = 'version:%s' % version |
| 571 return (asset_name, 'skia/bots/%s' % asset_name, version) |
| 572 |
| 573 |
564 def RunSteps(api): | 574 def RunSteps(api): |
565 got_revision = checkout_steps(api) | 575 got_revision = checkout_steps(api) |
566 api.skia_swarming.setup( | 576 api.skia_swarming.setup( |
567 api.path['checkout'].join('infra', 'bots', 'tools', 'luci-go'), | 577 api.path['checkout'].join('infra', 'bots', 'tools', 'luci-go'), |
568 swarming_rev='') | 578 swarming_rev='') |
569 | 579 |
570 # Run gsutil.py to ensure that it's installed. | 580 # Run gsutil.py to ensure that it's installed. |
571 api.gsutil(['help']) | 581 api.gsutil(['help']) |
572 | 582 |
573 recipes_hash = isolate_recipes(api) | 583 recipes_hash = isolate_recipes(api) |
574 extra_hashes = [recipes_hash] | 584 extra_hashes = [recipes_hash] |
575 | 585 |
576 # Get ready to compile. | 586 # Get ready to compile. |
577 compile_cipd_deps = [] | 587 compile_cipd_deps = [] |
578 extra_compile_hashes = [recipes_hash] | 588 extra_compile_hashes = [recipes_hash] |
579 | 589 |
580 infrabots_dir = api.path['checkout'].join('infra', 'bots') | 590 infrabots_dir = api.path['checkout'].join('infra', 'bots') |
581 if 'Infra' in api.properties['buildername']: | 591 if 'Infra' in api.properties['buildername']: |
582 return infra_swarm(api, got_revision, infrabots_dir, extra_hashes) | 592 return infra_swarm(api, got_revision, infrabots_dir, extra_hashes) |
583 | 593 |
584 builder_spec = api.skia.get_builder_spec(api.path['checkout'], | 594 builder_spec = api.skia.get_builder_spec(api.path['checkout'], |
585 api.properties['buildername']) | 595 api.properties['buildername']) |
586 builder_cfg = builder_spec['builder_cfg'] | 596 builder_cfg = builder_spec['builder_cfg'] |
587 | 597 |
588 # Android bots require an SDK. | 598 # Android bots require an SDK. |
589 if 'Android' in api.properties['buildername']: | 599 if 'Android' in api.properties['buildername']: |
590 android_sdk_version_file = infrabots_dir.join( | 600 android_sdk_version_file = infrabots_dir.join( |
591 'assets', 'android_sdk', 'VERSION') | 601 'assets', 'android_sdk', 'VERSION') |
592 if api.path.exists(android_sdk_version_file): | 602 if api.path.exists(android_sdk_version_file): |
593 android_sdk_version = api.skia._readfile(android_sdk_version_file, | 603 compile_cipd_deps.append(cipd_pkg(api, infrabots_dir, 'android_sdk')) |
594 name='read android_sdk VERSION', | |
595 test_data='0').rstrip() | |
596 android_sdk_version = 'version:%s' % android_sdk_version | |
597 pkg = ('android_sdk', 'skia/bots/android_sdk', android_sdk_version) | |
598 compile_cipd_deps.append(pkg) | |
599 else: | 604 else: |
600 # TODO(borenet): Remove this legacy method after 7/1/2016. | 605 # TODO(borenet): Remove this legacy method after 7/1/2016. |
601 test_data = 'a27a70d73b85191b9e671ff2a44547c3f7cc15ee' | 606 test_data = 'a27a70d73b85191b9e671ff2a44547c3f7cc15ee' |
602 hash_file = infrabots_dir.join('android_sdk_hash') | 607 hash_file = infrabots_dir.join('android_sdk_hash') |
603 # try/except as a temporary measure to prevent breakages for backfills | 608 # try/except as a temporary measure to prevent breakages for backfills |
604 # and branches. | 609 # and branches. |
605 try: | 610 try: |
606 h = api.skia._readfile(hash_file, | 611 h = api.skia._readfile(hash_file, |
607 name='Read android_sdk_hash', | 612 name='Read android_sdk_hash', |
608 test_data=test_data).rstrip() | 613 test_data=test_data).rstrip() |
(...skipping 21 matching lines...) Expand all Loading... |
630 cipd_packages = [] | 635 cipd_packages = [] |
631 | 636 |
632 do_test_steps = builder_spec['do_test_steps'] | 637 do_test_steps = builder_spec['do_test_steps'] |
633 do_perf_steps = builder_spec['do_perf_steps'] | 638 do_perf_steps = builder_spec['do_perf_steps'] |
634 | 639 |
635 if not (do_test_steps or do_perf_steps): | 640 if not (do_test_steps or do_perf_steps): |
636 return | 641 return |
637 | 642 |
638 api.skia.download_skps(api.path['slave_build'].join('tmp'), | 643 api.skia.download_skps(api.path['slave_build'].join('tmp'), |
639 api.path['slave_build'].join('skps')) | 644 api.path['slave_build'].join('skps')) |
640 api.skia.download_images(api.path['slave_build'].join('tmp'), | 645 if api.path.exists(infrabots_dir.join('assets', 'skimage', 'VERSION')): |
641 api.path['slave_build'].join('images')) | 646 cipd_packages.append(cipd_pkg(api, infrabots_dir, 'skimage')) |
| 647 else: |
| 648 # TODO(borenet): Remove this once enough time has passed. |
| 649 api.skia.download_images(api.path['slave_build'].join('tmp'), |
| 650 api.path['slave_build'].join('images')) |
642 | 651 |
643 test_task = None | 652 test_task = None |
644 perf_task = None | 653 perf_task = None |
645 if do_test_steps: | 654 if do_test_steps: |
646 test_task = test_steps_trigger(api, builder_spec, got_revision, | 655 test_task = test_steps_trigger(api, builder_spec, got_revision, |
647 infrabots_dir, extra_hashes, cipd_packages) | 656 infrabots_dir, extra_hashes, cipd_packages) |
648 if do_perf_steps: | 657 if do_perf_steps: |
649 perf_task = perf_steps_trigger(api, builder_spec, got_revision, | 658 perf_task = perf_steps_trigger(api, builder_spec, got_revision, |
650 infrabots_dir, extra_hashes, cipd_packages) | 659 infrabots_dir, extra_hashes, cipd_packages) |
651 is_trybot = builder_cfg['is_trybot'] | 660 is_trybot = builder_cfg['is_trybot'] |
652 if test_task: | 661 if test_task: |
653 test_steps_collect(api, test_task, builder_spec['upload_dm_results'], | 662 test_steps_collect(api, test_task, builder_spec['upload_dm_results'], |
654 got_revision, is_trybot, builder_cfg) | 663 got_revision, is_trybot, builder_cfg) |
655 if perf_task: | 664 if perf_task: |
656 perf_steps_collect(api, perf_task, builder_spec['upload_perf_results'], | 665 perf_steps_collect(api, perf_task, builder_spec['upload_perf_results'], |
657 got_revision, is_trybot) | 666 got_revision, is_trybot) |
658 | 667 |
659 | 668 |
660 def test_for_bot(api, builder, mastername, slavename, testname=None, | 669 def test_for_bot(api, builder, mastername, slavename, testname=None, |
661 legacy_android_sdk=False, legacy_win_toolchain=False): | 670 legacy_android_sdk=False, legacy_win_toolchain=False, |
| 671 legacy_skimage_version=False): |
662 """Generate a test for the given bot.""" | 672 """Generate a test for the given bot.""" |
663 testname = testname or builder | 673 testname = testname or builder |
664 test = ( | 674 test = ( |
665 api.test(testname) + | 675 api.test(testname) + |
666 api.properties(buildername=builder, | 676 api.properties(buildername=builder, |
667 mastername=mastername, | 677 mastername=mastername, |
668 slavename=slavename, | 678 slavename=slavename, |
669 buildnumber=5, | 679 buildnumber=5, |
670 revision='abc123') + | 680 revision='abc123') |
671 api.path.exists( | |
672 api.path['slave_build'].join('skia'), | |
673 api.path['slave_build'].join('tmp', 'uninteresting_hashes.txt') | |
674 ) | |
675 ) | 681 ) |
| 682 paths = [ |
| 683 api.path['slave_build'].join('skia'), |
| 684 api.path['slave_build'].join('tmp', 'uninteresting_hashes.txt'), |
| 685 ] |
676 if 'Trybot' in builder: | 686 if 'Trybot' in builder: |
677 test += api.properties(issue=500, | 687 test += api.properties(issue=500, |
678 patchset=1, | 688 patchset=1, |
679 rietveld='https://codereview.chromium.org') | 689 rietveld='https://codereview.chromium.org') |
680 if 'Android' in builder: | 690 if 'Android' in builder: |
681 if not legacy_android_sdk: | 691 if not legacy_android_sdk: |
682 test += api.path.exists(api.path['slave_build'].join( | 692 paths.append(api.path['slave_build'].join( |
683 'skia', 'infra', 'bots', 'assets', 'android_sdk', 'VERSION')) | 693 'skia', 'infra', 'bots', 'assets', 'android_sdk', 'VERSION')) |
684 if 'Coverage' not in builder and 'Infra' not in builder: | 694 if 'Coverage' not in builder and 'Infra' not in builder: |
685 test += api.step_data( | 695 test += api.step_data( |
686 'upload new .isolated file for compile_skia', | 696 'upload new .isolated file for compile_skia', |
687 stdout=api.raw_io.output('def456 XYZ.isolated')) | 697 stdout=api.raw_io.output('def456 XYZ.isolated')) |
688 if 'Test' in builder: | 698 if 'Test' in builder: |
689 test += api.step_data( | 699 test += api.step_data( |
690 'upload new .isolated file for test_skia', | 700 'upload new .isolated file for test_skia', |
691 stdout=api.raw_io.output('def456 XYZ.isolated')) | 701 stdout=api.raw_io.output('def456 XYZ.isolated')) |
692 if ('Test' in builder and 'Debug' in builder) or 'Perf' in builder or ( | 702 if ('Test' in builder and 'Debug' in builder) or 'Perf' in builder or ( |
693 'Valgrind' in builder and 'Test' in builder): | 703 'Valgrind' in builder and 'Test' in builder): |
694 test += api.step_data( | 704 test += api.step_data( |
695 'upload new .isolated file for perf_skia', | 705 'upload new .isolated file for perf_skia', |
696 stdout=api.raw_io.output('def456 XYZ.isolated')) | 706 stdout=api.raw_io.output('def456 XYZ.isolated')) |
697 if 'Housekeeper' in builder: | 707 if 'Housekeeper' in builder: |
698 test += api.step_data( | 708 test += api.step_data( |
699 'upload new .isolated file for housekeeper_skia', | 709 'upload new .isolated file for housekeeper_skia', |
700 stdout=api.raw_io.output('def456 XYZ.isolated')) | 710 stdout=api.raw_io.output('def456 XYZ.isolated')) |
701 if 'Infra' in builder: | 711 if 'Infra' in builder: |
702 test += api.step_data( | 712 test += api.step_data( |
703 'upload new .isolated file for infra_skia', | 713 'upload new .isolated file for infra_skia', |
704 stdout=api.raw_io.output('def456 XYZ.isolated')) | 714 stdout=api.raw_io.output('def456 XYZ.isolated')) |
705 if 'Win' in builder: | 715 if 'Win' in builder: |
706 if not legacy_win_toolchain: | 716 if not legacy_win_toolchain: |
707 test += api.path.exists(api.path['slave_build'].join( | 717 paths.append(api.path['slave_build'].join( |
708 'skia', 'infra', 'bots', 'assets', 'win_toolchain', 'VERSION')) | 718 'skia', 'infra', 'bots', 'assets', 'win_toolchain', 'VERSION')) |
| 719 if not legacy_skimage_version: |
| 720 paths.append(api.path['slave_build'].join( |
| 721 'skia', 'infra', 'bots', 'assets', 'skimage', 'VERSION')) |
| 722 |
| 723 test += api.path.exists(*paths) |
709 | 724 |
710 return test | 725 return test |
711 | 726 |
712 | 727 |
713 def GenTests(api): | 728 def GenTests(api): |
714 for mastername, slaves in TEST_BUILDERS.iteritems(): | 729 for mastername, slaves in TEST_BUILDERS.iteritems(): |
715 for slavename, builders_by_slave in slaves.iteritems(): | 730 for slavename, builders_by_slave in slaves.iteritems(): |
716 for builder in builders_by_slave: | 731 for builder in builders_by_slave: |
717 yield test_for_bot(api, builder, mastername, slavename) | 732 yield test_for_bot(api, builder, mastername, slavename) |
718 | 733 |
719 builder = 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug' | 734 builder = 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug' |
720 master = 'client.skia' | 735 master = 'client.skia' |
721 slave = 'skiabot-linux-test-000' | 736 slave = 'skiabot-linux-test-000' |
722 test = test_for_bot(api, builder, master, slave, 'No_downloaded_SKP_VERSION') | 737 test = test_for_bot(api, builder, master, slave, 'No_downloaded_SKP_VERSION') |
723 test += api.step_data('Get downloaded SKP_VERSION', retcode=1) | 738 test += api.step_data('Get downloaded SKP_VERSION', retcode=1) |
724 test += api.path.exists( | |
725 api.path['slave_build'].join('skia'), | |
726 api.path['slave_build'].join('tmp', 'uninteresting_hashes.txt') | |
727 ) | |
728 yield test | 739 yield test |
729 | 740 |
730 test = test_for_bot(api, builder, master, slave, | 741 test = test_for_bot(api, builder, master, slave, |
731 'Wrong_downloaded_SKP_VERSION') | 742 'Wrong_downloaded_SKP_VERSION') |
732 test += api.properties(test_downloaded_skp_version='999') | 743 test += api.properties(test_downloaded_skp_version='999') |
733 test += api.path.exists( | |
734 api.path['slave_build'].join('skia'), | |
735 api.path['slave_build'].join('tmp', 'uninteresting_hashes.txt') | |
736 ) | |
737 yield test | 744 yield test |
738 | 745 |
739 builder = 'Build-Ubuntu-GCC-Arm7-Release-Android_Vulkan' | 746 builder = 'Build-Ubuntu-GCC-Arm7-Release-Android_Vulkan' |
740 master = 'client.skia.compile' | 747 master = 'client.skia.compile' |
741 slave = 'skiabot-linux-compile-000' | 748 slave = 'skiabot-linux-compile-000' |
742 test = test_for_bot(api, builder, master, slave, 'legacy_android_sdk', | 749 test = test_for_bot(api, builder, master, slave, 'legacy_android_sdk', |
743 legacy_android_sdk=True) | 750 legacy_android_sdk=True) |
744 test += api.step_data('Read android_sdk_hash', | 751 test += api.step_data('Read android_sdk_hash', |
745 stdout=api.raw_io.output('<android_sdk_hash>')) | 752 stdout=api.raw_io.output('<android_sdk_hash>')) |
746 yield test | 753 yield test |
747 | 754 |
748 test = test_for_bot(api, builder, master, slave, 'Missing_android_sdk_hash', | 755 test = test_for_bot(api, builder, master, slave, 'Missing_android_sdk_hash', |
749 legacy_android_sdk=True) | 756 legacy_android_sdk=True) |
750 test += api.step_data('Read android_sdk_hash', retcode=1) | 757 test += api.step_data('Read android_sdk_hash', retcode=1) |
751 yield test | 758 yield test |
752 | 759 |
753 builder = 'Build-Win-MSVC-x86_64-Release-Vulkan' | 760 builder = 'Build-Win-MSVC-x86_64-Release-Vulkan' |
754 master = 'client.skia.compile' | 761 master = 'client.skia.compile' |
755 test = test_for_bot(api, builder, master, slave, 'legacy_win_toolchain', | 762 test = test_for_bot(api, builder, master, slave, 'legacy_win_toolchain', |
756 legacy_win_toolchain=True) | 763 legacy_win_toolchain=True) |
757 yield test | 764 yield test |
| 765 |
| 766 builder = 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug' |
| 767 master = 'client.skia' |
| 768 test = test_for_bot(api, builder, master, slave, 'legacy_skimage_version', |
| 769 legacy_skimage_version=True) |
| 770 test += api.step_data('Get downloaded SK_IMAGE_VERSION', retcode=1) |
| 771 yield test |
OLD | NEW |