git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Test 5561 failed
@ 2018-04-03 11:43 Jens Krüger
  2018-04-03 13:14 ` Jeff King
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Krüger @ 2018-04-03 11:43 UTC (permalink / raw)
  To: Git List

[-- Attachment #1: Type: text/plain, Size: 3044 bytes --]

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


[-- Attachment #2: t5561.output --]
[-- Type: text/plain, Size: 1735 bytes --]

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"
#	

[-- Attachment #3: trash directory.t5561-http-backend.tar.gz --]
[-- Type: application/gzip, Size: 18894 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Test 5561 failed
  2018-04-03 11:43 Test 5561 failed Jens Krüger
@ 2018-04-03 13:14 ` Jeff King
  2018-04-03 13:29   ` Jens Krüger
  2018-04-03 14:00   ` [PATCH 0/2] t5561 fails without curl installed Jeff King
  0 siblings, 2 replies; 6+ messages in thread
From: Jeff King @ 2018-04-03 13:14 UTC (permalink / raw)
  To: Jens Krüger; +Cc: Git List

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Test 5561 failed
  2018-04-03 13:14 ` Jeff King
@ 2018-04-03 13:29   ` Jens Krüger
  2018-04-03 14:00   ` [PATCH 0/2] t5561 fails without curl installed Jeff King
  1 sibling, 0 replies; 6+ messages in thread
From: Jens Krüger @ 2018-04-03 13:29 UTC (permalink / raw)
  To: Jeff King; +Cc: Git List




Am 03.04.2018 um 15:14 schrieb Jeff King:
> 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.

> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/2] t5561 fails without curl installed
  2018-04-03 13:14 ` Jeff King
  2018-04-03 13:29   ` Jens Krüger
@ 2018-04-03 14:00   ` Jeff King
  2018-04-03 14:01     ` [PATCH 1/2] t5561: drop curl stderr redirects Jeff King
  2018-04-03 14:01     ` [PATCH 2/2] t5561: skip tests if curl is not available Jeff King
  1 sibling, 2 replies; 6+ messages in thread
From: Jeff King @ 2018-04-03 14:00 UTC (permalink / raw)
  To: Jens Krüger; +Cc: Git List

On Tue, Apr 03, 2018 at 09:14:47AM -0400, Jeff King wrote:

> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] t5561: drop curl stderr redirects
  2018-04-03 14:00   ` [PATCH 0/2] t5561 fails without curl installed Jeff King
@ 2018-04-03 14:01     ` Jeff King
  2018-04-03 14:01     ` [PATCH 2/2] t5561: skip tests if curl is not available Jeff King
  1 sibling, 0 replies; 6+ messages in thread
From: Jeff King @ 2018-04-03 14:01 UTC (permalink / raw)
  To: Jens Krüger; +Cc: Git List

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] t5561: skip tests if curl is not available
  2018-04-03 14:00   ` [PATCH 0/2] t5561 fails without curl installed Jeff King
  2018-04-03 14:01     ` [PATCH 1/2] t5561: drop curl stderr redirects Jeff King
@ 2018-04-03 14:01     ` Jeff King
  1 sibling, 0 replies; 6+ messages in thread
From: Jeff King @ 2018-04-03 14:01 UTC (permalink / raw)
  To: Jens Krüger; +Cc: Git List

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-04-03 14:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-03 11:43 Test 5561 failed Jens Krüger
2018-04-03 13:14 ` Jeff King
2018-04-03 13:29   ` Jens Krüger
2018-04-03 14:00   ` [PATCH 0/2] t5561 fails without curl installed Jeff King
2018-04-03 14:01     ` [PATCH 1/2] t5561: drop curl stderr redirects Jeff King
2018-04-03 14:01     ` [PATCH 2/2] t5561: skip tests if curl is not available Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).