Reviewers: Jakob,
Message:
PTAL
Description:
[test] Add random seed stress mode to test runner.
BUG=
Please review this at https://codereview.chromium.org/1180473003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+34, -6 lines):
M tools/run-tests.py
M tools/testrunner/local/execution.py
Index: tools/run-tests.py
diff --git a/tools/run-tests.py b/tools/run-tests.py
index
bd8330f5ae0284a903a2731c57d59c6661972810..e64dd6ced35c83a80010ef47bd579d25d0d994de
100755
--- a/tools/run-tests.py
+++ b/tools/run-tests.py
@@ -303,12 +303,22 @@ def BuildOptions():
default="v8tests")
result.add_option("--random-seed", default=0, dest="random_seed",
help="Default seed for initializing random generator")
+ result.add_option("--random-seed-stress-count", default=1, type="int",
+ dest="random_seed_stress_count",
+ help="Number of runs with different random seeds")
result.add_option("--msan",
help="Regard test expectations for MSAN",
default=False, action="store_true")
return result
+def RandomSeed():
+ seed = 0
+ while not seed:
+ seed = random.SystemRandom().randint(-2147483648, 2147483647)
+ return seed
+
+
def ProcessOptions(options):
global VARIANT_FLAGS
global VARIANTS
@@ -373,8 +383,8 @@ def ProcessOptions(options):
if options.j == 0:
options.j = multiprocessing.cpu_count()
- while options.random_seed == 0:
- options.random_seed = random.SystemRandom().randint(-2147483648,
2147483647)
+ if options.random_seed_stress_count <= 1:
+ options.random_seed = RandomSeed()
def excl(*args):
"""Returns true if zero or one of multiple arguments are true."""
@@ -596,9 +606,26 @@ def Execute(arch, mode, args, options, suites,
workspace):
verbose.PrintTestSource(s.tests)
continue
variant_flags = [VARIANT_FLAGS[var] for var in VARIANTS]
- s.tests = [ t.CopyAddingFlags(v)
- for t in s.tests
- for v in s.VariantFlags(t, variant_flags) ]
+ variant_tests = [ t.CopyAddingFlags(v)
+ for t in s.tests
+ for v in s.VariantFlags(t, variant_flags) ]
+
+ if options.random_seed_stress_count > 1:
+ # Duplicate test for random seed stress mode.
+ def iter_seed_flags():
+ for i in range(0, options.random_seed_stress_count):
+ # Use given random seed for all runs or a new random seed if none
+ # is specified.
+ seed = options.random_seed or RandomSeed()
+ yield ["--random-seed=%s" % str(seed)]
+ s.tests = [
+ t.CopyAddingFlags(v)
+ for t in variant_tests
+ for v in iter_seed_flags()
+ ]
+ else:
+ s.tests = variant_tests
+
s.tests = ShardTests(s.tests, options.shard_count, options.shard_run)
num_tests += len(s.tests)
Index: tools/testrunner/local/execution.py
diff --git a/tools/testrunner/local/execution.py
b/tools/testrunner/local/execution.py
index
4abf614219fc02ae634b9e1330a425386905430e..dccd52a359976dfcf0386f50fcdfa385cd320399
100644
--- a/tools/testrunner/local/execution.py
+++ b/tools/testrunner/local/execution.py
@@ -277,10 +277,11 @@ class Runner(object):
d8testflag = ["--test"]
if utils.IsWindows():
shell += ".exe"
+ if self.context.random_seed:
+ d8testflag += ["--random-seed=%s" % self.context.random_seed]
cmd = (self.context.command_prefix +
[os.path.abspath(os.path.join(self.context.shell_dir, shell))] +
d8testflag +
- ["--random-seed=%s" % self.context.random_seed] +
test.suite.GetFlagsForTestCase(test, self.context) +
self.context.extra_flags)
return cmd
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.