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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 api.gsutil.upload( | 507 api.gsutil.upload( |
508 name='upload line-by-line coverage data', | 508 name='upload line-by-line coverage data', |
509 source=dst_lbl_file, | 509 source=dst_lbl_file, |
510 bucket='skia-infra', | 510 bucket='skia-infra', |
511 dest='/'.join(('coverage-json-v1', gs_json_path, | 511 dest='/'.join(('coverage-json-v1', gs_json_path, |
512 dst_lbl_file_basename)), | 512 dst_lbl_file_basename)), |
513 env={'AWS_CREDENTIAL_FILE': None, 'BOTO_CONFIG': None}, | 513 env={'AWS_CREDENTIAL_FILE': None, 'BOTO_CONFIG': None}, |
514 ) | 514 ) |
515 | 515 |
516 | 516 |
517 def download_asset(api, infrabots_dir, recipes_hash, asset): | |
518 """Trigger a swarming task to download and isolate the given asset.""" | |
519 return api.skia_swarming.isolate_and_trigger_task( | |
520 infrabots_dir.join('download_asset.isolate'), | |
521 api.path['slave_build'], | |
522 'download_%s' % asset, | |
523 {'ASSET': asset, 'GSUTIL': '../../depot_tools/gsutil.py'}, | |
rmistry
2016/06/15 13:51:31
Instead of hardcoding gsutil.py would api.path['de
borenet
2016/06/15 19:53:23
No, the path module will resolve to an absolute pa
rmistry
2016/06/15 20:11:00
That would translate to /b/depot_tools ?
borenet
2016/06/15 20:25:09
Yeah, I think so. Because the Swarming task runs
| |
524 {'pool': 'Skia', 'os': 'Ubuntu'}, | |
525 extra_isolate_hashes=[recipes_hash], | |
526 idempotent=True, | |
527 isolate_blacklist=['.git', 'out', '*.pyc'], | |
528 store_output=False, | |
529 ) | |
530 | |
531 | |
532 def collect_hashes(api, tasks): | |
533 """Collect the isolated hash for each swarming task.""" | |
534 return [ | |
535 api.skia_swarming.collect_swarming_task_isolate_hash(t) for t in tasks] | |
536 | |
537 | |
517 def RunSteps(api): | 538 def RunSteps(api): |
518 got_revision = checkout_steps(api) | 539 got_revision = checkout_steps(api) |
519 builder_spec = api.skia.get_builder_spec(api.path['checkout'], | 540 builder_spec = api.skia.get_builder_spec(api.path['checkout'], |
520 api.properties['buildername']) | 541 api.properties['buildername']) |
521 builder_cfg = builder_spec['builder_cfg'] | 542 builder_cfg = builder_spec['builder_cfg'] |
522 infrabots_dir = api.path['checkout'].join('infra', 'bots') | 543 infrabots_dir = api.path['checkout'].join('infra', 'bots') |
523 | 544 |
524 api.skia_swarming.setup( | 545 api.skia_swarming.setup( |
525 api.path['checkout'].join('infra', 'bots', 'tools', 'luci-go'), | 546 api.path['checkout'].join('infra', 'bots', 'tools', 'luci-go'), |
526 swarming_rev='') | 547 swarming_rev='') |
527 | 548 |
528 # Run gsutil.py to ensure that it's installed. | 549 # Run gsutil.py to ensure that it's installed. |
529 api.gsutil(['help']) | 550 api.gsutil(['help']) |
530 | 551 |
531 recipes_hash = isolate_recipes(api) | 552 recipes_hash = isolate_recipes(api) |
532 extra_hashes = [recipes_hash] | 553 extra_hashes = [recipes_hash] |
533 | 554 |
555 # Get ready to compile. | |
556 compile_deps = [] | |
557 extra_compile_hashes = [recipes_hash] | |
558 | |
534 # Android bots require an SDK. | 559 # Android bots require an SDK. |
535 if 'Android' in api.properties['buildername']: | 560 if 'Android' in api.properties['buildername']: |
536 test_data = 'a27a70d73b85191b9e671ff2a44547c3f7cc15ee' | 561 if api.path.exists(infrabots_dir.join('assets', 'android_sdk')): |
537 hash_file = infrabots_dir.join('android_sdk_hash') | 562 compile_deps.append(download_asset( |
538 # try/except as a temporary measure to prevent breakages for backfills | 563 api, infrabots_dir, recipes_hash, 'android_sdk')) |
539 # and branches. | 564 else: |
540 try: | 565 # TODO(borenet): Remove this legacy method after 7/1/2016. |
541 h = api.skia._readfile(hash_file, | 566 test_data = 'a27a70d73b85191b9e671ff2a44547c3f7cc15ee' |
542 name='Read android_sdk_hash', | 567 hash_file = infrabots_dir.join('android_sdk_hash') |
543 test_data=test_data).rstrip() | 568 # try/except as a temporary measure to prevent breakages for backfills |
544 except api.step.StepFailure: | 569 # and branches. |
545 # Just fall back on the original hash. | 570 try: |
546 h = 'a27a70d73b85191b9e671ff2a44547c3f7cc15ee' | 571 h = api.skia._readfile(hash_file, |
547 extra_hashes.append(h) | 572 name='Read android_sdk_hash', |
573 test_data=test_data).rstrip() | |
574 except api.step.StepFailure: | |
575 # Just fall back on the original hash. | |
576 h = 'a27a70d73b85191b9e671ff2a44547c3f7cc15ee' | |
577 extra_hashes.append(h) | |
578 extra_compile_hashes.append(h) | |
548 | 579 |
580 extra_compile_hashes.extend(collect_hashes(api, compile_deps)) | |
581 | |
582 # Compile. | |
549 do_compile_steps = builder_spec.get('do_compile_steps', True) | 583 do_compile_steps = builder_spec.get('do_compile_steps', True) |
550 compile_hash = None | |
551 if do_compile_steps: | 584 if do_compile_steps: |
552 compile_hash = compile_steps_swarm(api, builder_spec, got_revision, | 585 extra_hashes.append(compile_steps_swarm( |
553 infrabots_dir, extra_hashes) | 586 api, builder_spec, got_revision, infrabots_dir, extra_compile_hashes)) |
554 | 587 |
555 if builder_cfg['role'] == 'Housekeeper': | 588 if builder_cfg['role'] == 'Housekeeper': |
556 housekeeper_swarm(api, builder_spec, got_revision, infrabots_dir, | 589 housekeeper_swarm(api, builder_spec, got_revision, infrabots_dir, |
557 extra_hashes) | 590 extra_hashes) |
558 return | 591 return |
559 | 592 |
593 # Get ready to test/perf. | |
560 do_test_steps = builder_spec['do_test_steps'] | 594 do_test_steps = builder_spec['do_test_steps'] |
561 do_perf_steps = builder_spec['do_perf_steps'] | 595 do_perf_steps = builder_spec['do_perf_steps'] |
562 | 596 |
563 if not (do_test_steps or do_perf_steps): | 597 if not (do_test_steps or do_perf_steps): |
564 return | 598 return |
565 | 599 |
566 if compile_hash: | |
567 extra_hashes.append(compile_hash) | |
568 | |
569 api.skia.download_skps(api.path['slave_build'].join('tmp'), | 600 api.skia.download_skps(api.path['slave_build'].join('tmp'), |
570 api.path['slave_build'].join('skps'), | 601 api.path['slave_build'].join('skps'), |
571 False) | 602 False) |
572 api.skia.download_images(api.path['slave_build'].join('tmp'), | 603 api.skia.download_images(api.path['slave_build'].join('tmp'), |
573 api.path['slave_build'].join('images'), | 604 api.path['slave_build'].join('images'), |
574 False) | 605 False) |
575 | 606 |
576 test_task = None | 607 test_task = None |
577 perf_task = None | 608 perf_task = None |
578 if do_test_steps: | 609 if do_test_steps: |
579 test_task = test_steps_trigger(api, builder_spec, got_revision, | 610 test_task = test_steps_trigger(api, builder_spec, got_revision, |
580 infrabots_dir, extra_hashes) | 611 infrabots_dir, extra_hashes) |
581 if do_perf_steps: | 612 if do_perf_steps: |
582 perf_task = perf_steps_trigger(api, builder_spec, got_revision, | 613 perf_task = perf_steps_trigger(api, builder_spec, got_revision, |
583 infrabots_dir, extra_hashes) | 614 infrabots_dir, extra_hashes) |
584 is_trybot = builder_cfg['is_trybot'] | 615 is_trybot = builder_cfg['is_trybot'] |
585 if test_task: | 616 if test_task: |
586 test_steps_collect(api, test_task, builder_spec['upload_dm_results'], | 617 test_steps_collect(api, test_task, builder_spec['upload_dm_results'], |
587 got_revision, is_trybot, builder_cfg) | 618 got_revision, is_trybot, builder_cfg) |
588 if perf_task: | 619 if perf_task: |
589 perf_steps_collect(api, perf_task, builder_spec['upload_perf_results'], | 620 perf_steps_collect(api, perf_task, builder_spec['upload_perf_results'], |
590 got_revision, is_trybot) | 621 got_revision, is_trybot) |
591 | 622 |
592 | 623 |
593 def test_for_bot(api, builder, mastername, slavename, testname=None): | 624 def test_for_bot(api, builder, mastername, slavename, testname=None, |
625 legacy_android_sdk=False): | |
594 """Generate a test for the given bot.""" | 626 """Generate a test for the given bot.""" |
595 testname = testname or builder | 627 testname = testname or builder |
596 test = ( | 628 test = ( |
597 api.test(testname) + | 629 api.test(testname) + |
598 api.properties(buildername=builder, | 630 api.properties(buildername=builder, |
599 mastername=mastername, | 631 mastername=mastername, |
600 slavename=slavename, | 632 slavename=slavename, |
601 buildnumber=5, | 633 buildnumber=5, |
602 revision='abc123') + | 634 revision='abc123') + |
603 api.path.exists( | 635 api.path.exists( |
604 api.path['slave_build'].join('skia'), | 636 api.path['slave_build'].join('skia'), |
605 api.path['slave_build'].join('tmp', 'uninteresting_hashes.txt') | 637 api.path['slave_build'].join('tmp', 'uninteresting_hashes.txt') |
606 ) | 638 ) |
607 ) | 639 ) |
608 if 'Trybot' in builder: | 640 if 'Trybot' in builder: |
609 test += api.properties(issue=500, | 641 test += api.properties(issue=500, |
610 patchset=1, | 642 patchset=1, |
611 rietveld='https://codereview.chromium.org') | 643 rietveld='https://codereview.chromium.org') |
644 if 'Android' in builder: | |
645 if not legacy_android_sdk: | |
646 test += api.path.exists(api.path['slave_build'].join( | |
647 'skia', 'infra', 'bots', 'assets', 'android_sdk')) | |
648 test += api.step_data( | |
649 'upload new .isolated file for download_android_sdk', | |
650 stdout=api.raw_io.output('def456 XYZ.isolated')) | |
612 if 'Coverage' not in builder: | 651 if 'Coverage' not in builder: |
613 test += api.step_data( | 652 test += api.step_data( |
614 'upload new .isolated file for compile_skia', | 653 'upload new .isolated file for compile_skia', |
615 stdout=api.raw_io.output('def456 XYZ.isolated')) | 654 stdout=api.raw_io.output('def456 XYZ.isolated')) |
616 if 'Test' in builder: | 655 if 'Test' in builder: |
617 test += api.step_data( | 656 test += api.step_data( |
618 'upload new .isolated file for test_skia', | 657 'upload new .isolated file for test_skia', |
619 stdout=api.raw_io.output('def456 XYZ.isolated')) | 658 stdout=api.raw_io.output('def456 XYZ.isolated')) |
620 if ('Test' in builder and 'Debug' in builder) or 'Perf' in builder or ( | 659 if ('Test' in builder and 'Debug' in builder) or 'Perf' in builder or ( |
621 'Valgrind' in builder and 'Test' in builder): | 660 'Valgrind' in builder and 'Test' in builder): |
(...skipping 30 matching lines...) Expand all Loading... | |
652 test += api.properties(test_downloaded_skp_version='999') | 691 test += api.properties(test_downloaded_skp_version='999') |
653 test += api.path.exists( | 692 test += api.path.exists( |
654 api.path['slave_build'].join('skia'), | 693 api.path['slave_build'].join('skia'), |
655 api.path['slave_build'].join('tmp', 'uninteresting_hashes.txt') | 694 api.path['slave_build'].join('tmp', 'uninteresting_hashes.txt') |
656 ) | 695 ) |
657 yield test | 696 yield test |
658 | 697 |
659 builder = 'Build-Ubuntu-GCC-Arm7-Release-Android_Vulkan' | 698 builder = 'Build-Ubuntu-GCC-Arm7-Release-Android_Vulkan' |
660 master = 'client.skia.compile' | 699 master = 'client.skia.compile' |
661 slave = 'skiabot-linux-compile-000' | 700 slave = 'skiabot-linux-compile-000' |
662 test = test_for_bot(api, builder, master, slave, 'Missing_android_sdk_hash') | 701 test = test_for_bot(api, builder, master, slave, 'legacy_android_sdk', |
702 legacy_android_sdk=True) | |
703 test += api.step_data('Read android_sdk_hash', | |
704 stdout=api.raw_io.output('<android_sdk_hash>')) | |
705 yield test | |
706 | |
707 test = test_for_bot(api, builder, master, slave, 'Missing_android_sdk_hash', | |
708 legacy_android_sdk=True) | |
663 test += api.step_data('Read android_sdk_hash', retcode=1) | 709 test += api.step_data('Read android_sdk_hash', retcode=1) |
664 yield test | 710 yield test |
OLD | NEW |