Commit 5a26bb98 authored by Dirk Pranke's avatar Dirk Pranke Committed by Commit Bot

Revert "Remove obsolete --gtest* flags to run_web_tests."

This reverts commit 6e49ee86.

Reason for revert: Apparently we use --gtest_repeat to retry failures :(. See, e.g., https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8904608481037328864/+/steps/webkit_layout_tests__without_patch_/0/stdout

Original change's description:
> Remove obsolete --gtest* flags to run_web_tests.
> 
> run_web_tests supported the --gtest_repeat,
> --gtest_also_run_disabled_tests, and --gtest_filter flags for
> compatibility with FindIt; however FindIt eventually moved
> to using the --isolated-script-test flags instead, and these
> flags should no longer be used or needed, so this CL removes them.
> 
> This is a prelude to cleaning up and implementing proper support
> for multiple --isolated-script-test-filter args.
> 
> Bug: 893235, 994943
> Change-Id: Id7a8ef5f43855b54eeb76193ceca45310b426890
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1759138
> Reviewed-by: Chan Li <chanli@chromium.org>
> Reviewed-by: Robert Ma <robertma@chromium.org>
> Reviewed-by: Rakib Hasan <rmhasan@google.com>
> Commit-Queue: Dirk Pranke <dpranke@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#688190}

TBR=dpranke@chromium.org,chanli@chromium.org,robertma@chromium.org,rmhasan@google.com

Change-Id: Iefbc7390a69046bd0ab3205f090f003944d9874c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 893235, 994943
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1761638Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688563}
parent 9091ff0f
......@@ -308,6 +308,8 @@ def parse_args(args):
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,
help='Number of times to run the set of tests (e.g. ABCABCABC)'),
......@@ -406,6 +408,8 @@ def parse_args(args):
'"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_const',
const='ignore',
dest='skipped',
......@@ -437,6 +441,13 @@ def parse_args(args):
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',
help='A colon-separated list of tests to run. Wildcards are '
'NOT supported. It is the same as listing the tests as '
'positional arguments.'),
optparse.make_option(
'--time-out-ms',
help='Set the timeout for each test'),
......@@ -578,6 +589,9 @@ def _set_up_derived_options(port, options, args):
if options.isolated_script_test_filter:
args.extend(options.isolated_script_test_filter.split('::'))
if options.gtest_filter:
args.extend(options.gtest_filter.split(':'))
if not options.total_shards and 'GTEST_TOTAL_SHARDS' in port.host.environ:
options.total_shards = int(port.host.environ['GTEST_TOTAL_SHARDS'])
if not options.shard_index and 'GTEST_SHARD_INDEX' in port.host.environ:
......
......@@ -398,6 +398,16 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
tests_run = get_tests_run(['--repeat-each', '2', '--order', 'natural'] + tests_to_run)
self.assertEqual(tests_run, ['passes/image.html', 'passes/image.html', 'passes/text.html', 'passes/text.html'])
def test_gtest_repeat(self):
tests_to_run = ['passes/image.html', 'passes/text.html']
tests_run = get_tests_run(['--gtest_repeat', '2', '--order', 'natural'] + tests_to_run)
self.assertEqual(tests_run, ['passes/image.html', 'passes/text.html', 'passes/image.html', 'passes/text.html'])
def test_gtest_repeat_overrides_iterations(self):
tests_to_run = ['passes/image.html', 'passes/text.html']
tests_run = get_tests_run(['--iterations', '4', '--gtest_repeat', '2', '--order', 'natural'] + tests_to_run)
self.assertEqual(tests_run, ['passes/image.html', 'passes/text.html', 'passes/image.html', 'passes/text.html'])
def test_ignore_flag(self):
# Note that passes/image.html is expected to be run since we specified it directly.
tests_run = get_tests_run(['-i', 'passes', 'passes/image.html'])
......@@ -430,6 +440,12 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
sorted(get_tests_run(['--skipped=ignore', 'passes']))
)
def test_gtest_also_run_disabled_tests(self):
self.assertEqual(
sorted(get_tests_run(['--gtest_also_run_disabled_tests', 'passes'])),
sorted(get_tests_run(['--skipped=ignore', 'passes']))
)
def test_iterations(self):
tests_to_run = ['passes/image.html', 'passes/text.html']
tests_run = get_tests_run(['--iterations', '2', '--order', 'natural'] + tests_to_run)
......@@ -505,6 +521,11 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
)
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)
self.assertEqual(sorted(tests_run), ['passes/error.html', 'passes/image.html', 'passes/text.html'])
def test_sharding_even(self):
# Test that we actually select the right part
tests_to_run = ['passes/error.html', 'passes/image.html', 'passes/platform_image.html', 'passes/text.html']
......
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