git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH] t5537: move http tests out to t5539
Date: Thu, 13 Feb 2014 20:21:14 +0700	[thread overview]
Message-ID: <1392297674-4291-1-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <CACsJy8Do0CRhhC+YvXSmihczOMDT9UpA4a4mEQ1z5MbR3TSXRw@mail.gmail.com>

start_httpd is supposed to be at the beginning of the test file, not
the middle of it. The "test_seq" line in "no shallow lines.." test is
updated to compensate missing refs that are there in t5537, but not in
the new t5539.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 On Thu, Feb 13, 2014 at 8:22 AM, Duy Nguyen <pclouds@gmail.com> wrote:
 > On Thu, Feb 13, 2014 at 5:12 AM, Jeff King <peff@peff.net> wrote:
 >> lib-httpd was never designed to be included from anywhere except the
 >> beginning of the file. But that wouldn't be right for t5537, because it
 >> wants to run some of the tests, even if apache setup fails. The right
 >> way to do it is probably to have lib-httpd do all of its work in a lazy
 >> prereq. I don't know how clunky that will end up, though; it might be
 >> simpler to just move the shallow http test into one of the http-fetch
 >> scripts.
 >
 > I'll move it out later.
 
 Here it is, on top of nd/http-fetch-shallow-fix because the new test
 in t5537 is picky and a simple merge resolution wouldn't do it.

 t/t5537-fetch-shallow.sh               | 57 -----------------------
 t/t5539-fetch-http-shallow.sh (new +x) | 82 ++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+), 57 deletions(-)

diff --git a/t/t5537-fetch-shallow.sh b/t/t5537-fetch-shallow.sh
index 098f220..3ae9092 100755
--- a/t/t5537-fetch-shallow.sh
+++ b/t/t5537-fetch-shallow.sh
@@ -173,61 +173,4 @@ EOF
 	)
 '
 
-if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then
-	say 'skipping remaining tests, git built without http support'
-	test_done
-fi
-
-. "$TEST_DIRECTORY"/lib-httpd.sh
-start_httpd
-
-test_expect_success 'clone http repository' '
-	git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-	git clone $HTTPD_URL/smart/repo.git clone &&
-	(
-	cd clone &&
-	git fsck &&
-	git log --format=%s origin/master >actual &&
-	cat <<EOF >expect &&
-7
-6
-5
-4
-3
-EOF
-	test_cmp expect actual
-	)
-'
-
-# This test is tricky. We need large enough "have"s that fetch-pack
-# will put pkt-flush in between. Then we need a "have" the server
-# does not have, it'll send "ACK %s ready"
-test_expect_success 'no shallow lines after receiving ACK ready' '
-	(
-		cd shallow &&
-		for i in $(test_seq 10)
-		do
-			git checkout --orphan unrelated$i &&
-			test_commit unrelated$i &&
-			git push -q "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
-				refs/heads/unrelated$i:refs/heads/unrelated$i &&
-			git push -q ../clone/.git \
-				refs/heads/unrelated$i:refs/heads/unrelated$i ||
-			exit 1
-		done &&
-		git checkout master &&
-		test_commit new &&
-		git push  "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" master
-	) &&
-	(
-		cd clone &&
-		git checkout --orphan newnew &&
-		test_commit new-too &&
-		GIT_TRACE_PACKET="$TRASH_DIRECTORY/trace" git fetch --depth=2 &&
-		grep "fetch-pack< ACK .* ready" ../trace &&
-		! grep "fetch-pack> done" ../trace
-	)
-'
-
-stop_httpd
 test_done
diff --git a/t/t5539-fetch-http-shallow.sh b/t/t5539-fetch-http-shallow.sh
new file mode 100755
index 0000000..94553e1
--- /dev/null
+++ b/t/t5539-fetch-http-shallow.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+test_description='fetch/clone from a shallow clone over http'
+
+. ./test-lib.sh
+
+if test -n "$NO_CURL"; then
+	skip_all='skipping test, git built without http support'
+	test_done
+fi
+
+. "$TEST_DIRECTORY"/lib-httpd.sh
+start_httpd
+
+commit() {
+	echo "$1" >tracked &&
+	git add tracked &&
+	git commit -m "$1"
+}
+
+test_expect_success 'setup shallow clone' '
+	commit 1 &&
+	commit 2 &&
+	commit 3 &&
+	commit 4 &&
+	commit 5 &&
+	commit 6 &&
+	commit 7 &&
+	git clone --no-local --depth=5 .git shallow &&
+	git config --global transfer.fsckObjects true
+'
+
+test_expect_success 'clone http repository' '
+	git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+	git clone $HTTPD_URL/smart/repo.git clone &&
+	(
+	cd clone &&
+	git fsck &&
+	git log --format=%s origin/master >actual &&
+	cat <<EOF >expect &&
+7
+6
+5
+4
+3
+EOF
+	test_cmp expect actual
+	)
+'
+
+# This test is tricky. We need large enough "have"s that fetch-pack
+# will put pkt-flush in between. Then we need a "have" the server
+# does not have, it'll send "ACK %s ready"
+test_expect_success 'no shallow lines after receiving ACK ready' '
+	(
+		cd shallow &&
+		for i in $(test_seq 15)
+		do
+			git checkout --orphan unrelated$i &&
+			test_commit unrelated$i &&
+			git push -q "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
+				refs/heads/unrelated$i:refs/heads/unrelated$i &&
+			git push -q ../clone/.git \
+				refs/heads/unrelated$i:refs/heads/unrelated$i ||
+			exit 1
+		done &&
+		git checkout master &&
+		test_commit new &&
+		git push  "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" master
+	) &&
+	(
+		cd clone &&
+		git checkout --orphan newnew &&
+		test_commit new-too &&
+		GIT_TRACE_PACKET="$TRASH_DIRECTORY/trace" git fetch --depth=2 &&
+		grep "fetch-pack< ACK .* ready" ../trace &&
+		! grep "fetch-pack> done" ../trace
+	)
+'
+
+stop_httpd
+test_done
-- 
1.8.5.2.240.g8478abd

  reply	other threads:[~2014-02-13 13:21 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 15:10 [PATCH 0/6] Fix the shallow deepen bug with no-done Nguyễn Thái Ngọc Duy
2014-02-06 15:10 ` [PATCH 1/6] test: rename http fetch and push test files Nguyễn Thái Ngọc Duy
2014-02-06 19:33   ` Jeff King
2014-02-06 15:10 ` [PATCH 2/6] t5538: fix default http port Nguyễn Thái Ngọc Duy
2014-02-06 19:35   ` Jeff King
2014-02-07 23:47     ` Jeff King
2014-02-08  7:36       ` Duy Nguyen
2014-02-10 14:39         ` Jeff King
2014-02-10 18:23           ` Junio C Hamano
2014-02-10 19:15             ` Jeff King
2014-02-10 19:16               ` Jeff King
2014-02-10 21:29               ` [PATCH] tests: turn on network daemon tests by default Jeff King
2014-02-11 19:51                 ` Junio C Hamano
2014-02-11 20:04                   ` Jeff King
2014-02-11 23:58                     ` Junio C Hamano
2014-02-12 21:47                       ` Jeff King
2014-02-12 22:34                         ` Junio C Hamano
2014-02-13 19:35                           ` Junio C Hamano
2014-02-14  9:58                             ` Jeff King
2014-02-14 16:13                               ` Junio C Hamano
2014-02-12 19:06                     ` Junio C Hamano
2014-02-12 22:12                       ` Jeff King
2014-02-13  1:22                         ` Duy Nguyen
2014-02-13 13:21                           ` Nguyễn Thái Ngọc Duy [this message]
2014-02-13 20:14                             ` [PATCH] t5537: move http tests out to t5539 Junio C Hamano
2014-02-06 15:10 ` [PATCH 3/6] pack-protocol.txt: clarify 'obj-id' in the last ACK after 'done' Nguyễn Thái Ngọc Duy
2014-02-06 18:54   ` Junio C Hamano
2014-02-06 15:10 ` [PATCH 4/6] protocol-capabilities.txt: refer multi_ack_detailed back to pack-protocol.txt Nguyễn Thái Ngọc Duy
2014-02-06 15:10 ` [PATCH 5/6] protocol-capabilities.txt: document no-done Nguyễn Thái Ngọc Duy
2014-02-06 18:55   ` Junio C Hamano
2014-02-06 19:40   ` Jeff King
2014-02-06 15:10 ` [PATCH 6/6] fetch-pack: fix deepen shallow over smart http with no-done cap Nguyễn Thái Ngọc Duy
2014-02-06 19:16   ` Junio C Hamano
2014-02-07  0:52     ` Duy Nguyen
2014-02-06 19:35   ` Eric Sunshine
2014-02-06 19:42   ` Jeff King
2014-02-07 18:01   ` Junio C Hamano
2014-02-07 23:39     ` Duy Nguyen
2014-02-10 18:18       ` Junio C Hamano
2014-02-06 19:31 ` [PATCH 0/6] Fix the shallow deepen bug with no-done Junio C Hamano
2014-02-06 19:44   ` Jeff King
2014-02-07  0:47   ` Duy Nguyen
2014-02-07 19:20     ` Jonathan Nieder
2014-02-07 20:03       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392297674-4291-1-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).