summaryrefslogtreecommitdiff
path: root/t/t5303-pack-corruption-resilience.sh
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2008-11-17 08:21:30 (GMT)
committerJohannes Sixt <j6t@kdbg.org>2009-03-19 20:47:15 (GMT)
commitb689ccf6c9eecb9811f60ac69a24cadacf84da44 (patch)
treefffaa869f99fb65e0d2836aeba82e02992f2e459 /t/t5303-pack-corruption-resilience.sh
parent0aaaef7b0f83ccd97d586b5c951adcb912af2664 (diff)
downloadgit-b689ccf6c9eecb9811f60ac69a24cadacf84da44.zip
git-b689ccf6c9eecb9811f60ac69a24cadacf84da44.tar.gz
git-b689ccf6c9eecb9811f60ac69a24cadacf84da44.tar.bz2
t5300, t5302, t5303: Do not use /dev/zero
We do not have /dev/zero on Windows. This replaces it by data generated with printf, perl, or echo. Most of the cases do not depend on that the data is a stream of zero bytes, so we use something printable; nor is an unlimited stream of data needed, so we produce only as many bytes as the test cases need. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Diffstat (limited to 't/t5303-pack-corruption-resilience.sh')
-rwxr-xr-xt/t5303-pack-corruption-resilience.sh12
1 files changed, 7 insertions, 5 deletions
diff --git a/t/t5303-pack-corruption-resilience.sh b/t/t5303-pack-corruption-resilience.sh
index d4e30fc..5132d41 100755
--- a/t/t5303-pack-corruption-resilience.sh
+++ b/t/t5303-pack-corruption-resilience.sh
@@ -55,6 +55,8 @@ do_corrupt_object() {
test_must_fail git verify-pack ${pack}.pack
}
+printf '\0' > zero
+
test_expect_success \
'initial setup validation' \
'create_test_files &&
@@ -66,7 +68,7 @@ test_expect_success \
test_expect_success \
'create corruption in header of first object' \
- 'do_corrupt_object $blob_1 0 < /dev/zero &&
+ 'do_corrupt_object $blob_1 0 < zero &&
test_must_fail git cat-file blob $blob_1 > /dev/null &&
test_must_fail git cat-file blob $blob_2 > /dev/null &&
test_must_fail git cat-file blob $blob_3 > /dev/null'
@@ -125,7 +127,7 @@ test_expect_success \
'create corruption in header of first delta' \
'create_new_pack &&
git prune-packed &&
- do_corrupt_object $blob_2 0 < /dev/zero &&
+ do_corrupt_object $blob_2 0 < zero &&
git cat-file blob $blob_1 > /dev/null &&
test_must_fail git cat-file blob $blob_2 > /dev/null &&
test_must_fail git cat-file blob $blob_3 > /dev/null'
@@ -180,7 +182,7 @@ test_expect_success \
'corruption in delta base reference of first delta (OBJ_REF_DELTA)' \
'create_new_pack &&
git prune-packed &&
- do_corrupt_object $blob_2 2 < /dev/zero &&
+ do_corrupt_object $blob_2 2 < zero &&
git cat-file blob $blob_1 > /dev/null &&
test_must_fail git cat-file blob $blob_2 > /dev/null &&
test_must_fail git cat-file blob $blob_3 > /dev/null'
@@ -207,7 +209,7 @@ test_expect_success \
'corruption #0 in delta base reference of first delta (OBJ_OFS_DELTA)' \
'create_new_pack --delta-base-offset &&
git prune-packed &&
- do_corrupt_object $blob_2 2 < /dev/zero &&
+ do_corrupt_object $blob_2 2 < zero &&
git cat-file blob $blob_1 > /dev/null &&
test_must_fail git cat-file blob $blob_2 > /dev/null &&
test_must_fail git cat-file blob $blob_3 > /dev/null'
@@ -259,7 +261,7 @@ test_expect_success \
test_expect_success \
'... and a redundant pack allows for full recovery too' \
- 'do_corrupt_object $blob_2 2 < /dev/zero &&
+ 'do_corrupt_object $blob_2 2 < zero &&
git cat-file blob $blob_1 > /dev/null &&
test_must_fail git cat-file blob $blob_2 > /dev/null &&
test_must_fail git cat-file blob $blob_3 > /dev/null &&