Skip to content

Commit

Permalink
test: inherit JOBS from environment
Browse files Browse the repository at this point in the history
In some virtualized environments the amount of available resources
are misleading; for instance `multiprocessing.cpu_count()` on our current
4-core smartos vm's returns `48`. This is not a bug, merely how the vm
host provides information about available hardware.

Avoid running into issues by overriding `cpu_count()` with `JOBS`.

PR-URL: nodejs#4495
Reviewed-By: Brian White <[email protected]>
  • Loading branch information
jbergstroem authored and Michael Scovetta committed Apr 2, 2016
1 parent 69d94bd commit ba7df9d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,10 @@ def ProcessOptions(options):
print "The test group to run (n) must be smaller than number of groups (m)."
return False
if options.J:
options.j = multiprocessing.cpu_count()
# inherit JOBS from environment if provided. some virtualised systems
# tends to exaggerate the number of available cpus/cores.
cores = os.environ.get('JOBS')
options.j = int(cores) if cores is not None else multiprocessing.cpu_count()
if options.flaky_tests not in ["run", "skip", "dontcare"]:
print "Unknown flaky-tests mode %s" % options.flaky_tests
return False
Expand Down

0 comments on commit ba7df9d

Please sign in to comment.