From fcd9d7096f0ca475b9926355d13ef7679ff99680 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 3 Apr 2018 10:01:41 -0400 Subject: [PATCH 1/2] t5561: drop curl stderr redirects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For a normal test run, stderr is already redirected to /dev/null by the test suite. When used with "-v", suppressing stderr is actively harmful, as it may hide the reason for curl failing. Reported-by: Jens Krüger Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t5561-http-backend.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t5561-http-backend.sh b/t/t5561-http-backend.sh index 90e0d6f0fe..6167563986 100755 --- a/t/t5561-http-backend.sh +++ b/t/t5561-http-backend.sh @@ -6,7 +6,7 @@ test_description='test git-http-backend' start_httpd GET() { - curl --include "$HTTPD_URL/$SMART/repo.git/$1" >out 2>/dev/null && + curl --include "$HTTPD_URL/$SMART/repo.git/$1" >out && tr '\015' Q out 2>/dev/null && + "$HTTPD_URL/smart/repo.git/$1" >out && tr '\015' Q Date: Tue, 3 Apr 2018 10:01:57 -0400 Subject: [PATCH 2/2] t5561: skip tests if curl is not available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- 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 816e692391..db91875297 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1187,3 +1187,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 +'