tests: make GIT_TEST_FAIL_PREREQS a boolean
Change the GIT_TEST_FAIL_PREREQS variable from being "non-empty?" to
being a more standard boolean variable. I recently added the variable
in dfe1a17df9
("tests: add a special setup where prerequisites fail",
2019-05-13), having to add another "non-empty?" special-case is what
prompted me to write the "git env--helper" utility being used here.
Converting this one is a bit tricky since we use it so early and
frequently in the guts of the test code itself, so let's set a
GIT_TEST_FAIL_PREREQS_INTERNAL which can be tested with the old "test
-n" for the purposes of the shell code, and change the user-exposed
and documented GIT_TEST_FAIL_PREREQS variable to a boolean.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
3b072c577b
commit
c740039921
@ -309,7 +309,7 @@ test_unset_prereq () {
|
||||
}
|
||||
|
||||
test_set_prereq () {
|
||||
if test -n "$GIT_TEST_FAIL_PREREQS"
|
||||
if test -n "$GIT_TEST_FAIL_PREREQS_INTERNAL"
|
||||
then
|
||||
case "$1" in
|
||||
# The "!" case is handled below with
|
||||
@ -1043,7 +1043,7 @@ perl () {
|
||||
# The error/skip message should be given by $2.
|
||||
#
|
||||
test_skip_or_die () {
|
||||
if ! git env--helper --mode-bool --variable=$1 --default=0 --exit-code --quiet
|
||||
if ! git env--helper --type=bool --default=false --exit-code $1
|
||||
then
|
||||
skip_all=$2
|
||||
test_done
|
||||
|
Reference in New Issue
Block a user