git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: <git@vger.kernel.org>
Cc: Derrick Stolee <dstolee@microsoft.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 15/20] t5530: compute results based on object length
Date: Sat, 21 Dec 2019 19:49:31 +0000	[thread overview]
Message-ID: <20191221194936.1346664-16-sandals@crustytoothpaste.net> (raw)
In-Reply-To: <20191221194936.1346664-1-sandals@crustytoothpaste.net>

Compute the various pkt-line values based on the length of the object
IDs in use.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 t/t5530-upload-pack-error.sh | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh
index a1d3031d40..4ce9a9f704 100755
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -14,7 +14,7 @@ corrupt_repo () {
 }
 
 test_expect_success 'setup and corrupt repository' '
-
+	test_oid_init &&
 	echo file >file &&
 	git add file &&
 	git rev-parse :file &&
@@ -31,9 +31,10 @@ test_expect_success 'fsck fails' '
 '
 
 test_expect_success 'upload-pack fails due to error in pack-objects packing' '
-
-	printf "0032want %s\n00000009done\n0000" \
-		$(git rev-parse HEAD) >input &&
+	head=$(git rev-parse HEAD) &&
+	hexsz=$(test_oid hexsz) &&
+	printf "%04xwant %s\n00000009done\n0000" \
+		$(($hexsz + 10)) $head >input &&
 	test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
 	test_i18ngrep "unable to read" output.err &&
 	test_i18ngrep "pack-objects died" output.err
@@ -51,16 +52,17 @@ test_expect_success 'fsck fails' '
 '
 test_expect_success 'upload-pack fails due to error in rev-list' '
 
-	printf "0032want %s\n0034shallow %s00000009done\n0000" \
-		$(git rev-parse HEAD) $(git rev-parse HEAD^) >input &&
+	printf "%04xwant %s\n%04xshallow %s00000009done\n0000" \
+		$(($hexsz + 10)) $(git rev-parse HEAD) \
+		$(($hexsz + 12)) $(git rev-parse HEAD^) >input &&
 	test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
 	grep "bad tree object" output.err
 '
 
 test_expect_success 'upload-pack fails due to bad want (no object)' '
 
-	printf "0045want %s multi_ack_detailed\n00000009done\n0000" \
-		"deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" >input &&
+	printf "%04xwant %s multi_ack_detailed\n00000009done\n0000" \
+		$(($hexsz + 29)) $(test_oid deadbeef) >input &&
 	test_must_fail git upload-pack . <input >output 2>output.err &&
 	grep "not our ref" output.err &&
 	grep "ERR" output &&
@@ -70,8 +72,8 @@ test_expect_success 'upload-pack fails due to bad want (no object)' '
 test_expect_success 'upload-pack fails due to bad want (not tip)' '
 
 	oid=$(echo an object we have | git hash-object -w --stdin) &&
-	printf "0045want %s multi_ack_detailed\n00000009done\n0000" \
-		"$oid" >input &&
+	printf "%04xwant %s multi_ack_detailed\n00000009done\n0000" \
+		$(($hexsz + 29)) "$oid" >input &&
 	test_must_fail git upload-pack . <input >output 2>output.err &&
 	grep "not our ref" output.err &&
 	grep "ERR" output &&
@@ -80,8 +82,8 @@ test_expect_success 'upload-pack fails due to bad want (not tip)' '
 
 test_expect_success 'upload-pack fails due to error in pack-objects enumeration' '
 
-	printf "0032want %s\n00000009done\n0000" \
-		$(git rev-parse HEAD) >input &&
+	printf "%04xwant %s\n00000009done\n0000" \
+		$((hexsz + 10)) $(git rev-parse HEAD) >input &&
 	test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
 	grep "bad tree object" output.err &&
 	grep "pack-objects died" output.err

  parent reply	other threads:[~2019-12-21 19:50 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-21 19:49 [PATCH 00/20] SHA-256 test fixes, part 7 brian m. carlson
2019-12-21 19:49 ` [PATCH 01/20] t4054: make hash-size independent brian m. carlson
2019-12-21 19:49 ` [PATCH 02/20] t4066: compute index line in diffs brian m. carlson
2019-12-21 19:49 ` [PATCH 03/20] t4134: compute appropriate length constant brian m. carlson
2019-12-21 19:49 ` [PATCH 04/20] t4200: make hash size independent brian m. carlson
2019-12-21 19:49 ` [PATCH 05/20] t4202: abstract away SHA-1-specific constants brian m. carlson
2019-12-21 19:49 ` [PATCH 06/20] t4204: make hash size independent brian m. carlson
2019-12-21 19:49 ` [PATCH 07/20] t4300: abstract away SHA-1-specific constants brian m. carlson
2019-12-21 19:49 ` [PATCH 08/20] t5318: update for SHA-256 brian m. carlson
2019-12-21 19:49 ` [PATCH 09/20] t5319: change invalid offset for SHA-256 compatibility brian m. carlson
2019-12-26 14:36   ` Derrick Stolee
2019-12-21 19:49 ` [PATCH 10/20] t5319: make test work with SHA-256 brian m. carlson
2019-12-22  0:06   ` Eric Sunshine
2019-12-22 17:47     ` brian m. carlson
2019-12-23  1:25       ` Michael Clark
2019-12-26 14:50   ` Derrick Stolee
2019-12-27 21:35     ` brian m. carlson
2019-12-21 19:49 ` [PATCH 11/20] t5324: make hash size independent brian m. carlson
2019-12-21 19:49 ` [PATCH 12/20] t5504: make hash algorithm independent brian m. carlson
2019-12-21 19:49 ` [PATCH 13/20] t5510: make hash size independent brian m. carlson
2019-12-21 19:49 ` [PATCH 14/20] t5512: abstract away SHA-1-specific constants brian m. carlson
2019-12-21 19:49 ` brian m. carlson [this message]
2019-12-21 19:49 ` [PATCH 16/20] t5537: make hash size independent brian m. carlson
2019-12-21 19:49 ` [PATCH 17/20] t5540: " brian m. carlson
2019-12-21 19:49 ` [PATCH 18/20] t5562: use $ZERO_OID brian m. carlson
2019-12-21 19:49 ` [PATCH 19/20] t5601: switch into repository to hash object brian m. carlson
2019-12-21 19:49 ` [PATCH 20/20] t5604: make hash independent brian m. carlson
2019-12-26 14:51 ` [PATCH 00/20] SHA-256 test fixes, part 7 Derrick Stolee

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=20191221194936.1346664-16-sandals@crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).