From d2244c1ff745a025be7b860b79ee9a3242a52e7d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 23 Nov 2021 21:18:42 -0800 Subject: [PATCH 1/5] tools,test: make -J behavior default for test.py --- tools/test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/test.py b/tools/test.py index 8ca1f58e9a1223..ff827931b2e8a5 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,7 +1423,7 @@ 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') From c85a45bb8772fc90bcdbad7d7a8b1124d85aba10 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 23 Nov 2021 21:30:04 -0800 Subject: [PATCH 2/5] doc: remove legacy -J test.py option from BUILDING.md --- BUILDING.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/BUILDING.md b/BUILDING.md index 8e43eb73d04434..a6e503e2175c4a 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -329,6 +329,7 @@ You can execute the entire suite of tests for a given subsystem by providing the name of a subsystem: ```text +<<<<<<< HEAD $ tools/test.py -J child-process ``` @@ -336,6 +337,9 @@ You can also execute the tests in a tests directory (such as `test/message`): ```text $ tools/test.py -J test/message +======= +$ python tools/test.py --mode=release child-process +>>>>>>> doc: remove legacy -J test.py option from BUILDING.md ``` If you want to check the other options, please refer to the help by using @@ -403,7 +407,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 ``` From 1fe77c743d73d20232a27da83031b6f365cee3d1 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 23 Nov 2021 21:30:21 -0800 Subject: [PATCH 3/5] build: remove legacy -J test.py option from Makefile/vcbuild --- Makefile | 2 +- vcbuild.bat | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) 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/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 From 01db947ae36f3e86689dd71945092a4e9c3da1f5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 25 Nov 2021 14:18:42 -0800 Subject: [PATCH 4/5] fixup! tools,test: make -J behavior default for test.py --- tools/test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/test.py b/tools/test.py index ff827931b2e8a5..f204004c7a63f1 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1428,6 +1428,11 @@ def ProcessOptions(options): # 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 From 54996df429e7bedd44adfe6909b54972bd09d41c Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 25 Nov 2021 19:37:25 -0800 Subject: [PATCH 5/5] fixup! doc: remove legacy -J test.py option from BUILDING.md --- BUILDING.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index a6e503e2175c4a..ae94b8846e97d2 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -329,7 +329,6 @@ You can execute the entire suite of tests for a given subsystem by providing the name of a subsystem: ```text -<<<<<<< HEAD $ tools/test.py -J child-process ``` @@ -337,9 +336,6 @@ You can also execute the tests in a tests directory (such as `test/message`): ```text $ tools/test.py -J test/message -======= -$ python tools/test.py --mode=release child-process ->>>>>>> doc: remove legacy -J test.py option from BUILDING.md ``` If you want to check the other options, please refer to the help by using