diff --git a/BUILDING.md b/BUILDING.md index 8e43eb73d04434..ae94b8846e97d2 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -403,7 +403,7 @@ by providing the name of a subsystem: ```text $ make coverage-clean -$ NODE_V8_COVERAGE=coverage/tmp tools/test.py -J --mode=release child-process +$ NODE_V8_COVERAGE=coverage/tmp tools/test.py --mode=release child-process $ make coverage-report-js ``` diff --git a/Makefile b/Makefile index 688bfc6bcbe3bd..be131195018fa1 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ FIND ?= find ifdef JOBS PARALLEL_ARGS = -j $(JOBS) else - PARALLEL_ARGS = -J + PARALLEL_ARGS = endif ifdef ENABLE_V8_TAP diff --git a/tools/test.py b/tools/test.py index 8ca1f58e9a1223..f204004c7a63f1 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1362,9 +1362,9 @@ def BuildOptions(): default="") result.add_option("--warn-unused", help="Report unused rules", 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", + result.add_option("-j", help="The number of parallel tasks to run, 0=use number of cores", + default=0, type="int") + result.add_option("-J", help="For legacy compatibility, has no effect", default=False, action="store_true") result.add_option("--time", help="Print timing information after running", default=False, action="store_true") @@ -1423,11 +1423,16 @@ def ProcessOptions(options): if options.run[0] >= options.run[1]: print("The test group to run (n) must be smaller than number of groups (m).") return False - if options.J: + if options.j == 0: # 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() + elif options.J: + # If someone uses -j and legacy -J, let them know that we will be respecting + # -j and ignoring -J, which is the opposite of what we used to do before -J + # became a legacy no-op. + print('Warning: Legacy -J option is ignored. Using the -j option.') if options.flaky_tests not in [RUN, SKIP, DONTCARE]: print("Unknown flaky-tests mode %s" % options.flaky_tests) return False diff --git a/vcbuild.bat b/vcbuild.bat index 604843027cb1e5..49a05602d6ddc1 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -92,9 +92,9 @@ if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok if /i "%1"=="noetw" set noetw=1&goto arg-ok if /i "%1"=="ltcg" set ltcg=1&goto arg-ok if /i "%1"=="licensertf" set licensertf=1&goto arg-ok -if /i "%1"=="test" set test_args=%test_args% -J %common_test_suites%&set lint_cpp=1&set lint_js=1&set lint_md=1&goto arg-ok -if /i "%1"=="test-ci-native" set test_args=%test_args% %test_ci_args% -J -p tap --logfile test.tap %CI_NATIVE_SUITES% %CI_DOC%&set build_addons=1&set build_js_native_api_tests=1&set build_node_api_tests=1&set cctest_args=%cctest_args% --gtest_output=xml:cctest.junit.xml&goto arg-ok -if /i "%1"=="test-ci-js" set test_args=%test_args% %test_ci_args% -J -p tap --logfile test.tap %CI_JS_SUITES%&set no_cctest=1&goto arg-ok +if /i "%1"=="test" set test_args=%test_args% %common_test_suites%&set lint_cpp=1&set lint_js=1&set lint_md=1&goto arg-ok +if /i "%1"=="test-ci-native" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap %CI_NATIVE_SUITES% %CI_DOC%&set build_addons=1&set build_js_native_api_tests=1&set build_node_api_tests=1&set cctest_args=%cctest_args% --gtest_output=xml:cctest.junit.xml&goto arg-ok +if /i "%1"=="test-ci-js" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap %CI_JS_SUITES%&set no_cctest=1&goto arg-ok if /i "%1"=="build-addons" set build_addons=1&goto arg-ok if /i "%1"=="build-js-native-api-tests" set build_js_native_api_tests=1&goto arg-ok if /i "%1"=="build-node-api-tests" set build_node_api_tests=1&goto arg-ok @@ -103,7 +103,7 @@ if /i "%1"=="test-doc" set test_args=%test_args% %CI_DOC%&set doc=1&&set li if /i "%1"=="test-js-native-api" set test_args=%test_args% js-native-api&set build_js_native_api_tests=1&goto arg-ok if /i "%1"=="test-node-api" set test_args=%test_args% node-api&set build_node_api_tests=1&goto arg-ok if /i "%1"=="test-benchmark" set test_args=%test_args% benchmark&goto arg-ok -if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&goto arg-ok +if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel&goto arg-ok if /i "%1"=="test-message" set test_args=%test_args% message&goto arg-ok if /i "%1"=="test-tick-processor" set test_args=%test_args% tick-processor&goto arg-ok if /i "%1"=="test-internet" set test_args=%test_args% internet&goto arg-ok @@ -644,7 +644,7 @@ if defined test_node_inspect goto node-test-inspect goto node-tests :node-check-deopts -python tools\test.py --mode=release --check-deopts parallel sequential -J +python tools\test.py --mode=release --check-deopts parallel sequential if defined test_node_inspect goto node-test-inspect goto node-tests