Skip to content

Commit

Permalink
test: auto-detect number of threads to use
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Dec 16, 2014
1 parent 682eb7e commit 8ed9bf1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ distclean:
-rm -rf node_modules

test: all
$(PYTHON) tools/test.py --mode=release simple message io -j9
$(PYTHON) tools/test.py --mode=release simple message io -J
$(MAKE) jslint
$(MAKE) cpplint

Expand Down
5 changes: 5 additions & 0 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import time
import threading
import utils
import multiprocessing

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

0 comments on commit 8ed9bf1

Please sign in to comment.