From d13d4c8ccbd832e1d62044b18b8b771f6586ee2a Mon Sep 17 00:00:00 2001 From: Fabian Stelzer Date: Fri, 12 Nov 2021 16:43:18 +0100 Subject: [RFC PATCH 2/2] test-lib: introduce required prereq for test runs Allows setting GIT_TEST_REQUIRE_PREREQ to a number of prereqs that must succeed for this run. Otherwise the test run will abort. Signed-off-by: Fabian Stelzer --- t/test-lib-functions.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index eef2262a36..d65995cd15 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -669,6 +669,14 @@ test_have_prereq () { satisfied_this_prereq=t ;; *) + if ! test -z $GIT_TEST_REQUIRE_PREREQ + then + case ",$GIT_TEST_REQUIRE_PREREQ," in + *,$prerequisite,*) + error "required prereq $prerequisite failed" + ;; + esac + fi satisfied_this_prereq= esac -- 2.31.1