Add run_pre_tests flag to android test runner and gtest_test_instance.
Once the flag: --gtest_also_run_pre_tests is passed in, the test runner should be able to parse it. Bug: 1257820 Change-Id: I5d5838f1afba82503f991b0d22a7e8054db17550 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5260197 Reviewed-by: Haiyang Pan <hypan@google.com> Commit-Queue: James Shen <zhiyuans@google.com> Cr-Commit-Position: refs/heads/main@{#1255828}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
ad65afe616
commit
80e18907a2
build/android
@ -398,6 +398,7 @@ class GtestTestInstance(test_instance.TestInstance):
|
||||
self._data_deps = []
|
||||
self._gtest_filters = test_filter.InitializeFiltersFromArgs(args)
|
||||
self._run_disabled = args.run_disabled
|
||||
self._run_pre_tests = args.run_pre_tests
|
||||
|
||||
self._data_deps_delegate = data_deps_delegate
|
||||
self._runtime_deps_path = args.runtime_deps_path
|
||||
@ -431,6 +432,8 @@ class GtestTestInstance(test_instance.TestInstance):
|
||||
self._flags.extend(flag for flag in stripped_lines if flag)
|
||||
if args.run_disabled:
|
||||
self._flags.append('--gtest_also_run_disabled_tests')
|
||||
if args.run_pre_tests:
|
||||
self._flags.append('--gtest_also_run_pre_tests')
|
||||
|
||||
@property
|
||||
def activity(self):
|
||||
@ -614,12 +617,13 @@ class GtestTestInstance(test_instance.TestInstance):
|
||||
disabled_filter_items = []
|
||||
|
||||
if disabled_prefixes is None:
|
||||
# TODO(crbug/1257820): Remove PRE_ once flag is ready.
|
||||
disabled_prefixes = ['FAILS_', 'PRE_']
|
||||
disabled_prefixes = ['FAILS_']
|
||||
if '--run-manual' not in self._flags:
|
||||
disabled_prefixes += ['MANUAL_']
|
||||
if not self._run_disabled:
|
||||
disabled_prefixes += ['DISABLED_', 'FLAKY_']
|
||||
if not self._run_pre_tests:
|
||||
disabled_prefixes += ['PRE_']
|
||||
|
||||
disabled_filter_items += ['%s*' % dp for dp in disabled_prefixes]
|
||||
disabled_filter_items += ['*.%s*' % dp for dp in disabled_prefixes]
|
||||
|
@ -265,6 +265,13 @@ def AddCommonOptions(parser):
|
||||
dest='run_disabled', action='store_true',
|
||||
help='Also run disabled tests if applicable.')
|
||||
|
||||
# This is currently only implemented for gtests tests.
|
||||
parser.add_argument('--gtest_also_run_pre_tests',
|
||||
'--gtest-also-run-pre-tests',
|
||||
dest='run_pre_tests',
|
||||
action='store_true',
|
||||
help='Also run PRE_ tests if applicable.')
|
||||
|
||||
# These are currently only implemented for gtests.
|
||||
parser.add_argument('--isolated-script-test-output',
|
||||
help='If present, store test results on this path.')
|
||||
|
Reference in New Issue
Block a user