From 7ff770c9286ec839189baff586aafe66812bdc9e Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 6 May 2017 14:24:37 -0400 Subject: [PATCH 1/7] build, tools: add `test-ci` scripts * Replace explicit use in `Makefile` and `vcbuild.bat` --- Makefile | 7 ++++--- tools/test-ci.cmd | 3 +++ tools/test-ci.sh | 3 +++ vcbuild.bat | 9 ++++++--- 4 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 tools/test-ci.cmd create mode 100644 tools/test-ci.sh diff --git a/Makefile b/Makefile index 78c288930db6a0..f32efcfeb82cc2 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,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 +196,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..added7905047d7 --- /dev/null +++ b/tools/test-ci.cmd @@ -0,0 +1,3 @@ +pushd %~dp0\.. +python tools\test.py -J --mode=release %* +popd diff --git a/tools/test-ci.sh b/tools/test-ci.sh new file mode 100644 index 00000000000000..1db23783d9cf65 --- /dev/null +++ b/tools/test-ci.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd `dirname $0`/.. > /dev/null +`which python` tools/test.py -J --mode=release $* diff --git a/vcbuild.bat b/vcbuild.bat index ac2bf7f72ab53b..18e24140852174 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=tools\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=tools\test-ci.cmd %test_args%" +echo running '%test_cmd%' +call %test_cmd% goto cpplint :cpplint From 4fa2a445e0dd52167adaeabf4c7815432902ad0a Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 6 May 2017 15:14:57 -0400 Subject: [PATCH 2/7] [squash] use exported PYTHON --- Makefile | 1 + tools/test-ci.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f32efcfeb82cc2..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) diff --git a/tools/test-ci.sh b/tools/test-ci.sh index 1db23783d9cf65..4f1708338f6de7 100644 --- a/tools/test-ci.sh +++ b/tools/test-ci.sh @@ -1,3 +1,4 @@ #!/bin/bash cd `dirname $0`/.. > /dev/null -`which python` tools/test.py -J --mode=release $* +if [ -z ${PYTHON+x} ]; then export PYTHON=`which python`; fi +${PYTHON} tools/test.py -J --mode=release $* From 964b2a1428a92a14e78425f512fe4579c71f6c0f Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 6 May 2017 15:27:37 -0400 Subject: [PATCH 3/7] change documentation (to finish the PR's story) --- CONTRIBUTING.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 From 7d757daa0cfaf13f6599dad1022158ec624559ba Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 6 May 2017 15:33:52 -0400 Subject: [PATCH 4/7] [squash]explicit path --- vcbuild.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcbuild.bat b/vcbuild.bat index 18e24140852174..d6810ffacf8e94 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -403,7 +403,7 @@ if defined test_node_inspect goto node-test-inspect goto node-tests :node-check-deopts -set "test_deopts_cmd=tools\test-ci.cmd --check-deopts parallel sequential" +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 @@ -420,7 +420,7 @@ 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% -set "test_cmd=tools\test-ci.cmd %test_args%" +set "test_cmd=%~dp0tools\test-ci.cmd %test_args%" echo running '%test_cmd%' call %test_cmd% goto cpplint From f6665434449d034a440112314f94866083366ce6 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 6 May 2017 15:46:33 -0400 Subject: [PATCH 5/7] [squash] handle errorlevel --- tools/test-ci.cmd | 2 ++ tools/test-ci.sh | 1 + 2 files changed, 3 insertions(+) diff --git a/tools/test-ci.cmd b/tools/test-ci.cmd index added7905047d7..a9b116eb763fdc 100644 --- a/tools/test-ci.cmd +++ b/tools/test-ci.cmd @@ -1,3 +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 index 4f1708338f6de7..1fe7376a09f73b 100644 --- a/tools/test-ci.sh +++ b/tools/test-ci.sh @@ -2,3 +2,4 @@ cd `dirname $0`/.. > /dev/null if [ -z ${PYTHON+x} ]; then export PYTHON=`which python`; fi ${PYTHON} tools/test.py -J --mode=release $* +exit $? From 18609721730956e38ae675aaa3c0b2c48fd1699c Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 6 May 2017 15:54:20 -0400 Subject: [PATCH 6/7] [squash] wrap strings --- tools/test-ci.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test-ci.sh b/tools/test-ci.sh index 1fe7376a09f73b..af0e2ca05a34be 100644 --- a/tools/test-ci.sh +++ b/tools/test-ci.sh @@ -1,5 +1,5 @@ #!/bin/bash cd `dirname $0`/.. > /dev/null -if [ -z ${PYTHON+x} ]; then export PYTHON=`which python`; fi -${PYTHON} tools/test.py -J --mode=release $* +if [ -z "${PYTHON+x}" ]; then export PYTHON=`which python`; fi +"${PYTHON}" tools/test.py -J --mode=release $* exit $? From e9b2d11dfe840896300ac402555feca76d11616d Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 6 May 2017 16:01:49 -0400 Subject: [PATCH 7/7] [squash] no +x --- tools/test-ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-ci.sh b/tools/test-ci.sh index af0e2ca05a34be..0293ee59f3336f 100644 --- a/tools/test-ci.sh +++ b/tools/test-ci.sh @@ -1,5 +1,5 @@ #!/bin/bash cd `dirname $0`/.. > /dev/null -if [ -z "${PYTHON+x}" ]; then export PYTHON=`which python`; fi +if [ -z "${PYTHON}" ]; then export PYTHON=`which python`; fi "${PYTHON}" tools/test.py -J --mode=release $* exit $?