t5302-pack-index: Skip tests of 64-bit offsets if necessary.
There are platforms where off_t is not 64 bits wide. In this case many tests are doomed to fail. Let's skip them. 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
8ed2fca458d085f12c3c6808ef4ddab6aa40ef14
1 file changed
+23
-2
t/t5302-pack-index.sh
+23
-2
@@ -61,17 +61,33 @@ test_expect_success \
61
62
test_expect_success \
63
'index v2: force some 64-bit offsets with pack-objects' \
64
- 'pack3=$(git pack-objects --index-version=2,0x40000 test-3 <obj-list) &&
65
- git verify-pack -v "test-3-${pack3}.pack"'
64
+ 'pack3=$(git pack-objects --index-version=2,0x40000 test-3 <obj-list)'
65
+
66
+have_64bits=
67
+if msg=$(git verify-pack -v "test-3-${pack3}.pack" 2>&1) ||
68
+ ! echo "$msg" | grep "pack too large .* off_t"
69
+then
70
+ have_64bits=t
71
+else
72
+ say "skipping tests concerning 64-bit offsets"
73
+fi
74
+
75
+test "$have_64bits" &&
76
+test_expect_success \
77
+ 'index v2: verify a pack with some 64-bit offsets' \
78
+ 'git verify-pack -v "test-3-${pack3}.pack"'
79
80
+test "$have_64bits" &&
81
test_expect_failure \
82
'64-bit offsets: should be different from previous index v2 results' \
83
'cmp "test-2-${pack2}.idx" "test-3-${pack3}.idx"'
84
85
+test "$have_64bits" &&
86
test_expect_success \
87
'index v2: force some 64-bit offsets with index-pack' \
88
'git-index-pack --index-version=2,0x40000 -o 3.idx "test-1-${pack1}.pack"'
89
90
+test "$have_64bits" &&
91
test_expect_success \
92
'64-bit offsets: index-pack result should match pack-objects one' \
93
'cmp "test-3-${pack3}.idx" "3.idx"'
@@ -113,6 +129,7 @@ test_expect_failure \
129
'[index v1] 6) newly created pack is BAD !' \
130
'git verify-pack -v "test-4-${pack1}.pack"'
131
132
+test "$have_64bits" &&
133
test_expect_success \
134
'[index v2] 1) stream pack to repository' \
135
'rm -f .git/objects/pack/* &&
@@ -122,6 +139,7 @@ test_expect_success \
139
cmp "test-1-${pack1}.pack" ".git/objects/pack/pack-${pack1}.pack" &&
140
cmp "test-3-${pack1}.idx" ".git/objects/pack/pack-${pack1}.idx"'
141
142
+test "$have_64bits" &&
143
test_expect_success \
144
'[index v2] 2) create a stealth corruption in a delta base reference' \
145
'# this test assumes a delta smaller than 16 bytes at the end of the pack
@@ -134,14 +152,17 @@ test_expect_success \
152
bs=1 count=20 conv=notrunc &&
153
git cat-file blob "$delta_sha1" > blob_4 )'
154
155
+test "$have_64bits" &&
156
test_expect_failure \
157
'[index v2] 3) corrupted delta happily returned wrong data' \
158
'cmp blob_3 blob_4'
159
160
+test "$have_64bits" &&
161
test_expect_failure \
162
'[index v2] 4) confirm that the pack is actually corrupted' \
163
'git fsck --full $commit'
164
165
+test "$have_64bits" &&
166
test_expect_failure \
167
'[index v2] 5) pack-objects refuses to reuse corrupted data' \
168
'git pack-objects test-5 <obj-list'