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

Update tests not to assume that generated packfiles are writable.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Apr 22, 2007 at 18:59 UTC a5878961b14c1b4f6d1d08c0d3a2f5234659fb8a
1 file changed +11 -11
t/t5300-pack-object.sh
+11 -11
@@ -152,7 +152,7 @@ test_expect_success \
152 'use packed deltified (REF_DELTA) objects' \
153 'GIT_OBJECT_DIRECTORY=.git2/objects &&
154 export GIT_OBJECT_DIRECTORY &&
155 - rm .git2/objects/pack/test-* &&
155 + rm -f .git2/objects/pack/test-* &&
156 cp test-2-${packname_2}.pack test-2-${packname_2}.idx .git2/objects/pack && {
157 git-diff-tree --root -p $commit &&
158 while read object
@@ -167,7 +167,7 @@ test_expect_success \
167 'use packed deltified (OFS_DELTA) objects' \
168 'GIT_OBJECT_DIRECTORY=.git2/objects &&
169 export GIT_OBJECT_DIRECTORY &&
170 - rm .git2/objects/pack/test-* &&
170 + rm -f .git2/objects/pack/test-* &&
171 cp test-3-${packname_3}.pack test-3-${packname_3}.idx .git2/objects/pack && {
172 git-diff-tree --root -p $commit &&
173 while read object
@@ -188,15 +188,15 @@ test_expect_success \
188
189 test_expect_success \
190 'corrupt a pack and see if verify catches' \
191 - 'cp test-1-${packname_1}.idx test-3.idx &&
192 - cp test-2-${packname_2}.pack test-3.pack &&
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 &&
197
198 : PACK_SIGNATURE &&
199 - cp test-1-${packname_1}.pack test-3.pack &&
199 + cat test-1-${packname_1}.pack >test-3.pack &&
200 dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=2 &&
201 if git-verify-pack test-3.idx
202 then false
@@ -204,7 +204,7 @@ test_expect_success \
204 fi &&
205
206 : PACK_VERSION &&
207 - cp test-1-${packname_1}.pack test-3.pack &&
207 + cat test-1-${packname_1}.pack >test-3.pack &&
208 dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=7 &&
209 if git-verify-pack test-3.idx
210 then false
@@ -212,7 +212,7 @@ test_expect_success \
212 fi &&
213
214 : TYPE/SIZE byte of the first packed object data &&
215 - cp test-1-${packname_1}.pack test-3.pack &&
215 + cat test-1-${packname_1}.pack >test-3.pack &&
216 dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=12 &&
217 if git-verify-pack test-3.idx
218 then false
@@ -222,7 +222,7 @@ test_expect_success \
222 : sum of the index file itself &&
223 l=`wc -c <test-3.idx` &&
224 l=`expr $l - 20` &&
225 - cp test-1-${packname_1}.pack test-3.pack &&
225 + cat test-1-${packname_1}.pack >test-3.pack &&
226 dd if=/dev/zero of=test-3.idx count=20 bs=1 conv=notrunc seek=$l &&
227 if git-verify-pack test-3.pack
228 then false
@@ -233,21 +233,21 @@ test_expect_success \
233
234 test_expect_success \
235 'build pack index for an existing pack' \
236 - 'cp test-1-${packname_1}.pack test-3.pack &&
236 + 'cat test-1-${packname_1}.pack >test-3.pack &&
237 git-index-pack -o tmp.idx test-3.pack &&
238 cmp tmp.idx test-1-${packname_1}.idx &&
239
240 git-index-pack test-3.pack &&
241 cmp test-3.idx test-1-${packname_1}.idx &&
242
243 - cp test-2-${packname_2}.pack test-3.pack &&
243 + cat test-2-${packname_2}.pack >test-3.pack &&
244 git-index-pack -o tmp.idx test-2-${packname_2}.pack &&
245 cmp tmp.idx test-2-${packname_2}.idx &&
246
247 git-index-pack test-3.pack &&
248 cmp test-3.idx test-2-${packname_2}.idx &&
249
250 - cp test-3-${packname_3}.pack test-3.pack &&
250 + cat test-3-${packname_3}.pack >test-3.pack &&
251 git-index-pack -o tmp.idx test-3-${packname_3}.pack &&
252 cmp tmp.idx test-3-${packname_3}.idx &&
253