Skip to content

Commit 8ed9bf1

Browse files
committed
test: auto-detect number of threads to use
1 parent 682eb7e commit 8ed9bf1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ distclean:
9090
-rm -rf node_modules
9191

9292
test: all
93-
$(PYTHON) tools/test.py --mode=release simple message io -j9
93+
$(PYTHON) tools/test.py --mode=release simple message io -J
9494
$(MAKE) jslint
9595
$(MAKE) cpplint
9696

tools/test.py

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import time
4141
import threading
4242
import utils
43+
import multiprocessing
4344

4445
from os.path import join, dirname, abspath, basename, isdir, exists
4546
from datetime import datetime
@@ -1237,6 +1238,8 @@ def BuildOptions():
12371238
default=False, action="store_true")
12381239
result.add_option("-j", help="The number of parallel tasks to run",
12391240
default=1, type="int")
1241+
result.add_option("-J", help="Run tasks in parallel on all cores",
1242+
default=False, action="store_true")
12401243
result.add_option("--time", help="Print timing information after running",
12411244
default=False, action="store_true")
12421245
result.add_option("--suppress-dialogs", help="Suppress Windows dialogs for crashing tests",
@@ -1258,6 +1261,8 @@ def ProcessOptions(options):
12581261
VERBOSE = options.verbose
12591262
options.arch = options.arch.split(',')
12601263
options.mode = options.mode.split(',')
1264+
if options.J:
1265+
options.j = multiprocessing.cpu_count()
12611266
def CheckTestMode(name, option):
12621267
if not option in ["run", "skip", "dontcare"]:
12631268
print "Unknown %s mode %s" % (name, option)

0 commit comments

Comments
 (0)