OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import json | 6 import json |
7 import os | 7 import os |
8 import re | 8 import re |
9 import sys | 9 import sys |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 from . import ios_flavor | 27 from . import ios_flavor |
28 from . import valgrind_flavor | 28 from . import valgrind_flavor |
29 from . import xsan_flavor | 29 from . import xsan_flavor |
30 | 30 |
31 | 31 |
32 BOTO_CHROMIUM_SKIA_GM = 'chromium-skia-gm.boto' | 32 BOTO_CHROMIUM_SKIA_GM = 'chromium-skia-gm.boto' |
33 | 33 |
34 GS_SUBDIR_TMPL_SK_IMAGE = 'skimage/v%s' | 34 GS_SUBDIR_TMPL_SK_IMAGE = 'skimage/v%s' |
35 GS_SUBDIR_TMPL_SKP = 'playback_%s/skps' | 35 GS_SUBDIR_TMPL_SKP = 'playback_%s/skps' |
36 | 36 |
| 37 MIN_COLORSPACE_SKIMAGE_VERSION = 5 |
| 38 |
37 TEST_EXPECTED_SKP_VERSION = '42' | 39 TEST_EXPECTED_SKP_VERSION = '42' |
38 TEST_EXPECTED_SK_IMAGE_VERSION = '42' | 40 TEST_EXPECTED_SK_IMAGE_VERSION = '42' |
39 | 41 |
40 VERSION_FILE_SK_IMAGE = 'SK_IMAGE_VERSION' | 42 VERSION_FILE_SK_IMAGE = 'SK_IMAGE_VERSION' |
41 VERSION_FILE_SKP = 'SKP_VERSION' | 43 VERSION_FILE_SKP = 'SKP_VERSION' |
42 | 44 |
43 VERSION_NONE = -1 | 45 VERSION_NONE = -1 |
44 | 46 |
45 BUILD_PRODUCTS_ISOLATE_WHITELIST = [ | 47 BUILD_PRODUCTS_ISOLATE_WHITELIST = [ |
46 'dm', | 48 'dm', |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 def check_failure(self): | 273 def check_failure(self): |
272 """Raise an exception if any step failed.""" | 274 """Raise an exception if any step failed.""" |
273 if self.failed: | 275 if self.failed: |
274 raise self.m.step.StepFailure('Failed build steps: %s' % | 276 raise self.m.step.StepFailure('Failed build steps: %s' % |
275 ', '.join([f.name for f in self.failed])) | 277 ', '.join([f.name for f in self.failed])) |
276 | 278 |
277 def _run_once(self, fn, *args, **kwargs): | 279 def _run_once(self, fn, *args, **kwargs): |
278 if not hasattr(self, '_already_ran'): | 280 if not hasattr(self, '_already_ran'): |
279 self._already_ran = {} | 281 self._already_ran = {} |
280 if not fn.__name__ in self._already_ran: | 282 if not fn.__name__ in self._already_ran: |
281 self._already_ran[fn.__name__] = True | 283 self._already_ran[fn.__name__] = fn(*args, **kwargs) |
282 fn(*args, **kwargs) | 284 return self._already_ran[fn.__name__] |
283 | 285 |
284 def update_repo(self, parent_dir, repo): | 286 def update_repo(self, parent_dir, repo): |
285 """Update an existing repo. This is safe to call without gen_steps.""" | 287 """Update an existing repo. This is safe to call without gen_steps.""" |
286 repo_path = parent_dir.join(repo.name) | 288 repo_path = parent_dir.join(repo.name) |
287 if self.m.path.exists(repo_path): | 289 if self.m.path.exists(repo_path): |
288 if self.m.platform.is_win: | 290 if self.m.platform.is_win: |
289 git = 'git.bat' | 291 git = 'git.bat' |
290 else: | 292 else: |
291 git = 'git' | 293 git = 'git' |
292 self.m.step('git remote set-url', | 294 self.m.step('git remote set-url', |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 local_images_dir, | 534 local_images_dir, |
533 test_expected_version=TEST_EXPECTED_SK_IMAGE_VERSION, | 535 test_expected_version=TEST_EXPECTED_SK_IMAGE_VERSION, |
534 test_actual_version=self.m.properties.get( | 536 test_actual_version=self.m.properties.get( |
535 'test_downloaded_sk_image_version', | 537 'test_downloaded_sk_image_version', |
536 TEST_EXPECTED_SK_IMAGE_VERSION), | 538 TEST_EXPECTED_SK_IMAGE_VERSION), |
537 running_in_swarming=running_in_swarming) | 539 running_in_swarming=running_in_swarming) |
538 | 540 |
539 def _download_and_copy_images(self): | 541 def _download_and_copy_images(self): |
540 """Download and copy test images if needed.""" | 542 """Download and copy test images if needed.""" |
541 version = self.download_images(self.tmp_dir, self.images_dir, self.running_i
n_swarming) | 543 version = self.download_images(self.tmp_dir, self.images_dir, self.running_i
n_swarming) |
542 | |
543 """host_version, version_file, gs_path_tmpl, tmp_dir, | |
544 host_path, device_path, test_expected_version, | |
545 test_actual_version, running_in_swarming""" | |
546 | |
547 self.copy_dir( | 544 self.copy_dir( |
548 version, | 545 version, |
549 VERSION_FILE_SK_IMAGE, | 546 VERSION_FILE_SK_IMAGE, |
550 self.tmp_dir, | 547 self.tmp_dir, |
551 self.images_dir, | 548 self.images_dir, |
552 self.device_dirs.images_dir, | 549 self.device_dirs.images_dir, |
553 test_expected_version=TEST_EXPECTED_SK_IMAGE_VERSION, | 550 test_expected_version=TEST_EXPECTED_SK_IMAGE_VERSION, |
554 test_actual_version=self.m.properties.get( | 551 test_actual_version=self.m.properties.get( |
555 'test_downloaded_sk_image_version', | 552 'test_downloaded_sk_image_version', |
556 TEST_EXPECTED_SK_IMAGE_VERSION)) | 553 TEST_EXPECTED_SK_IMAGE_VERSION)) |
| 554 return version |
557 | 555 |
558 def download_skps(self, tmp_dir, local_skp_dir, running_in_swarming): | 556 def download_skps(self, tmp_dir, local_skp_dir, running_in_swarming): |
559 """Download SKPs if needed.""" | 557 """Download SKPs if needed.""" |
560 return self.download_dir( | 558 return self.download_dir( |
561 VERSION_FILE_SKP, | 559 VERSION_FILE_SKP, |
562 GS_SUBDIR_TMPL_SKP, | 560 GS_SUBDIR_TMPL_SKP, |
563 tmp_dir, | 561 tmp_dir, |
564 local_skp_dir, | 562 local_skp_dir, |
565 test_expected_version=TEST_EXPECTED_SKP_VERSION, | 563 test_expected_version=TEST_EXPECTED_SKP_VERSION, |
566 test_actual_version=self.m.properties.get( | 564 test_actual_version=self.m.properties.get( |
567 'test_downloaded_skp_version', TEST_EXPECTED_SKP_VERSION), | 565 'test_downloaded_skp_version', TEST_EXPECTED_SKP_VERSION), |
568 running_in_swarming=running_in_swarming) | 566 running_in_swarming=running_in_swarming) |
569 | 567 |
570 def _download_and_copy_skps(self): | 568 def _download_and_copy_skps(self): |
571 """Download and copy the SKPs if needed.""" | 569 """Download and copy the SKPs if needed.""" |
572 version = self.download_skps(self.tmp_dir, self.local_skp_dir, self.running_
in_swarming) | 570 version = self.download_skps(self.tmp_dir, self.local_skp_dir, self.running_
in_swarming) |
573 self.copy_dir( | 571 self.copy_dir( |
574 version, | 572 version, |
575 VERSION_FILE_SKP, | 573 VERSION_FILE_SKP, |
576 self.tmp_dir, | 574 self.tmp_dir, |
577 self.local_skp_dir, | 575 self.local_skp_dir, |
578 self.device_dirs.skp_dir, | 576 self.device_dirs.skp_dir, |
579 test_expected_version=TEST_EXPECTED_SKP_VERSION, | 577 test_expected_version=TEST_EXPECTED_SKP_VERSION, |
580 test_actual_version=self.m.properties.get( | 578 test_actual_version=self.m.properties.get( |
581 'test_downloaded_skp_version', TEST_EXPECTED_SKP_VERSION)) | 579 'test_downloaded_skp_version', TEST_EXPECTED_SKP_VERSION)) |
| 580 return version |
582 | 581 |
583 def install(self): | 582 def install(self): |
584 """Copy the required executables and files to the device.""" | 583 """Copy the required executables and files to the device.""" |
585 self.device_dirs = self.flavor.get_device_dirs() | 584 self.device_dirs = self.flavor.get_device_dirs() |
586 | 585 |
587 # Run any device-specific installation. | 586 # Run any device-specific installation. |
588 self.flavor.install() | 587 self.flavor.install() |
589 | 588 |
590 # TODO(borenet): Only copy files which have changed. | 589 # TODO(borenet): Only copy files which have changed. |
591 # Resources | 590 # Resources |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 filename, | 625 filename, |
627 args=[self.m.json.output(), builder_name], | 626 args=[self.m.json.output(), builder_name], |
628 step_test_data=lambda: self.m.json.test_api.output(test_data), | 627 step_test_data=lambda: self.m.json.test_api.output(test_data), |
629 cwd=cwd, | 628 cwd=cwd, |
630 infra_step=True).json.output | 629 infra_step=True).json.output |
631 | 630 |
632 def test_steps(self): | 631 def test_steps(self): |
633 """Run the DM test.""" | 632 """Run the DM test.""" |
634 self._run_once(self.install) | 633 self._run_once(self.install) |
635 self._run_once(self._download_and_copy_skps) | 634 self._run_once(self._download_and_copy_skps) |
636 self._run_once(self._download_and_copy_images) | 635 skimage_version = self._run_once(self._download_and_copy_images) |
637 | 636 |
638 use_hash_file = False | 637 use_hash_file = False |
639 if self.upload_dm_results: | 638 if self.upload_dm_results: |
640 # This must run before we write anything into self.device_dirs.dm_dir | 639 # This must run before we write anything into self.device_dirs.dm_dir |
641 # or we may end up deleting our output on machines where they're the same. | 640 # or we may end up deleting our output on machines where they're the same. |
642 self.flavor.create_clean_host_dir(self.dm_dir) | 641 self.flavor.create_clean_host_dir(self.dm_dir) |
643 if str(self.dm_dir) != str(self.device_dirs.dm_dir): | 642 if str(self.dm_dir) != str(self.device_dirs.dm_dir): |
644 self.flavor.create_clean_device_dir(self.device_dirs.dm_dir) | 643 self.flavor.create_clean_device_dir(self.device_dirs.dm_dir) |
645 | 644 |
646 # Obtain the list of already-generated hashes. | 645 # Obtain the list of already-generated hashes. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 'dm', | 715 'dm', |
717 '--undefok', # This helps branches that may not know new flags. | 716 '--undefok', # This helps branches that may not know new flags. |
718 '--resourcePath', self.device_dirs.resource_dir, | 717 '--resourcePath', self.device_dirs.resource_dir, |
719 '--skps', self.device_dirs.skp_dir, | 718 '--skps', self.device_dirs.skp_dir, |
720 '--images', self.flavor.device_path_join( | 719 '--images', self.flavor.device_path_join( |
721 self.device_dirs.images_dir, 'dm'), | 720 self.device_dirs.images_dir, 'dm'), |
722 '--nameByHash', | 721 '--nameByHash', |
723 '--properties' | 722 '--properties' |
724 ] + properties | 723 ] + properties |
725 | 724 |
| 725 if int(skimage_version) >= MIN_COLORSPACE_SKIMAGE_VERSION: |
| 726 args .extend(['--colorImages', |
| 727 self.flavor.device_path_join(self.device_dirs.images_dir, |
| 728 'colorspace')]) |
| 729 |
726 args.append('--key') | 730 args.append('--key') |
727 args.extend(self._KeyParams()) | 731 args.extend(self._KeyParams()) |
728 if use_hash_file: | 732 if use_hash_file: |
729 args.extend(['--uninterestingHashesFile', hashes_file]) | 733 args.extend(['--uninterestingHashesFile', hashes_file]) |
730 if self.upload_dm_results: | 734 if self.upload_dm_results: |
731 args.extend(['--writePath', self.device_dirs.dm_dir]) | 735 args.extend(['--writePath', self.device_dirs.dm_dir]) |
732 | 736 |
733 skip_flag = None | 737 skip_flag = None |
734 if self.builder_cfg.get('cpu_or_gpu') == 'CPU': | 738 if self.builder_cfg.get('cpu_or_gpu') == 'CPU': |
735 skip_flag = '--nogpu' | 739 skip_flag = '--nogpu' |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 # Don't bother to include role, which is always Test. | 899 # Don't bother to include role, which is always Test. |
896 # TryBots are uploaded elsewhere so they can use the same key. | 900 # TryBots are uploaded elsewhere so they can use the same key. |
897 blacklist = ['role', 'is_trybot'] | 901 blacklist = ['role', 'is_trybot'] |
898 | 902 |
899 flat = [] | 903 flat = [] |
900 for k in sorted(self.builder_cfg.keys()): | 904 for k in sorted(self.builder_cfg.keys()): |
901 if k not in blacklist: | 905 if k not in blacklist: |
902 flat.append(k) | 906 flat.append(k) |
903 flat.append(self.builder_cfg[k]) | 907 flat.append(self.builder_cfg[k]) |
904 return flat | 908 return flat |
OLD | NEW |