Add an (optional, since expensive) test for >2gb clones
Define GIT_TEST_CLONE_2GB=t if you want the test not to be skipped. The test works by constructing a repository larger than 2gb, and then cloning it. The repository is forced larger than 2gb by setting compression and delta depth to zero, and then adding just enough unique objects of a given size. The objects consist of a running decimal number in ASCII, padded by spaces. Should that break in the future, e.g. when pack v4 becomes default, there is a commented-out call to test-genrandom which can be substituted, but that uses more cycles than the current method. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Mar 6, 2009 at 10:48 UTC
ca31f0b5c2fe379324920094ef1d242dce062737
1 file changed
+45
t/t5705-clone-2gb.sh
new
+45
@@ -0,0 +1,45 @@
1
+#!/bin/sh
2
+
3
+test_description='Test cloning a repository larger than 2 gigabyte'
4
+. ./test-lib.sh
5
+
6
+test -z "$GIT_TEST_CLONE_2GB" &&
7
+say "Skipping expensive 2GB clone test; enable it with GIT_TEST_CLONE_2GB=t" &&
8
+test_done &&
9
+exit
10
+
11
+test_expect_success 'setup' '
12
+
13
+ git config pack.compression 0 &&
14
+ git config pack.depth 0 &&
15
+ blobsize=$((20*1024*1024)) &&
16
+ blobcount=$((2*1024*1024*1024/$blobsize+1)) &&
17
+ i=1 &&
18
+ (while test $i -le $blobcount
19
+ do
20
+ printf "Generating blob $i/$blobcount\r" >&2 &&
21
+ printf "blob\nmark :$i\ndata $blobsize\n" &&
22
+ #test-genrandom $i $blobsize &&
23
+ printf "%-${blobsize}s" $i &&
24
+ echo "M 100644 :$i $i" >> commit
25
+ i=$(($i+1)) ||
26
+ echo $? > exit-status
27
+ done &&
28
+ echo "commit refs/heads/master" &&
29
+ echo "author A U Thor <author@email.com> 123456789 +0000" &&
30
+ echo "committer C O Mitter <committer@email.com> 123456789 +0000" &&
31
+ echo "data 5" &&
32
+ echo ">2gb" &&
33
+ cat commit) |
34
+ git fast-import &&
35
+ test ! -f exit-status
36
+
37
+'
38
+
39
+test_expect_success 'clone' '
40
+
41
+ git clone --bare --no-hardlinks . clone
42
+
43
+'
44
+
45
+test_done