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

Side by Side Diff: build/android/pylib/instrumentation/instrumentation_test_instance.py

Issue 2544533006: [Android] Add '--gtest_also_run_disabled_tests' for instrumentation tests (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | build/android/test_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 435
436 self._timeout_scale = None 436 self._timeout_scale = None
437 self._initializeTestControlAttributes(args) 437 self._initializeTestControlAttributes(args)
438 438
439 self._coverage_directory = None 439 self._coverage_directory = None
440 self._initializeTestCoverageAttributes(args) 440 self._initializeTestCoverageAttributes(args)
441 441
442 self._store_tombstones = False 442 self._store_tombstones = False
443 self._initializeTombstonesAttributes(args) 443 self._initializeTombstonesAttributes(args)
444 444
445 self._run_disabled = False
446
445 def _initializeApkAttributes(self, args, error_func): 447 def _initializeApkAttributes(self, args, error_func):
446 if args.apk_under_test: 448 if args.apk_under_test:
447 apk_under_test_path = args.apk_under_test 449 apk_under_test_path = args.apk_under_test
448 if not args.apk_under_test.endswith('.apk'): 450 if not args.apk_under_test.endswith('.apk'):
449 apk_under_test_path = os.path.join( 451 apk_under_test_path = os.path.join(
450 constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, 452 constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR,
451 '%s.apk' % args.apk_under_test) 453 '%s.apk' % args.apk_under_test)
452 454
453 # TODO(jbudorick): Move the realpath up to the argument parser once 455 # TODO(jbudorick): Move the realpath up to the argument parser once
454 # APK-by-name is no longer supported. 456 # APK-by-name is no longer supported.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 self._runtime_deps_path = args.runtime_deps_path 524 self._runtime_deps_path = args.runtime_deps_path
523 525
524 if not self._runtime_deps_path: 526 if not self._runtime_deps_path:
525 logging.warning('No data dependencies will be pushed.') 527 logging.warning('No data dependencies will be pushed.')
526 528
527 def _initializeTestFilterAttributes(self, args): 529 def _initializeTestFilterAttributes(self, args):
528 if args.test_filter: 530 if args.test_filter:
529 self._test_filter = _CMDLINE_NAME_SEGMENT_RE.sub( 531 self._test_filter = _CMDLINE_NAME_SEGMENT_RE.sub(
530 '', args.test_filter.replace('#', '.')) 532 '', args.test_filter.replace('#', '.'))
531 533
534 self._run_disabled = args.run_disabled
535
532 def annotation_element(a): 536 def annotation_element(a):
533 a = a.split('=', 1) 537 a = a.split('=', 1)
534 return (a[0], a[1] if len(a) == 2 else None) 538 return (a[0], a[1] if len(a) == 2 else None)
535 539
536 if args.annotation_str: 540 if args.annotation_str:
537 self._annotations = [ 541 self._annotations = [
538 annotation_element(a) for a in args.annotation_str.split(',')] 542 annotation_element(a) for a in args.annotation_str.split(',')]
539 elif not self._test_filter: 543 elif not self._test_filter:
540 self._annotations = [ 544 self._annotations = [
541 annotation_element(a) for a in _DEFAULT_ANNOTATIONS] 545 annotation_element(a) for a in _DEFAULT_ANNOTATIONS]
542 else: 546 else:
543 self._annotations = [] 547 self._annotations = []
544 548
545 if args.exclude_annotation_str: 549 if args.exclude_annotation_str:
546 self._excluded_annotations = [ 550 self._excluded_annotations = [
547 annotation_element(a) for a in args.exclude_annotation_str.split(',')] 551 annotation_element(a) for a in args.exclude_annotation_str.split(',')]
548 else: 552 else:
549 self._excluded_annotations = [] 553 self._excluded_annotations = []
550 554
551 requested_annotations = set(a[0] for a in self._annotations) 555 requested_annotations = set(a[0] for a in self._annotations)
552 self._excluded_annotations.extend( 556 if not self._run_disabled:
jbudorick 2016/12/02 02:19:35 Without the property, we should be able to use arg
553 annotation_element(a) for a in _EXCLUDE_UNLESS_REQUESTED_ANNOTATIONS 557 self._excluded_annotations.extend(
554 if a not in requested_annotations) 558 annotation_element(a) for a in _EXCLUDE_UNLESS_REQUESTED_ANNOTATIONS
559 if a not in requested_annotations)
555 560
556 def _initializeFlagAttributes(self, args): 561 def _initializeFlagAttributes(self, args):
557 self._flags = ['--enable-test-intents'] 562 self._flags = ['--enable-test-intents']
558 # TODO(jbudorick): Transition "--device-flags" to "--device-flags-file" 563 # TODO(jbudorick): Transition "--device-flags" to "--device-flags-file"
559 if hasattr(args, 'device_flags') and args.device_flags: 564 if hasattr(args, 'device_flags') and args.device_flags:
560 with open(args.device_flags) as device_flags_file: 565 with open(args.device_flags) as device_flags_file:
561 stripped_lines = (l.strip() for l in device_flags_file) 566 stripped_lines = (l.strip() for l in device_flags_file)
562 self._flags.extend([flag for flag in stripped_lines if flag]) 567 self._flags.extend([flag for flag in stripped_lines if flag])
563 if hasattr(args, 'device_flags_file') and args.device_flags_file: 568 if hasattr(args, 'device_flags_file') and args.device_flags_file:
564 with open(args.device_flags_file) as device_flags_file: 569 with open(args.device_flags_file) as device_flags_file:
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 623
619 @property 624 @property
620 def driver_name(self): 625 def driver_name(self):
621 return self._driver_name 626 return self._driver_name
622 627
623 @property 628 @property
624 def flags(self): 629 def flags(self):
625 return self._flags 630 return self._flags
626 631
627 @property 632 @property
633 def gtest_also_run_disabled_tests(self):
jbudorick 2016/12/02 02:19:35 If this isn't used, don't add it. We can add it wh
shenghuazhang 2016/12/02 02:25:40 Done.
634 return self._run_disabled
635
636 @property
628 def package_info(self): 637 def package_info(self):
629 return self._package_info 638 return self._package_info
630 639
631 @property 640 @property
632 def screenshot_dir(self): 641 def screenshot_dir(self):
633 return self._screenshot_dir 642 return self._screenshot_dir
634 643
635 @property 644 @property
636 def store_tombstones(self): 645 def store_tombstones(self):
637 return self._store_tombstones 646 return self._store_tombstones
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 750
742 @staticmethod 751 @staticmethod
743 def GenerateTestResults( 752 def GenerateTestResults(
744 result_code, result_bundle, statuses, start_ms, duration_ms): 753 result_code, result_bundle, statuses, start_ms, duration_ms):
745 return GenerateTestResults(result_code, result_bundle, statuses, 754 return GenerateTestResults(result_code, result_bundle, statuses,
746 start_ms, duration_ms) 755 start_ms, duration_ms)
747 756
748 #override 757 #override
749 def TearDown(self): 758 def TearDown(self):
750 pass 759 pass
OLDNEW
« no previous file with comments | « no previous file | build/android/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698