Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py

Issue 2082653004: blink/run-webkit-tests: Allow seeding the random test run order and write out value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing tests. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
index 7449169ac273b47626ebb3637c3d0e39c177e9a0..b5e6b6b38eb2dda18596d2d18e2128a2ca2bd525 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
@@ -40,6 +40,7 @@ The Manager object has a constructor and one main method called run.
import json
import logging
import random
+import re
import sys
import time
@@ -89,6 +90,7 @@ class Manager(object):
self._wptserve_started = False
self._websockets_server_started = False
+ self._random_seed = None
self._results_directory = self._port.results_directory()
self._finder = LayoutTestFinder(self._port, self._options)
self._runner = LayoutTestRunner(self._options, self._port, self._printer, self._results_directory, self._test_is_slow)
@@ -119,6 +121,16 @@ class Manager(object):
if exit_code:
return test_run_results.RunDetails(exit_code=exit_code)
+ # Write out the random seed and the order we are running the tests in.
+ if not self._options.dry_run:
+ if self._random_seed:
+ self._filesystem.write_text_file(
+ self._filesystem.join(self._results_directory, "random-seed.txt"),
+ "%s\n" % self._random_seed)
+ self._filesystem.write_text_file(
+ self._filesystem.join(self._results_directory, "tests-run-order.txt"),
+ "\n".join(tests_to_run))
Dirk Pranke 2016/06/21 23:47:13 How does this relate to your "write a json file ou
mithro 2016/06/22 08:40:08 Logging the random seed into the json environment
+
# Don't retry failures if an explicit list of tests was passed in.
if self._options.retry_failures is None:
should_retry_failures = len(paths) < len(test_names)
@@ -252,11 +264,23 @@ class Manager(object):
# if used, contains alphabetically consecutive tests.
if self._options.order == 'natural':
tests_to_run.sort(key=self._port.test_key)
- elif self._options.order == 'random':
- random.shuffle(tests_to_run)
- elif self._options.order == 'random-seeded':
+ elif self._options.order.startswith('random'):
+ rnd = random.Random()
qyearsley 2016/06/22 17:30:16 This line could be removed (it appears below).
+
+ groups = re.match('random-seeded(=([0-9]+))?', self._options.order)
qyearsley 2016/06/22 17:30:16 Instead of specifying seeds with an option like `-
Dirk Pranke 2016/06/24 01:53:40 +1 to splitting it into a separate argument.
+ if not groups:
+ seed = int(time.time())
+ elif not groups.group(2):
+ seed = 4 # http://xkcd.com/221/
qyearsley 2016/06/22 17:30:16 It's probably not necessary to necessary to keep t
+ else:
+ seed = int(groups.group(2))
+ _log.info("Test random order seed: %i", seed)
+ self._random_seed = seed
+
+ # Make sure the tests are in sorted before we randomize them.
+ tests_to_run.sort()
rnd = random.Random()
- rnd.seed(4) # http://xkcd.com/221/
+ rnd.seed(seed)
rnd.shuffle(tests_to_run)
tests_to_run, tests_in_other_chunks = self._finder.split_into_chunks(tests_to_run)
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698