From 955a2e288a57dd0bc2f04843ff9c4c3395ae6ccd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Thu, 1 Mar 2018 09:58:28 -0500 Subject: [PATCH] tests: intro NIT_TESTING_TESTSSH MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- tests/README.md | 5 +++++ tests/tests.sh | 3 +++ 2 files changed, 8 insertions(+) diff --git a/tests/README.md b/tests/README.md index ed83013..8941587 100644 --- a/tests/README.md +++ b/tests/README.md @@ -324,6 +324,11 @@ $ cat out/zzz_test_post_proc.res The environment variable `NIT_TESTING` is set to `true` during the execution of program tests. Some libraries of programs can use it to produce specific reproducible results ; or just to exit their executions. +`NIT_TESTING_TESTS_SH` is set to `true` for tests ran by `tests.sh` only, not by nitunit. + +`NIT_TESTING_ID` is set to an integer value unique between concurrent executions of `tests.sh`. +Use it to name files, database entries, open sockets in order to avoid race conditions. + ~~~ $ cat zzz_tests/zzz_test_envvar.nit $ ./tests.sh zzz_tests/zzz_test_envvar.nit diff --git a/tests/tests.sh b/tests/tests.sh index 658cbbb..46cb74f 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -30,6 +30,9 @@ export NIT_TESTING=true export NIT_TESTING_ID=$$ export NIT_SRAND=0 +# Identify this as a tests.sh test to differentiate from a nitunit test +export NIT_TESTING_TESTS_SH=true + unset NIT_DIR # Get the first Java lib available -- 1.7.9.5