git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] t5561: skip tests if curl is not available

From
Jeff King <peff@peff.net>
Date
Apr 3, 2018, 14:01 UTC
Message-ID
<20180403140157.GB30376@sigill.intra.peff.net>
In-Reply-To
<20180403140055.GA29556@sigill.intra.peff.net>

It's possible to have libcurl installed but not the curl command-line utility. The latter is not generally needed for Git's http support, but we use it in t5561 for basic tests of http-backend's functionality. Let's detect when it's missing and skip this test.

Note that we can't mark the individual tests with the CURL prerequisite. They're in a shared t556x_common that uses the GET and POST functions as a level of indirection, and it's only our implementations of those functions in t5561 that requires curl. It's not a problem, though, as literally every test in the script would depend on the prerequisite anyway.

Reported-by: Jens Krüger <Jens.Krueger@frm2.tum.de>
Signed-off-by: Jeff King <peff@peff.net>
---
 t/t5561-http-backend.sh | 6 ++++++
 t/test-lib.sh           | 4 ++++
 2 files changed, 10 insertions(+)
diff --git a/t/t5561-http-backend.sh b/t/t5561-http-backend.sh
index 6167563986..84a955770a 100755
--- a/t/t5561-http-backend.sh
+++ b/t/t5561-http-backend.sh
@@ -3,6 +3,12 @@
 test_description='test git-http-backend'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-httpd.sh
+
+if ! test_have_prereq CURL; then
+	skip_all='skipping raw http-backend tests, curl not available'
+	test_done
+fi
+
 start_httpd
 
 GET() {
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7740d511d2..1aa39fe889 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1208,3 +1208,7 @@ test_lazy_prereq LONG_IS_64BIT '
 
 test_lazy_prereq TIME_IS_64BIT 'test-date is64bit'
 test_lazy_prereq TIME_T_IS_64BIT 'test-date time_t-is64bit'
+
+test_lazy_prereq CURL '
+	curl --version
+'
-- 
2.17.0.686.g08b0810b04
Previous: Jeff King
Message 6 of 6 in “Test 5561 failed”
  1. Jens KrügerApr 3, 2018
  2. Jeff KingApr 3, 2018
  3. Jens KrügerApr 3, 2018
  4. 0/2 t5561 fails without curl installedJeff King, Apr 3, 2018
  5. 1/2 t5561: drop curl stderr redirectsJeff King, Apr 3, 2018
  6. 2/2 t5561: skip tests if curl is not availableJeff King, Apr 3, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.