@matheusbsbs / matheus-bagliano / commits / c97451ce09
Fork 0

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>

Junio C Hamano committed Dec 26, 2005 at 18:23 UTC c97451ce0985e7fc6515cde84a9ad527727b69ea
1 file changed +7 -1
t/t5300-pack-object.sh
+7 -1
@@ -142,6 +142,7 @@ test_expect_success \
142 else :;
143 fi &&
144
145 + : PACK_SIGNATURE &&
146 cp test-1-${packname_1}.pack test-3.pack &&
147 dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=2 &&
148 if git-verify-pack test-3.idx
@@ -149,6 +150,7 @@ test_expect_success \
150 else :;
151 fi &&
152
153 + : PACK_VERSION &&
154 cp test-1-${packname_1}.pack test-3.pack &&
155 dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=7 &&
156 if git-verify-pack test-3.idx
@@ -156,6 +158,7 @@ test_expect_success \
158 else :;
159 fi &&
160
161 + : TYPE/SIZE byte of the first packed object data &&
162 cp test-1-${packname_1}.pack test-3.pack &&
163 dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=12 &&
164 if git-verify-pack test-3.idx
@@ -163,8 +166,11 @@ test_expect_success \
166 else :;
167 fi &&
168
169 + : sum of the index file itself &&
170 + l=`wc -c <test-3.idx` &&
171 + l=`expr "$l" - 20` &&
172 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 &&
174 if git-verify-pack test-3.pack
175 then false
176 else :;