Commit 6b57f8cd authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[blinkpy] Add some flag aliases to r-w-t

FindIt is moving away from always using the --gtest* flags to a new set
of unified flags for all isolated script tests. This change adds the new
flags (as aliases to existing flags). The old --gtest* aliases will be
removed when FindIt no longer uses them.

Bug: 893235
Change-Id: I728c1377fb5f43a37b2cea7392c455af7b4a0e73
Reviewed-on: https://chromium-review.googlesource.com/c/1273886Reviewed-by: default avatarQuinten Yearsley <qyearsley@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#598778}
parent 6189334c
......@@ -318,6 +318,8 @@ def parse_args(args):
"'unexpected' == Ignore any tests that had unexpected results on the bot.")),
optparse.make_option(
'--iterations',
'--isolated-script-test-repeat',
# TODO(crbug.com/893235): Remove the gtest alias when FindIt no longer uses it.
'--gtest_repeat',
type='int',
default=1,
......@@ -361,6 +363,7 @@ def parse_args(args):
optparse.make_option(
'--num-retries',
'--test-launcher-retry-limit',
'--isolated-script-test-launcher-retry-limit',
type='int',
default=None,
help=('Number of times to retry failures. Default (when this '
......@@ -401,11 +404,13 @@ def parse_args(args):
'"only" == only run the SKIP tests, '
'"always" == always skip, even if listed on the command line.')),
optparse.make_option(
'--isolated-script-test-also-run-disabled-tests',
# TODO(crbug.com/893235): Remove the gtest alias when FindIt no longer uses it.
'--gtest_also_run_disabled_tests',
action='store_true',
default=False, # Consistent with the default value of --skipped
help=('Equivalent to --skipped=ignore. This option overrides '
'--skipped if both are given.')),
action='store_const',
const='ignore',
dest='skipped',
help=('Equivalent to --skipped=ignore.')),
optparse.make_option(
'--skip-failing-tests',
action='store_true',
......@@ -428,6 +433,12 @@ def parse_args(args):
action='append',
metavar='FILE',
help='read list of tests to run from file'),
optparse.make_option(
'--isolated-script-test-filter',
type='string',
help='A list of tests to run separated by TWO colons, e.g. fast::css/test.html, '
'same as listing them as positional arguments'),
# TODO(crbug.com/893235): Remove gtest_filter when FindIt no longer uses it.
optparse.make_option(
'--gtest_filter',
type='string',
......@@ -553,11 +564,12 @@ def _set_up_derived_options(port, options, args):
if not options.skipped:
options.skipped = 'always'
if options.gtest_also_run_disabled_tests:
options.skipped = 'ignore'
elif not options.skipped:
if not options.skipped:
options.skipped = 'default'
if options.isolated_script_test_filter:
args.extend(options.isolated_script_test_filter.split('::'))
if options.gtest_filter:
args.extend(options.gtest_filter.split(':'))
......
......@@ -443,15 +443,15 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
# Now check that we don't run anything.
self.assertEqual(get_tests_run(['--skipped=always', 'passes/skipped/skip.html']), [])
def test_gtest_also_run_disabled_tests(self):
def test_isolated_script_test_also_run_disabled_tests(self):
self.assertEqual(
sorted(get_tests_run(['--gtest_also_run_disabled_tests', 'passes'])),
sorted(get_tests_run(['--isolated-script-test-also-run-disabled-tests', 'passes'])),
sorted(get_tests_run(['--skipped=ignore', 'passes']))
)
def test_gtest_also_run_disabled_tests_overrides_skipped(self):
def test_gtest_also_run_disabled_tests(self):
self.assertEqual(
sorted(get_tests_run(['--gtest_also_run_disabled_tests', '--skipped=always', 'passes'])),
sorted(get_tests_run(['--gtest_also_run_disabled_tests', 'passes'])),
sorted(get_tests_run(['--skipped=ignore', 'passes']))
)
......@@ -522,6 +522,14 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
tests_run = get_tests_run(['--test-list=%s' % filename], host=host)
self.assertEqual(['passes/text.html'], tests_run)
def test_isolated_script_test_filter(self):
host = MockHost()
tests_run = get_tests_run(
['--isolated-script-test-filter=passes/text.html::passes/image.html', 'passes/error.html'],
host=host
)
self.assertEqual(sorted(tests_run), ['passes/error.html', 'passes/image.html', 'passes/text.html'])
def test_gtest_filter(self):
host = MockHost()
tests_run = get_tests_run(['--gtest_filter=passes/text.html:passes/image.html', 'passes/error.html'], host=host)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment