threads / discuss / 48209

Test 5561 failed

Subject: Test 5561 failed

## tl;dr

6 messages between Apr 3, 2018 and Apr 3, 2018.

replies: 5people: 2as markdown or json

Jens Krüger· Apr 3, 2018, 11:43 UTC · lore
Git version 2.17.0
OS: Debian 9 (9.4)
gcc: gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
build from github clone:

autoreconf ./configure make make test

*** t5561-http-backend.sh *** ok 1 - setup repository not ok 2 - direct refs/heads/master not found # #               GET refs/heads/master "404 Not Found" # not ok 3 - static file is ok # #               get_static_files "200 OK" # not ok 4 - no export by default # #               get_static_files "404 Not Found" # not ok 5 - export if git-daemon-export-ok # #               (cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && #                touch git-daemon-export-ok #               ) && #               get_static_files "200 OK" # not ok 6 - static file if http.getanyfile true is ok # #               config http.getanyfile true && #               get_static_files "200 OK" # not ok 7 - static file if http.getanyfile false fails # #               config http.getanyfile false && #               get_static_files "403 Forbidden" # not ok 8 - http.uploadpack default enabled # #               GET info/refs?service=git-upload-pack "200 OK" && #               POST git-upload-pack 0000 "200 OK" # not ok 9 - http.uploadpack true # #               config http.uploadpack true && #               GET info/refs?service=git-upload-pack "200 OK" && #               POST git-upload-pack 0000 "200 OK" # not ok 10 - http.uploadpack false # #               config http.uploadpack false && #               GET info/refs?service=git-upload-pack "403 Forbidden" && #               POST git-upload-pack 0000 "403 Forbidden" # not ok 11 - http.receivepack default disabled # #               GET info/refs?service=git-receive-pack "403 Forbidden"  && #               POST git-receive-pack 0000 "403 Forbidden" # not ok 12 - http.receivepack true # #               config http.receivepack true && #               GET info/refs?service=git-receive-pack "200 OK" && #               POST git-receive-pack 0000 "200 OK" # not ok 13 - http.receivepack false # #               config http.receivepack false && #               GET info/refs?service=git-receive-pack "403 Forbidden" && #               POST git-receive-pack 0000 "403 Forbidden" # not ok 14 - server request log matches test results # #               sed -e " #                       s/^.* \"// #                       s/\"// #                       s/ [1-9][0-9]*\$// #                       s/^GET /GET  / #               " >act <"$HTTPD_ROOT_PATH"/access.log && #               test_cmp exp act # # failed 13 among 14 test(s) 1..14

Initialized empty Git repository in /home/jkrueger/sources/git/t/trash directory.t5561-http-backend/.git/ checking prerequisite: NOT_ROOT

mkdir -p "$TRASH_DIRECTORY/prereq-test-dir" &&
(
	cd "$TRASH_DIRECTORY/prereq-test-dir" &&
	uid=$(id -u) &&
	test "$uid" != 0
)
prerequisite NOT_ROOT ok
expecting success: 
	echo content >file &&
	git add file &&
	git commit -m one &&
	mkdir "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
	(cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
	 git --bare init &&
	 : >objects/info/alternates &&
	 : >objects/info/http-alternates
	) &&
	git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
	git push public master:master &&
	(cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
	 git repack -a -d
	) &&
	echo other >file &&
	git add file &&
	git commit -m two &&
	git push public master:master &&
	LOOSE_URL=$(find_file objects/??) &&
	PACK_URL=$(find_file objects/pack/*.pack) &&
	IDX_URL=$(find_file objects/pack/*.idx)
[master (root-commit) ca879ad] one
 Author: A U Thor <author@example.com>
 1 file changed, 1 insertion(+)
 create mode 100644 file
Initialized empty Git repository in /home/jkrueger/sources/git/t/trash directory.t5561-http-backend/httpd/www/repo.git/
To /home/jkrueger/sources/git/t/trash directory.t5561-http-backend/httpd/www/repo.git
 * [new branch]      master -> master
[master b23ec89] two
 Author: A U Thor <author@example.com>
 1 file changed, 1 insertion(+), 1 deletion(-)
To /home/jkrueger/sources/git/t/trash directory.t5561-http-backend/httpd/www/repo.git
   ca879ad..b23ec89  master -> master
ok 1 - setup repository
expecting success: 
	GET refs/heads/master "404 Not Found"

not ok 2 - direct refs/heads/master not found # # GET refs/heads/master "404 Not Found" #

Jeff King· Apr 3, 2018, 13:14 UTC · re: Jens Krüger · lore

Re: Test 5561 failed

On Tue, Apr 03, 2018 at 01:43:37PM +0200, Jens Krüger wrote:
> expecting success: 
> 	GET refs/heads/master "404 Not Found"
> 
> not ok 2 - direct refs/heads/master not found
That GET function is:
  GET() {
        curl --include "$HTTPD_URL/$SMART/repo.git/$1" >out 2>/dev/null &&
        tr '\015' Q <out |
        sed '
                s/Q$//
                1q
        ' >act &&
        echo "HTTP/1.1 $2" >exp &&
        test_cmp exp act
  }

The tarball you sent shows "out" as empty, and "act" is missing. So "curl" produced no output, and we did not make it as far as the tr/sed pipe. Just a guess, but are you missing the "curl" command-line tool on your system? If so, "apt install curl" should fix the failure.

As far as code changes in Git, perhaps (assuming my guess is right):
  - drop the redirect of stderr here; the test suite already handles
    hiding stderr from the user (without "-v"), and in "-v" mode you
    probably would have gotten a useful error like "curl: not found"
  - it's rare but possible to have libcurl installed (which is needed
    for the server side, and what we key on for running the httpd tests)
    but not the curl binary. This test probably should check for the
    existence of the curl binary as a prerequisite.
-Peff
Jens Krüger· Apr 3, 2018, 13:29 UTC · re: Jeff King · lore

Re: Test 5561 failed

Am 03.04.2018 um 15:14 schrieb Jeff King:
Show 21 quoted lines
> On Tue, Apr 03, 2018 at 01:43:37PM +0200, Jens Krüger wrote:
>
>> expecting success: GET refs/heads/master "404 Not Found" not ok 2 - 
>> direct refs/heads/master not found 
> That GET function is:
>
>    GET() {
>          curl --include "$HTTPD_URL/$SMART/repo.git/$1" >out 2>/dev/null &&
>          tr '\015' Q <out |
>          sed '
>                  s/Q$//
>                  1q
>          ' >act &&
>          echo "HTTP/1.1 $2" >exp &&
>          test_cmp exp act
>    }
>
> The tarball you sent shows "out" as empty, and "act" is missing. So
> "curl" produced no output, and we did not make it as far as the tr/sed
> pipe. Just a guess, but are you missing the "curl" command-line tool on
> your system? If so, "apt install curl" should fix the failure.

Yes, the missing curl program was the reason, but I didn't find any hint about the missed program in the log output. The output will be suppressed by the '2>/dev/null' in lines: 9 and 22 of the t5561-http-backend.sh script.

Nevertheless many thanks for helping.
Show 12 quoted lines
> As far as code changes in Git, perhaps (assuming my guess is right):
>
>    - drop the redirect of stderr here; the test suite already handles
>      hiding stderr from the user (without "-v"), and in "-v" mode you
>      probably would have gotten a useful error like "curl: not found"
>
>    - it's rare but possible to have libcurl installed (which is needed
>      for the server side, and what we key on for running the httpd tests)
>      but not the curl binary. This test probably should check for the
>      existence of the curl binary as a prerequisite.
>
> -Peff
Jeff King· Apr 3, 2018, 14:00 UTC · re: Jeff King · lore

[PATCH 0/2] t5561 fails without curl installed

On Tue, Apr 03, 2018 at 09:14:47AM -0400, Jeff King wrote:
Show 10 quoted lines
> As far as code changes in Git, perhaps (assuming my guess is right):
> 
>   - drop the redirect of stderr here; the test suite already handles
>     hiding stderr from the user (without "-v"), and in "-v" mode you
>     probably would have gotten a useful error like "curl: not found"
> 
>   - it's rare but possible to have libcurl installed (which is needed
>     for the server side, and what we key on for running the httpd tests)
>     but not the curl binary. This test probably should check for the
>     existence of the curl binary as a prerequisite.
So let's do this before we forget.
  [1/2]: t5561: drop curl stderr redirects
  [2/2]: t5561: skip tests if curl is not available
 t/t5561-http-backend.sh | 10 ++++++++--
 t/test-lib.sh           |  4 ++++
 2 files changed, 12 insertions(+), 2 deletions(-)
-Peff
Jeff King· Apr 3, 2018, 14:01 UTC · re: Jeff King · lore

[PATCH 1/2] t5561: drop curl stderr redirects

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 <Jens.Krueger@frm2.tum.de>
Signed-off-by: Jeff King <peff@peff.net>
---
 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 |
 	sed '
 		s/Q$//
@@ -19,7 +19,7 @@ GET() {
 POST() {
 	curl --include --data "$2" \
 	--header "Content-Type: application/x-$1-request" \
-	"$HTTPD_URL/smart/repo.git/$1" >out 2>/dev/null &&
+	"$HTTPD_URL/smart/repo.git/$1" >out &&
 	tr '\015' Q <out |
 	sed '
 		s/Q$//
-- 
2.17.0.686.g08b0810b04
Jeff King· Apr 3, 2018, 14:01 UTC · re: Jeff King · lore

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

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

← back to recent threads