Skip to content

Commit ba7df9d

Browse files
jbergstroemMichael Scovetta
authored andcommitted
test: inherit JOBS from environment
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]>
1 parent 69d94bd commit ba7df9d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,10 @@ def ProcessOptions(options):
13391339
print "The test group to run (n) must be smaller than number of groups (m)."
13401340
return False
13411341
if options.J:
1342-
options.j = multiprocessing.cpu_count()
1342+
# inherit JOBS from environment if provided. some virtualised systems
1343+
# tends to exaggerate the number of available cpus/cores.
1344+
cores = os.environ.get('JOBS')
1345+
options.j = int(cores) if cores is not None else multiprocessing.cpu_count()
13431346
if options.flaky_tests not in ["run", "skip", "dontcare"]:
13441347
print "Unknown flaky-tests mode %s" % options.flaky_tests
13451348
return False

0 commit comments

Comments
 (0)