[PATCH] Add failing test: "fsck survives inflate errors"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While inflate errors are obviously NOT GOOD, and should perhaps be
fatal for most commands, git fsck is something of a special case
because it is useful to have *it* report as many corrupt objects as
possible in one run.

Signed-off-by: Samuel Bronson <naesten@xxxxxxxxx>
---
 t/t1450-fsck.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 8c739c9..6dcc4b2 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -53,6 +53,23 @@ test_expect_success 'setup: helpers for corruption tests' '
 	}
 '
 
+# git fsck should be able to detect more than one corrupt object per run
+test_expect_failure 'fsck survives inflate errors' '
+	hash1=ffffffffffffffffffffffffffffffffffffffff &&
+	hash2=fffffffffffffffffffffffffffffffffffffffe &&
+	mkdir -p .git/objects/ff &&
+	echo not-zlib >$(sha1_file $hash1) &&
+	test_when_finished "remove_object $hash1" &&
+	echo not-zlib >$(sha1_file $hash2) &&
+	test_when_finished "remove_object $hash2" &&
+
+	# Return value is not documented
+	test_might_fail git fsck 2>out &&
+	cat out && echo ====== &&
+	grep "$hash1.*corrupt" out &&
+	grep "$hash2.*corrupt" out
+'
+
 test_expect_success 'object with bad sha1' '
 	sha=$(echo blob | git hash-object -w --stdin) &&
 	old=$(echo $sha | sed "s+^..+&/+") &&
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]