GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: option to run a subset of tests · nodejs/node@e51f90d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tools
    • test.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tools/test.py‎

Copy file name to clipboardExpand all lines: tools/test.py
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,9 @@ def BuildOptions():
12721272
result.add_option("--no-store-unexpected-output",
12731273
help="Deletes the temporary JS files from tests that fails",
12741274
dest="store_unexpected_output", action="store_false")
1275+
result.add_option("-r", "--run",
1276+
help="Divide the tests in m groups (interleaved) and run tests from group n (--run=n,m with n < m)",
1277+
default="")
12751278
return result
12761279

12771280

@@ -1280,6 +1283,24 @@ def ProcessOptions(options):
12801283
VERBOSE = options.verbose
12811284
options.arch = options.arch.split(',')
12821285
options.mode = options.mode.split(',')
1286+
options.run = options.run.split(',')
1287+
if options.run == [""]:
1288+
options.run = None
1289+
elif len(options.run) != 2:
1290+
print "The run argument must be two comma-separated integers."
1291+
return False
1292+
else:
1293+
try:
1294+
options.run = map(int, options.run)
1295+
except ValueError:
1296+
print "Could not parse the integers from the run argument."
1297+
return False
1298+
if options.run[0] < 0 or options.run[1] < 0:
1299+
print "The run argument cannot have negative integers."
1300+
return False
1301+
if options.run[0] >= options.run[1]:
1302+
print "The test group to run (n) must be smaller than number of groups (m)."
1303+
return False
12831304
if options.J:
12841305
options.j = multiprocessing.cpu_count()
12851306
return True
@@ -1486,6 +1507,15 @@ def Main():
14861507
def DoSkip(case):
14871508
return SKIP in case.outcomes or SLOW in case.outcomes
14881509
cases_to_run = [ c for c in all_cases if not DoSkip(c) ]
1510+
if options.run is not None:
1511+
# Must ensure the list of tests is sorted before selecting, to avoid
1512+
# silent errors if this file is changed to list the tests in a way that
1513+
# can be different in different machines
1514+
cases_to_run.sort(key=lambda c: (c.case.arch, c.case.mode, c.case.file))
1515+
cases_to_run = [ cases_to_run[i] for i
1516+
in xrange(options.run[0],
1517+
len(cases_to_run),
1518+
options.run[1]) ]
14891519
if len(cases_to_run) == 0:
14901520
print "No tests to run."
14911521
return 1

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.