The Wayback Machine - https://web.archive.org/web/20250407173320/https://github.com/nodejs/node/commit/50ae37e350
Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Commit 50ae37e

Browse filesBrowse files
mhdawsonMylesBorins
authored andcommitted
test: add --repeat option to tools/test.py
Manual backport from master to 4.x stream, original commit message follows. 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: #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>
1 parent f556b43 commit 50ae37e
Copy full SHA for 50ae37e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎tools/test.py

Copy file name to clipboardexpand all lines: tools/test.py
+9-4
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,7 @@ def AddTestsToList(self, result, current_path, path, context, arch, mode):
774774
tests = self.GetConfiguration(context).ListTests(current_path, path,
775775
arch, mode)
776776
for t in tests: t.variant_flags = v
777-
result += tests
778-
777+
result += tests * context.repeat
779778

780779
def GetTestStatus(self, context, sections, defs):
781780
self.GetConfiguration(context).GetTestStatus(sections, defs)
@@ -828,7 +827,8 @@ def GetTestStatus(self, context, sections, defs):
828827
class Context(object):
829828

830829
def __init__(self, workspace, buildspace, verbose, vm, expect_fail,
831-
timeout, processor, suppress_dialogs, store_unexpected_output):
830+
timeout, processor, suppress_dialogs,
831+
store_unexpected_output, repeat):
832832
self.workspace = workspace
833833
self.buildspace = buildspace
834834
self.verbose = verbose
@@ -838,6 +838,7 @@ def __init__(self, workspace, buildspace, verbose, vm, expect_fail,
838838
self.processor = processor
839839
self.suppress_dialogs = suppress_dialogs
840840
self.store_unexpected_output = store_unexpected_output
841+
self.repeat = repeat
841842

842843
def GetVm(self, arch, mode):
843844
if arch == 'none':
@@ -1369,6 +1370,9 @@ def BuildOptions():
13691370
default="")
13701371
result.add_option('--temp-dir',
13711372
help='Optional path to change directory used for tests', default=False)
1373+
result.add_option('--repeat',
1374+
help='Number of times to repeat given tests',
1375+
default=1, type="int")
13721376
return result
13731377

13741378

@@ -1533,7 +1537,8 @@ def Main():
15331537
options.timeout,
15341538
processor,
15351539
options.suppress_dialogs,
1536-
options.store_unexpected_output)
1540+
options.store_unexpected_output,
1541+
options.repeat)
15371542
# First build the required targets
15381543
if not options.no_build:
15391544
reqs = [ ]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.