Skip to content

Commit d0a042a

Browse files
j6tgitster
authored andcommitted
t1050-large: generate large files without dd
For some unknown reason, the dd on my Windows box segfaults randomly, but since recently, it does so much more often than it used to, which makes running the test suite burdensome. Use printf to write large files instead of dd. To emphasize that three of the large blobs are exact copies, use cp to allocate them. The new code makes the files a bit smaller, and they are not sparse anymore, but the tests do not depend on these properties. We do not want to use test-genrandom here (which is used to generate large files elsewhere in t1050), so that the files can be compressed well (which keeps the run-time short). The files are now large text files, not binary files. But since they are larger than core.bigfilethreshold they are diagnosed as binary by Git. For this reason, the 'git diff' tests that check the output for "Binary files differ" still pass. Signed-off-by: Johannes Sixt <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fdf96a2 commit d0a042a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

t/t1050-large.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ test_expect_success setup '
99
# clone does not allow us to pass core.bigfilethreshold to
1010
# new repos, so set core.bigfilethreshold globally
1111
git config --global core.bigfilethreshold 200k &&
12-
echo X | dd of=large1 bs=1k seek=2000 &&
13-
echo X | dd of=large2 bs=1k seek=2000 &&
14-
echo X | dd of=large3 bs=1k seek=2000 &&
15-
echo Y | dd of=huge bs=1k seek=2500 &&
12+
printf "%2000000s" X >large1 &&
13+
cp large1 large2 &&
14+
cp large1 large3 &&
15+
printf "%2500000s" Y >huge &&
1616
GIT_ALLOC_LIMIT=1500k &&
1717
export GIT_ALLOC_LIMIT
1818
'
@@ -61,7 +61,7 @@ test_expect_success 'checkout a large file' '
6161
large1=$(git rev-parse :large1) &&
6262
git update-index --add --cacheinfo 100644 $large1 another &&
6363
git checkout another &&
64-
cmp large1 another ;# this must not be test_cmp
64+
test_cmp large1 another
6565
'
6666

6767
test_expect_success 'packsize limit' '
@@ -162,7 +162,7 @@ test_expect_success 'pack-objects with large loose object' '
162162
test_create_repo packed &&
163163
mv pack-* packed/.git/objects/pack &&
164164
GIT_DIR=packed/.git git cat-file blob $SHA1 >actual &&
165-
cmp huge actual
165+
test_cmp huge actual
166166
'
167167

168168
test_expect_success 'tar achiving' '

0 commit comments

Comments
 (0)