git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t5530-upload-pack-error: Check more carefully for failures.

From
Johannes Sixt <johannes.sixt@telecom.at>
Date
Nov 5, 2007, 21:40 UTC
Message-ID
<200711052240.12822.johannes.sixt@telecom.at>
In-Reply-To
<7v3avkqwyz.fsf@gitster.siamese.dyndns.org>

Previously, the test only triggered a failure in upload-pack's rev-list subprocess. Here we also test for a failure of pack-objects, and make sure that the right process failed.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
  On Monday 05 November 2007 21:05, Junio C Hamano wrote:
  > > 	The test case checks for failures in rev-list (a missing
  > > 	object). Any hints how to trigger a failure in pack-objects
  > > 	that does not also trigger in rev-list would be welcome.
  >
  > How about removing a blob from the test repository  to corrupt
  > it?  rev-list --objects I think would happily list the blob
  > because it sees its name in its containing tree without checking
  > its existence.
  That does it. This goes on top of my previous patch.
  -- Hannes
 t/t5530-upload-pack-error.sh |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh
index 9923ba0..70d4f86 100755
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -15,7 +15,7 @@ test_expect_success 'setup and corrupt repository' '
 	test_tick &&
 	echo changed >file &&
 	git commit -a -m changed &&
-	rm -f .git/objects/f7/3f3093ff865c514c6c51f867e35f693487d0d3
+	rm -f .git/objects/5e/a2ed416fbd4a4cbe227b75fe255dd7fa6bd4d6
 
 '
 
@@ -24,14 +24,33 @@ test_expect_failure 'fsck fails' '
 	git fsck
 '
 
-test_expect_failure 'upload pack fails due to error in rev-list' '
+test_expect_success 'upload-pack fails due to error in pack-objects' '
 
-	echo "0032want $(git rev-parse HEAD)
+	! echo "0032want $(git rev-parse HEAD)
 00000009done
-0000" | git-upload-pack . > /dev/null
+0000" | git-upload-pack . > /dev/null 2> output.err &&
+	grep "pack-objects died" output.err
+'
+
+test_expect_success 'corrupt repo differently' '
+
+	git hash-object -w file &&
+	rm -f .git/objects/be/c63e37d08c454ad3a60cde90b70f3f7d077852
 
 '
 
+test_expect_failure 'fsck fails' '
+
+	git fsck
+'
+test_expect_success 'upload-pack fails due to error in rev-list' '
+
+	! echo "0032want $(git rev-parse HEAD)
+00000009done
+0000" | git-upload-pack . > /dev/null 2> output.err &&
+	grep "waitpid (async) failed" output.err
+'
+
 test_expect_success 'create empty repository' '
 
 	mkdir foo &&
-- 
1.5.3.4.315.g2ce38
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 5 in “upload-pack: Use finish_{command,async}() instead of waitpid().”
  1. upload-pack: Use finish_{command,async}() instead of waitpid().Johannes Sixt, Nov 4, 2007
  2. Michael J. CohenNov 5, 2007
  3. Junio C HamanoNov 5, 2007
  4. t5530-upload-pack-error: Check more carefully for failures.Johannes Sixt, Nov 5, 2007
  5. Junio C HamanoNov 6, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.