OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 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 import collections | 5 import collections |
6 import copy | 6 import copy |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import pickle | 9 import pickle |
10 import re | 10 import re |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 self._test_jar = None | 365 self._test_jar = None |
366 self._test_package = None | 366 self._test_package = None |
367 self._test_runner = None | 367 self._test_runner = None |
368 self._test_support_apk = None | 368 self._test_support_apk = None |
369 self._initializeApkAttributes(args, error_func) | 369 self._initializeApkAttributes(args, error_func) |
370 | 370 |
371 self._data_deps = None | 371 self._data_deps = None |
372 self._isolate_abs_path = None | 372 self._isolate_abs_path = None |
373 self._isolate_delegate = None | 373 self._isolate_delegate = None |
374 self._isolated_abs_path = None | 374 self._isolated_abs_path = None |
375 self._test_data = None | |
376 self._initializeDataDependencyAttributes(args, isolate_delegate) | 375 self._initializeDataDependencyAttributes(args, isolate_delegate) |
377 | 376 |
378 self._annotations = None | 377 self._annotations = None |
379 self._excluded_annotations = None | 378 self._excluded_annotations = None |
380 self._test_filter = None | 379 self._test_filter = None |
381 self._initializeTestFilterAttributes(args) | 380 self._initializeTestFilterAttributes(args) |
382 | 381 |
383 self._flags = None | 382 self._flags = None |
384 self._initializeFlagAttributes(args) | 383 self._initializeFlagAttributes(args) |
385 | 384 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 self._isolate_abs_path = args.isolate_file_path | 463 self._isolate_abs_path = args.isolate_file_path |
465 else: | 464 else: |
466 self._isolate_abs_path = os.path.join( | 465 self._isolate_abs_path = os.path.join( |
467 constants.DIR_SOURCE_ROOT, args.isolate_file_path) | 466 constants.DIR_SOURCE_ROOT, args.isolate_file_path) |
468 self._isolate_delegate = isolate_delegate | 467 self._isolate_delegate = isolate_delegate |
469 self._isolated_abs_path = os.path.join( | 468 self._isolated_abs_path = os.path.join( |
470 constants.GetOutDirectory(), '%s.isolated' % self._test_package) | 469 constants.GetOutDirectory(), '%s.isolated' % self._test_package) |
471 else: | 470 else: |
472 self._isolate_delegate = None | 471 self._isolate_delegate = None |
473 | 472 |
474 # TODO(jbudorick): Deprecate and remove --test-data once data dependencies | 473 if not self._isolate_delegate: |
475 # are fully converted to isolate. | |
476 if args.test_data: | |
477 logging.info('Data dependencies specified via --test-data') | |
478 self._test_data = args.test_data | |
479 else: | |
480 self._test_data = None | |
481 | |
482 if not self._isolate_delegate and not self._test_data: | |
483 logging.warning('No data dependencies will be pushed.') | 474 logging.warning('No data dependencies will be pushed.') |
484 | 475 |
485 def _initializeTestFilterAttributes(self, args): | 476 def _initializeTestFilterAttributes(self, args): |
486 if args.test_filter: | 477 if args.test_filter: |
487 self._test_filter = args.test_filter.replace('#', '.') | 478 self._test_filter = args.test_filter.replace('#', '.') |
488 | 479 |
489 def annotation_element(a): | 480 def annotation_element(a): |
490 a = a.split('=', 1) | 481 a = a.split('=', 1) |
491 return (a[0], a[1] if len(a) == 2 else None) | 482 return (a[0], a[1] if len(a) == 2 else None) |
492 | 483 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 return 'instrumentation' | 612 return 'instrumentation' |
622 | 613 |
623 #override | 614 #override |
624 def SetUp(self): | 615 def SetUp(self): |
625 if self._isolate_delegate: | 616 if self._isolate_delegate: |
626 self._isolate_delegate.Remap( | 617 self._isolate_delegate.Remap( |
627 self._isolate_abs_path, self._isolated_abs_path) | 618 self._isolate_abs_path, self._isolated_abs_path) |
628 self._isolate_delegate.MoveOutputDeps() | 619 self._isolate_delegate.MoveOutputDeps() |
629 self._data_deps.extend([(self._isolate_delegate.isolate_deps_dir, None)]) | 620 self._data_deps.extend([(self._isolate_delegate.isolate_deps_dir, None)]) |
630 | 621 |
631 # TODO(jbudorick): Convert existing tests that depend on the --test-data | |
632 # mechanism to isolate, then remove this. | |
633 if self._test_data: | |
634 for t in self._test_data: | |
635 device_rel_path, host_rel_path = t.split(':') | |
636 host_abs_path = os.path.join(host_paths.DIR_SOURCE_ROOT, host_rel_path) | |
637 self._data_deps.extend( | |
638 [(host_abs_path, | |
639 [None, 'chrome', 'test', 'data', device_rel_path])]) | |
640 | |
641 def GetDataDependencies(self): | 622 def GetDataDependencies(self): |
642 return self._data_deps | 623 return self._data_deps |
643 | 624 |
644 def GetTests(self): | 625 def GetTests(self): |
645 tests = GetAllTests(self.test_jar) | 626 tests = GetAllTests(self.test_jar) |
646 filtered_tests = FilterTests( | 627 filtered_tests = FilterTests( |
647 tests, self._test_filter, self._annotations, self._excluded_annotations) | 628 tests, self._test_filter, self._annotations, self._excluded_annotations) |
648 return self._ParametrizeTestsWithFlags(self._InflateTests(filtered_tests)) | 629 return self._ParametrizeTestsWithFlags(self._InflateTests(filtered_tests)) |
649 | 630 |
650 # pylint: disable=no-self-use | 631 # pylint: disable=no-self-use |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 @staticmethod | 678 @staticmethod |
698 def GenerateTestResults( | 679 def GenerateTestResults( |
699 result_code, result_bundle, statuses, start_ms, duration_ms): | 680 result_code, result_bundle, statuses, start_ms, duration_ms): |
700 return GenerateTestResults(result_code, result_bundle, statuses, | 681 return GenerateTestResults(result_code, result_bundle, statuses, |
701 start_ms, duration_ms) | 682 start_ms, duration_ms) |
702 | 683 |
703 #override | 684 #override |
704 def TearDown(self): | 685 def TearDown(self): |
705 if self._isolate_delegate: | 686 if self._isolate_delegate: |
706 self._isolate_delegate.Clear() | 687 self._isolate_delegate.Clear() |
OLD | NEW |