test: add --repeat option to tools/test.py
I often want to run a test many times to see if a failure can be recreated and I believe this is a common use case. We even have this job in the CI https://ci.nodejs.org/job/node-stress-single-test/configure but often you want to run it on a specific machine. This patch adds the --repeat option so that you can repeat the selected set of tests a number of times. Given existing options in test.py this will allow you to run one or more tests for the number of repeats specified. For example: tools/test.py -j8 --repeat 1000 parallel/test-process-exec-argv runs the test-process-exec-argv test 1000 times, running 8 copies in parallel tools/test.py --repeat 2 would run the entire test suite twice. PR-URL: https://github.com/nodejs/node/pull/6700 Reviewed-By: Ben Noorhduis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: thefourtheye - Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: joaocgreis - João Reis <reis@janeasystems.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
This commit is contained in:
parent
d13b9d3f7f
commit
ccbb00e2cc
@ -726,8 +726,7 @@ class TestRepository(TestSuite):
|
|||||||
tests = self.GetConfiguration(context).ListTests(current_path, path,
|
tests = self.GetConfiguration(context).ListTests(current_path, path,
|
||||||
arch, mode)
|
arch, mode)
|
||||||
for t in tests: t.variant_flags = v
|
for t in tests: t.variant_flags = v
|
||||||
result += tests
|
result += tests * context.repeat
|
||||||
|
|
||||||
|
|
||||||
def GetTestStatus(self, context, sections, defs):
|
def GetTestStatus(self, context, sections, defs):
|
||||||
self.GetConfiguration(context).GetTestStatus(sections, defs)
|
self.GetConfiguration(context).GetTestStatus(sections, defs)
|
||||||
@ -780,7 +779,8 @@ TIMEOUT_SCALEFACTOR = {
|
|||||||
class Context(object):
|
class Context(object):
|
||||||
|
|
||||||
def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail,
|
def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail,
|
||||||
timeout, processor, suppress_dialogs, store_unexpected_output):
|
timeout, processor, suppress_dialogs,
|
||||||
|
store_unexpected_output, repeat):
|
||||||
self.workspace = workspace
|
self.workspace = workspace
|
||||||
self.buildspace = buildspace
|
self.buildspace = buildspace
|
||||||
self.verbose = verbose
|
self.verbose = verbose
|
||||||
@ -791,6 +791,7 @@ class Context(object):
|
|||||||
self.processor = processor
|
self.processor = processor
|
||||||
self.suppress_dialogs = suppress_dialogs
|
self.suppress_dialogs = suppress_dialogs
|
||||||
self.store_unexpected_output = store_unexpected_output
|
self.store_unexpected_output = store_unexpected_output
|
||||||
|
self.repeat = repeat
|
||||||
|
|
||||||
def GetVm(self, arch, mode):
|
def GetVm(self, arch, mode):
|
||||||
if arch == 'none':
|
if arch == 'none':
|
||||||
@ -1324,6 +1325,9 @@ def BuildOptions():
|
|||||||
default="")
|
default="")
|
||||||
result.add_option('--temp-dir',
|
result.add_option('--temp-dir',
|
||||||
help='Optional path to change directory used for tests', default=False)
|
help='Optional path to change directory used for tests', default=False)
|
||||||
|
result.add_option('--repeat',
|
||||||
|
help='Number of times to repeat given tests',
|
||||||
|
default=1, type="int")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@ -1489,7 +1493,8 @@ def Main():
|
|||||||
options.timeout,
|
options.timeout,
|
||||||
processor,
|
processor,
|
||||||
options.suppress_dialogs,
|
options.suppress_dialogs,
|
||||||
options.store_unexpected_output)
|
options.store_unexpected_output,
|
||||||
|
options.repeat)
|
||||||
# First build the required targets
|
# First build the required targets
|
||||||
if not options.no_build:
|
if not options.no_build:
|
||||||
reqs = [ ]
|
reqs = [ ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user