Skip to content

Commit c97451c

Browse files
author
Junio C Hamano
committed
t5300: avoid false failures.
Johannes found that the test has 1/256 chance of falsely producing an uncorrupted idx file, causing the check to detect corruption fail. Now we have 1/2^160 chance of false failure ;-). Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 7e4a2a8 commit c97451c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

t/t5300-pack-object.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,29 +142,35 @@ test_expect_success \
142142
else :;
143143
fi &&
144144
145+
: PACK_SIGNATURE &&
145146
cp test-1-${packname_1}.pack test-3.pack &&
146147
dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=2 &&
147148
if git-verify-pack test-3.idx
148149
then false
149150
else :;
150151
fi &&
151152
153+
: PACK_VERSION &&
152154
cp test-1-${packname_1}.pack test-3.pack &&
153155
dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=7 &&
154156
if git-verify-pack test-3.idx
155157
then false
156158
else :;
157159
fi &&
158160
161+
: TYPE/SIZE byte of the first packed object data &&
159162
cp test-1-${packname_1}.pack test-3.pack &&
160163
dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=12 &&
161164
if git-verify-pack test-3.idx
162165
then false
163166
else :;
164167
fi &&
165168
169+
: sum of the index file itself &&
170+
l=`wc -c <test-3.idx` &&
171+
l=`expr "$l" - 20` &&
166172
cp test-1-${packname_1}.pack test-3.pack &&
167-
dd if=/dev/zero of=test-3.idx count=1 bs=1 conv=notrunc seek=1200 &&
173+
dd if=/dev/zero of=test-3.idx count=20 bs=1 conv=notrunc seek=$l &&
168174
if git-verify-pack test-3.pack
169175
then false
170176
else :;

0 commit comments

Comments
 (0)