mirror of
https://github.com/git/git.git
synced 2026-03-13 18:33:25 +01:00
t5303: Do not use /dev/zero
We do not have /dev/zero on Windows. As a work-around we use a file with a single NUL byte (because that's all that the tests need). Signed-off-by: Johannes Sixt <j6t@kdbg.org>
This commit is contained in:
@@ -41,12 +41,6 @@ create_new_pack() {
|
||||
git verify-pack -v ${pack}.pack
|
||||
}
|
||||
|
||||
zeros () {
|
||||
while :; do
|
||||
echo -n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
done | tr x '\0'
|
||||
}
|
||||
|
||||
do_repack() {
|
||||
pack=`printf "$blob_1\n$blob_2\n$blob_3\n" |
|
||||
git pack-objects $@ .git/objects/pack/pack` &&
|
||||
@@ -61,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 &&
|
||||
@@ -72,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'
|
||||
@@ -131,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'
|
||||
@@ -186,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'
|
||||
@@ -213,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'
|
||||
@@ -265,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 &&
|
||||
|
||||
Reference in New Issue
Block a user