Commit 86c477ef authored by jeffcarp's avatar jeffcarp Committed by Commit bot

Make run_webkit_tests random order by default for all platforms.

BUG=671805
R=dpranke@chromium.org,qyearsley@chromium.org

Review-Url: https://codereview.chromium.org/2591933002
Cr-Commit-Position: refs/heads/master@{#441424}
parent dbb6723c
......@@ -329,16 +329,13 @@ def parse_args(args):
optparse.make_option(
"--order",
action="store",
# TODO(jeffcarp): platforms are moving to random-order by default independently.
# See _set_up_derived_options below and crbug.com/601332.
default=("default"),
default="random",
help=("Determine the order in which the test cases will be run. "
"'none' == use the order in which the tests were listed "
"either in arguments or test list, "
"'random' == pseudo-random order. Seed can be specified "
"via --seed, otherwise it will default to the current unix timestamp "
"(default on Mac & Linux). "
"'natural' == use the natural order (default on all others).")),
"'random' == pseudo-random order (default). Seed can be specified "
"via --seed, otherwise it will default to the current unix timestamp. "
"'natural' == use the natural order")),
optparse.make_option(
"--profile",
action="store_true",
......@@ -566,16 +563,6 @@ def _set_up_derived_options(port, options, args):
if not options.seed:
options.seed = port.host.time()
# TODO(jeffcarp): This will be removed once all platforms move to random order.
# This must be here and not in parse_args because host is not instantiated yet there.
# See crbug.com/601332.
if options.order == 'default':
port_name = port.host.port_factory.get().port_name
if port_name.startswith(("linux-", "mac-")):
options.order = 'random'
else:
options.order = 'natural'
def _run_tests(port, options, args, printer):
_set_up_derived_options(port, options, args)
manager = Manager(port, options, printer)
......
......@@ -474,7 +474,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
# Test that we wrap around if the number of tests is not evenly divisible by the chunk size
# (here we end up with 3 parts, each with 2 tests, and we only have 4 tests total, so the
# last part repeats the first two tests).
chunk_tests_run = get_tests_run(['--run-part', '3:3'] + tests_to_run)
chunk_tests_run = get_tests_run(['--order', 'natural', '--run-part', '3:3'] + tests_to_run)
self.assertEqual(['passes/error.html', 'passes/image.html'], chunk_tests_run)
def test_run_singly(self):
......@@ -512,7 +512,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_stderr_is_saved(self):
host = MockHost()
self.assertTrue(passing_run(host=host))
self.assertTrue(passing_run(['--order', 'natural'], host=host))
def test_reftest_crash_log_is_saved(self):
host = MockHost()
......@@ -545,12 +545,12 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
host.environ['GTEST_SHARD_INDEX'] = '0'
host.environ['GTEST_TOTAL_SHARDS'] = '1'
shard_0_tests_run = get_tests_run(['--order=natural'] + tests_to_run, host=host)
shard_0_tests_run = get_tests_run(['--order', 'natural'] + tests_to_run, host=host)
self.assertEqual(shard_0_tests_run, ['passes/error.html', 'passes/image.html'])
host.environ['GTEST_SHARD_INDEX'] = '1'
host.environ['GTEST_TOTAL_SHARDS'] = '1'
shard_1_tests_run = get_tests_run(tests_to_run, host=host)
shard_1_tests_run = get_tests_run(['--order', 'natural'] + tests_to_run, host=host)
self.assertEqual(shard_1_tests_run, ['passes/platform_image.html', 'passes/text.html'])
def test_smoke_test(self):
......@@ -677,7 +677,9 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
self.assertEqual(['failures/unexpected/text-image-checksum.html'], tests_run)
# But we'll keep going for expected ones.
tests_run = get_tests_run(['failures/expected/text.html', 'passes/text.html', '--exit-after-n-failures', '1'])
tests_run = get_tests_run(['failures/expected/text.html', 'passes/text.html',
'--exit-after-n-failures', '1',
'--order', 'natural'])
self.assertEqual(['failures/expected/text.html', 'passes/text.html'], tests_run)
def test_exit_after_n_crashes(self):
......@@ -688,11 +690,14 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
# Same with timeouts.
tests_run = get_tests_run(['failures/unexpected/timeout.html', 'passes/text.html',
'--exit-after-n-crashes-or-timeouts', '1'])
'--exit-after-n-crashes-or-timeouts', '1',
'--order', 'natural'])
self.assertEqual(['failures/unexpected/timeout.html'], tests_run)
# But we'll keep going for expected ones.
tests_run = get_tests_run(['failures/expected/crash.html', 'passes/text.html', '--exit-after-n-crashes-or-timeouts', '1'])
tests_run = get_tests_run(['failures/expected/crash.html', 'passes/text.html',
'--exit-after-n-crashes-or-timeouts', '1',
'--order', 'natural'])
self.assertEqual(['failures/expected/crash.html', 'passes/text.html'], tests_run)
def test_results_directory_absolute(self):
......@@ -746,7 +751,8 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
host = MockHost()
filename = '/tmp/foo.txt'
host.filesystem.write_text_file(filename, 'failures')
details, err, _ = logging_run(['--debug-rwt-logging', '--test-list=%s' % filename], tests_included=True, host=host)
details, err, _ = logging_run(['--order', 'natural', '--debug-rwt-logging', '--test-list=%s' % filename],
tests_included=True, host=host)
self.assertEqual(details.exit_code, 0)
self.assertIn('Retrying', err.getvalue())
......@@ -834,7 +840,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
tests_run = get_tests_run(['--order', 'natural', '-i', 'passes/virtual_passes', 'passes'])
self.assertEqual(tests_run, sorted(tests_run))
tests_run = get_tests_run(['http/tests/passes'])
tests_run = get_tests_run(['--order', 'natural', 'http/tests/passes'])
self.assertEqual(tests_run, sorted(tests_run))
def test_virtual(self):
......
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