diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 525b5a566b6f1e..c431d207acc140 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -169,10 +169,17 @@ C++ linting. If you are updating tests and just want to run a single test to check it: -```text -$ python tools/test.py -v --mode=release parallel/test-stream2-transform +```console +$ ./tools/test-ci.sh parallel/test-stream2-transform +``` + +Windows: + +```console +> tools\test-ci parallel\test-stream2-transform ``` + You can usually run tests directly with node: ```text diff --git a/Makefile b/Makefile index 78c288930db6a0..63a0568511097d 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ LOGLEVEL ?= silent OSTYPE := $(shell uname -s | tr '[A-Z]' '[a-z]') COVTESTS ?= test GTEST_FILTER ?= "*" +export PYTHON ifdef JOBS PARALLEL_ARGS = -j $(JOBS) @@ -43,6 +44,7 @@ NODE_EXE = node$(EXEEXT) NODE ?= ./$(NODE_EXE) NODE_G_EXE = node_g$(EXEEXT) NPM ?= ./deps/npm/bin/npm-cli.js +TEST_CI = ./tools/test-ci.sh # Flags for packaging. BUILD_DOWNLOAD_FLAGS ?= --download=all @@ -195,18 +197,18 @@ test: all $(MAKE) build-addons $(MAKE) build-addons-napi $(MAKE) cctest - $(PYTHON) tools/test.py --mode=release -J \ + $(TEST_CI) \ doctool inspector known_issues message pseudo-tty parallel sequential $(CI_NATIVE_SUITES) $(MAKE) lint test-parallel: all - $(PYTHON) tools/test.py --mode=release parallel -J + $(TEST_CI) parallel test-valgrind: all $(PYTHON) tools/test.py --mode=release --valgrind sequential parallel message test-check-deopts: all - $(PYTHON) tools/test.py --mode=release --check-deopts parallel sequential -J + $(TEST_CI) --check-deopts parallel sequential # Implicitly depends on $(NODE_EXE). We don't depend on it explicitly because # it always triggers a rebuild due to it being a .PHONY rule. See the comment diff --git a/tools/test-ci.cmd b/tools/test-ci.cmd new file mode 100644 index 00000000000000..a9b116eb763fdc --- /dev/null +++ b/tools/test-ci.cmd @@ -0,0 +1,5 @@ +pushd %~dp0\.. +python tools\test.py -J --mode=release %* +set TEST_CI_EXIT=%ERRORLEVEL% +popd +exit /b %TEST_CI_EXIT% diff --git a/tools/test-ci.sh b/tools/test-ci.sh new file mode 100644 index 00000000000000..0293ee59f3336f --- /dev/null +++ b/tools/test-ci.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cd `dirname $0`/.. > /dev/null +if [ -z "${PYTHON}" ]; then export PYTHON=`which python`; fi +"${PYTHON}" tools/test.py -J --mode=release $* +exit $? diff --git a/vcbuild.bat b/vcbuild.bat index ac2bf7f72ab53b..d6810ffacf8e94 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -403,7 +403,9 @@ 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 +set "test_deopts_cmd=%~dp0tools\test-ci.cmd --check-deopts parallel sequential" +echo running '%test_deopts_cmd%' +call %test_deopts_cmd% if defined test_node_inspect goto node-test-inspect goto node-tests @@ -418,8 +420,9 @@ if "%config%"=="Debug" set test_args=--mode=debug %test_args% if "%config%"=="Release" set test_args=--mode=release %test_args% echo running 'cctest %cctest_args%' "%config%\cctest" %cctest_args% -echo running 'python tools\test.py %test_args%' -python tools\test.py %test_args% +set "test_cmd=%~dp0tools\test-ci.cmd %test_args%" +echo running '%test_cmd%' +call %test_cmd% goto cpplint :cpplint