@@ -1362,9 +1362,9 @@ def BuildOptions():
1362
1362
default = "" )
1363
1363
result .add_option ("--warn-unused" , help = "Report unused rules" ,
1364
1364
default = False , action = "store_true" )
1365
- result .add_option ("-j" , help = "The number of parallel tasks to run" ,
1366
- default = 1 , type = "int" )
1367
- result .add_option ("-J" , help = "Run tasks in parallel on all cores " ,
1365
+ result .add_option ("-j" , help = "The number of parallel tasks to run, 0=use number of cores " ,
1366
+ default = 0 , type = "int" )
1367
+ result .add_option ("-J" , help = "For legacy compatibility, has no effect " ,
1368
1368
default = False , action = "store_true" )
1369
1369
result .add_option ("--time" , help = "Print timing information after running" ,
1370
1370
default = False , action = "store_true" )
@@ -1423,11 +1423,16 @@ def ProcessOptions(options):
1423
1423
if options .run [0 ] >= options .run [1 ]:
1424
1424
print ("The test group to run (n) must be smaller than number of groups (m)." )
1425
1425
return False
1426
- if options .J :
1426
+ if options .j == 0 :
1427
1427
# inherit JOBS from environment if provided. some virtualised systems
1428
1428
# tends to exaggerate the number of available cpus/cores.
1429
1429
cores = os .environ .get ('JOBS' )
1430
1430
options .j = int (cores ) if cores is not None else multiprocessing .cpu_count ()
1431
+ elif options .J :
1432
+ # If someone uses -j and legacy -J, let them know that we will be respecting
1433
+ # -j and ignoring -J, which is the opposite of what we used to do before -J
1434
+ # became a legacy no-op.
1435
+ print ('Warning: Legacy -J option is ignored. Using the -j option.' )
1431
1436
if options .flaky_tests not in [RUN , SKIP , DONTCARE ]:
1432
1437
print ("Unknown flaky-tests mode %s" % options .flaky_tests )
1433
1438
return False
0 commit comments