@matheusbsbs / matheus-bagliano / commits / 63405283c3
Fork 0

t5300-pack-object.sh: Split the big verify-pack test into smaller parts.

This makes it easier to spot which of the tests failed. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Sixt committed Nov 13, 2007 at 21:04 UTC 63405283c3c6c55cca465ba21128ec1b354ee799
1 file changed +18 -16
t/t5300-pack-object.sh
+18 -16
@@ -187,49 +187,51 @@ test_expect_success \
187 test-3-${packname_3}.idx'
188
189 test_expect_success \
190 - 'corrupt a pack and see if verify catches' \
190 + 'verify-pack catches mismatched .idx and .pack files' \
191 'cat test-1-${packname_1}.idx >test-3.idx &&
192 cat test-2-${packname_2}.pack >test-3.pack &&
193 if git verify-pack test-3.idx
194 then false
195 else :;
196 - fi &&
196 + fi'
197
198 - : PACK_SIGNATURE &&
199 - cat test-1-${packname_1}.pack >test-3.pack &&
198 +test_expect_success \
199 + 'verify-pack catches a corrupted pack signature' \
200 + 'cat test-1-${packname_1}.pack >test-3.pack &&
201 dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=2 &&
202 if git verify-pack test-3.idx
203 then false
204 else :;
204 - fi &&
205 + fi'
206
206 - : PACK_VERSION &&
207 - cat test-1-${packname_1}.pack >test-3.pack &&
207 +test_expect_success \
208 + 'verify-pack catches a corrupted pack version' \
209 + 'cat test-1-${packname_1}.pack >test-3.pack &&
210 dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=7 &&
211 if git verify-pack test-3.idx
212 then false
213 else :;
212 - fi &&
214 + fi'
215
214 - : TYPE/SIZE byte of the first packed object data &&
215 - cat test-1-${packname_1}.pack >test-3.pack &&
216 +test_expect_success \
217 + 'verify-pack catches a corrupted type/size of the 1st packed object data' \
218 + 'cat test-1-${packname_1}.pack >test-3.pack &&
219 dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=12 &&
220 if git verify-pack test-3.idx
221 then false
222 else :;
220 - fi &&
223 + fi'
224
222 - : sum of the index file itself &&
223 - l=`wc -c <test-3.idx` &&
225 +test_expect_success \
226 + 'verify-pack catches a corrupted sum of the index file itself' \
227 + 'l=`wc -c <test-3.idx` &&
228 l=`expr $l - 20` &&
229 cat test-1-${packname_1}.pack >test-3.pack &&
230 dd if=/dev/zero of=test-3.idx count=20 bs=1 conv=notrunc seek=$l &&
231 if git verify-pack test-3.pack
232 then false
233 else :;
230 - fi &&
231 -
232 - :'
234 + fi'
235
236 test_expect_success \
237 'build pack index for an existing pack' \