summaryrefslogtreecommitdiff
path: root/t/lib-git-svn.sh
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2019-11-22 13:14:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-11-23 02:16:08 (GMT)
commit43a2afee82acd0c51609a7840ca71ac5291020b4 (patch)
tree64ef867b7c9e7659df23adb08cdf0fb2af832cf5 /t/lib-git-svn.sh
parentd9f6f3b6195a0ca35642561e530798ad1469bd41 (diff)
downloadgit-43a2afee82acd0c51609a7840ca71ac5291020b4.zip
git-43a2afee82acd0c51609a7840ca71ac5291020b4.tar.gz
git-43a2afee82acd0c51609a7840ca71ac5291020b4.tar.bz2
tests: add 'test_bool_env' to catch non-bool GIT_TEST_* values
Since 3b072c577b (tests: replace test_tristate with "git env--helper", 2019-06-21) we get the normalized bool values of various GIT_TEST_* environment variables via 'git env--helper'. Now, while the 'git env--helper' command itself does catch invalid values in the environment variable or in the given --default and exits with error (exit code 128 or 129, respectively), it's invoked in conditions like 'if ! git env--helper ...', which means that all invalid bool values are interpreted the same as the ordinary 'false' (exit code 1). This has led to inadvertently skipped httpd tests in our CI builds for a couple of weeks, see 3960290675 (ci: restore running httpd tests, 2019-09-06). Let's be more careful about what the test suite accepts as bool values in GIT_TEST_* environment variables, and error out loud and clear on invalid values instead of simply skipping tests. Add the 'test_bool_env' helper function to encapsulate the invocation of 'git env--helper' and the verification of its exit code, and replace all invocations of that command in our test framework and test suite with a call to this new helper (except in 't0017-env-helper.sh', of course). $ GIT_TEST_GIT_DAEMON=YesPlease ./t5570-git-daemon.sh fatal: bad numeric config value 'YesPlease' for 'GIT_TEST_GIT_DAEMON': invalid unit error: test_bool_env requires bool values both for $GIT_TEST_GIT_DAEMON and for the default fallback Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-git-svn.sh')
-rw-r--r--t/lib-git-svn.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index bc0b9c7..7d248e6 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -69,7 +69,7 @@ svn_cmd () {
maybe_start_httpd () {
loc=${1-svn}
- if git env--helper --type=bool --default=false --exit-code GIT_TEST_SVN_HTTPD
+ if test_bool_env GIT_TEST_SVN_HTTPD false
then
. "$TEST_DIRECTORY"/lib-httpd.sh
LIB_HTTPD_SVN="$loc"
@@ -104,7 +104,7 @@ EOF
}
require_svnserve () {
- if ! git env--helper --type=bool --default=false --exit-code GIT_TEST_SVNSERVE
+ if ! test_bool_env GIT_TEST_SVNSERVE false
then
skip_all='skipping svnserve test. (set $GIT_TEST_SVNSERVE to enable)'
test_done