vcs-svn: Limit bytes read and written strictly
[git/barrbrain.git] / t / t9010-svn-fe.sh
blob7349d4e3816cf2d642f20a0e2039f43dcfc4548a
1 #!/bin/sh
3 test_description='check svn dumpfile importer'
5 . ./test-lib.sh
7 svnfe_bin=$GIT_EXEC_PATH/contrib/svn-fe/svn-fe
8 svnda_bin=$GIT_EXEC_PATH/contrib/svn-fe/svn-da
9 svnconf=$PWD/svnconf
10 export svnconf
12 svn_cmd () {
13 [ -d "$svnconf" ] || mkdir "$svnconf"
14 orig_svncmd="$1"; shift
15 if [ -z "$orig_svncmd" ]; then
16 svn
17 return
19 svn "$orig_svncmd" --config-dir "$svnconf" "$@"
22 test_parse() {
23 diff0=$1
24 source=$2
25 expected=$3
26 postsize=`wc -c < "$TEST_DIRECTORY/$expected"`
27 presize=`wc -c < "$TEST_DIRECTORY/$source"`
28 diffsize=`wc -c < "$TEST_DIRECTORY/$diff0"`
29 test_expect_success SVNDA "$diff0" '
30 $svnda_bin "$TEST_DIRECTORY/$diff0" "$postsize" "$presize" "$diffsize" <"$TEST_DIRECTORY/$source" >actual &&
31 test_cmp "$TEST_DIRECTORY/$expected" actual
35 test_dump() {
36 label=$1
37 dump=$2
38 test_expect_success SVNFE "$dump" '
39 svnadmin create "$label-svn" &&
40 svnadmin load "$label-svn" < "$TEST_DIRECTORY/$dump" &&
41 svn_cmd export "file://$PWD/$label-svn" "$label-svnco" &&
42 git init "$label-git" &&
43 $svnfe_bin <"$TEST_DIRECTORY/$dump" >"$label.fe" &&
45 cd "$label-git" &&
46 git fast-import < ../"$label.fe"
47 ) &&
49 cd "$label-svnco" &&
50 git init &&
51 git add . &&
52 git fetch "../$label-git" master &&
53 git diff --exit-code FETCH_HEAD
58 if [ -x $svnfe_bin ]; then
59 test_set_prereq SVNFE
62 if [ -x $svnda_bin ]; then
63 test_set_prereq SVNDA
66 test_dump simple t9135/svn.dump
67 test_parse t9135/newdata.diff0 t9135/blank.done t9135/newdata.done
68 test_parse t9135/src.diff0 t9135/newdata.done t9135/src.done
70 test_done