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): ...@@ -329,16 +329,13 @@ def parse_args(args):
optparse.make_option( optparse.make_option(
"--order", "--order",
action="store", action="store",
# TODO(jeffcarp): platforms are moving to random-order by default independently. default="random",
# See _set_up_derived_options below and crbug.com/601332.
default=("default"),
help=("Determine the order in which the test cases will be run. " help=("Determine the order in which the test cases will be run. "
"'none' == use the order in which the tests were listed " "'none' == use the order in which the tests were listed "
"either in arguments or test list, " "either in arguments or test list, "
"'random' == pseudo-random order. Seed can be specified " "'random' == pseudo-random order (default). Seed can be specified "
"via --seed, otherwise it will default to the current unix timestamp " "via --seed, otherwise it will default to the current unix timestamp. "
"(default on Mac & Linux). " "'natural' == use the natural order")),
"'natural' == use the natural order (default on all others).")),
optparse.make_option( optparse.make_option(
"--profile", "--profile",
action="store_true", action="store_true",
...@@ -566,16 +563,6 @@ def _set_up_derived_options(port, options, args): ...@@ -566,16 +563,6 @@ def _set_up_derived_options(port, options, args):
if not options.seed: if not options.seed:
options.seed = port.host.time() 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): def _run_tests(port, options, args, printer):
_set_up_derived_options(port, options, args) _set_up_derived_options(port, options, args)
manager = Manager(port, options, printer) manager = Manager(port, options, printer)
......
...@@ -474,7 +474,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin): ...@@ -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 # 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 # (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). # 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) self.assertEqual(['passes/error.html', 'passes/image.html'], chunk_tests_run)
def test_run_singly(self): def test_run_singly(self):
...@@ -512,7 +512,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin): ...@@ -512,7 +512,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_stderr_is_saved(self): def test_stderr_is_saved(self):
host = MockHost() host = MockHost()
self.assertTrue(passing_run(host=host)) self.assertTrue(passing_run(['--order', 'natural'], host=host))
def test_reftest_crash_log_is_saved(self): def test_reftest_crash_log_is_saved(self):
host = MockHost() host = MockHost()
...@@ -545,12 +545,12 @@ class RunTest(unittest.TestCase, StreamTestingMixin): ...@@ -545,12 +545,12 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
host.environ['GTEST_SHARD_INDEX'] = '0' host.environ['GTEST_SHARD_INDEX'] = '0'
host.environ['GTEST_TOTAL_SHARDS'] = '1' 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']) self.assertEqual(shard_0_tests_run, ['passes/error.html', 'passes/image.html'])
host.environ['GTEST_SHARD_INDEX'] = '1' host.environ['GTEST_SHARD_INDEX'] = '1'
host.environ['GTEST_TOTAL_SHARDS'] = '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']) self.assertEqual(shard_1_tests_run, ['passes/platform_image.html', 'passes/text.html'])
def test_smoke_test(self): def test_smoke_test(self):
...@@ -677,7 +677,9 @@ class RunTest(unittest.TestCase, StreamTestingMixin): ...@@ -677,7 +677,9 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
self.assertEqual(['failures/unexpected/text-image-checksum.html'], tests_run) self.assertEqual(['failures/unexpected/text-image-checksum.html'], tests_run)
# But we'll keep going for expected ones. # 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) self.assertEqual(['failures/expected/text.html', 'passes/text.html'], tests_run)
def test_exit_after_n_crashes(self): def test_exit_after_n_crashes(self):
...@@ -688,11 +690,14 @@ class RunTest(unittest.TestCase, StreamTestingMixin): ...@@ -688,11 +690,14 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
# Same with timeouts. # Same with timeouts.
tests_run = get_tests_run(['failures/unexpected/timeout.html', 'passes/text.html', 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) self.assertEqual(['failures/unexpected/timeout.html'], tests_run)
# But we'll keep going for expected ones. # 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) self.assertEqual(['failures/expected/crash.html', 'passes/text.html'], tests_run)
def test_results_directory_absolute(self): def test_results_directory_absolute(self):
...@@ -746,7 +751,8 @@ class RunTest(unittest.TestCase, StreamTestingMixin): ...@@ -746,7 +751,8 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
host = MockHost() host = MockHost()
filename = '/tmp/foo.txt' filename = '/tmp/foo.txt'
host.filesystem.write_text_file(filename, 'failures') 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.assertEqual(details.exit_code, 0)
self.assertIn('Retrying', err.getvalue()) self.assertIn('Retrying', err.getvalue())
...@@ -834,7 +840,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin): ...@@ -834,7 +840,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
tests_run = get_tests_run(['--order', 'natural', '-i', 'passes/virtual_passes', 'passes']) tests_run = get_tests_run(['--order', 'natural', '-i', 'passes/virtual_passes', 'passes'])
self.assertEqual(tests_run, sorted(tests_run)) 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)) self.assertEqual(tests_run, sorted(tests_run))
def test_virtual(self): 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