Fix test script overwriting grep option (#8209)

* Fix test script overwriting grep option

* Better logic and fix unstable scripts too
This commit is contained in:
Charles Gagnon
2019-11-04 11:35:52 -08:00
committed by GitHub
parent ade68b184d
commit 38decaea90
5 changed files with 15 additions and 18 deletions

View File

@@ -1,3 +1,4 @@
@echo off
setlocal
set ADS_TEST_GREP=@UNSTABLE@
@@ -5,6 +6,6 @@ set ADS_TEST_INVERT_GREP=
echo Running UNSTABLE ADS Core Tests
call %~dp0\test.bat
call %~dp0\test.bat %*
endlocal

View File

@@ -1,6 +1,8 @@
#!/bin/bash
set -e
PASSED_ARGS="$@"
if [[ "$OSTYPE" == "darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname $(dirname $(realpath "$0")))
@@ -15,4 +17,4 @@ export ADS_TEST_INVERT_GREP=
echo Running UNSTABLE ADS Core Tests
./scripts/test.sh
./scripts/test.sh $PASSED_ARGS

View File

@@ -22,17 +22,9 @@ if "%ADS_TEST_GREP%" == "" (
set ADS_TEST_INVERT_GREP=1
)
set CODE_ARGS=--grep %ADS_TEST_GREP%
if "%ADS_TEST_INVERT_GREP%" == "1" (
set CODE_ARGS=%CODE_ARGS% --invert
) else if "%ADS_TEST_INVERT_GREP%" == "true" (
set CODE_ARGS=%CODE_ARGS% --invert
)
:: Run tests
set ELECTRON_ENABLE_LOGGING=1
%CODE% .\test\electron\index.js %CODE_ARGS% %*
%CODE% .\test\electron\index.js %*
popd

View File

@@ -25,12 +25,6 @@ if [[ "$ADS_TEST_GREP" == "" ]]; then
export ADS_TEST_INVERT_GREP=1
fi
CODE_ARGS="--grep $ADS_TEST_GREP"
if [[ "$ADS_TEST_INVERT_GREP" == "1" ]] || [[ "$ADS_TEST_INVERT_GREP" == "true" ]]; then
CODE_ARGS="$CODE_ARGS --invert"
fi
# Node modules
test -d node_modules || yarn
@@ -42,7 +36,7 @@ if [[ "$OSTYPE" == "darwin"* ]] || [[ "$AGENT_OS" == "Darwin"* ]]; then
cd $ROOT ; ulimit -n 4096 ; \
ELECTRON_ENABLE_LOGGING=1 \
"$CODE" \
test/electron/index.js $CODE_ARGS $PASSED_ARGS
test/electron/index.js $PASSED_ARGS
else
cd $ROOT ; \
ELECTRON_ENABLE_LOGGING=1 \

View File

@@ -29,6 +29,14 @@ const optimist = require('optimist')
const argv = optimist.argv;
// {{SQL CARBON EDIT}}
// Set test run options. These are NOT used if grep is specified manually - that implies the user has a specific desire to
// filter the tests beyond the defaults set for ADS_TEST_GREP in the calling scripts.
if (!argv.grep) {
argv.grep = process.env['ADS_TEST_GREP'];
argv.invert = Boolean(process.env['ADS_TEST_INVERT_GREP']);
}
if (argv.help) {
optimist.showHelp();
process.exit(0);