diff mbox series

[v2,1/6] test-lib.sh: add a UNIX_SOCKETS prerequisite

Message ID patch-v2-1.6-9e8facb6f8c-20210910T153147Z-avarab@gmail.com (mailing list archive)
State Superseded
Headers show
Series parse-options: properly align continued usage output & related | expand

Commit Message

Ævar Arnfjörð Bjarmason Sept. 10, 2021, 3:38 p.m. UTC
Instead of checking $NO_UNIX_SOCKETS directly in
t/t0301-credential-cache.sh, follow the more common pattern of
creating a test prerequisite in test-lib.sh.

See 6320358e31d (Makefile: unix sockets may not available on some
platforms, 2011-12-12) for the original implementation of
NO_UNIX_SOCKETS.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t0301-credential-cache.sh | 5 +++--
 t/test-lib.sh               | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/t/t0301-credential-cache.sh b/t/t0301-credential-cache.sh
index ebd5fa5249c..002de427984 100755
--- a/t/t0301-credential-cache.sh
+++ b/t/t0301-credential-cache.sh
@@ -4,10 +4,11 @@  test_description='credential-cache tests'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-credential.sh
 
-test -z "$NO_UNIX_SOCKETS" || {
+if ! test_have_prereq UNIX_SOCKETS
+then
 	skip_all='skipping credential-cache tests, unix sockets not available'
 	test_done
-}
+fi
 
 # don't leave a stale daemon running
 test_atexit 'git credential-cache exit'
diff --git a/t/test-lib.sh b/t/test-lib.sh
index abcfbed6d61..583f266b1e8 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1533,6 +1533,7 @@  test -z "$NO_PYTHON" && test_set_prereq PYTHON
 test -n "$USE_LIBPCRE2" && test_set_prereq PCRE
 test -n "$USE_LIBPCRE2" && test_set_prereq LIBPCRE2
 test -z "$NO_GETTEXT" && test_set_prereq GETTEXT
+test -z "$NO_UNIX_SOCKETS" && test_set_prereq UNIX_SOCKETS
 
 if test -z "$GIT_TEST_CHECK_CACHE_TREE"
 then