t9400: Add test cases for config file handling
Add a few test cases for the config file parsing done by git-cvsserver. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Frank Lichtenheld committed
May 21, 2007 at 00:31 UTC
1d431b22357389d0833830daf814ff0c4dc9189d
1 file changed
+69
t/t9400-git-cvsserver-server.sh
+69
@@ -47,6 +47,75 @@ test_expect_success 'basic checkout' \
47
'GIT_CONFIG="$git_config" cvs -Q co -d cvswork master &&
48
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))" = "empty/1.1/"'
49
50
+#--------------
51
+# CONFIG TESTS
52
+#--------------
53
+
54
+test_expect_success 'gitcvs.enabled = false' \
55
+ 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
56
+ if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1
57
+ then
58
+ echo unexpected cvs success
59
+ false
60
+ else
61
+ true
62
+ fi &&
63
+ cat cvs.log | grep -q "GITCVS emulation disabled" &&
64
+ test ! -d cvswork2'
65
+
66
+rm -fr cvswork2
67
+test_expect_success 'gitcvs.ext.enabled = true' \
68
+ 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
69
+ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
70
+ GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
71
+ diff -q cvswork cvswork2'
72
+
73
+rm -fr cvswork2
74
+test_expect_success 'gitcvs.ext.enabled = false' \
75
+ 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled false &&
76
+ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
77
+ if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1
78
+ then
79
+ echo unexpected cvs success
80
+ false
81
+ else
82
+ true
83
+ fi &&
84
+ cat cvs.log | grep -q "GITCVS emulation disabled" &&
85
+ test ! -d cvswork2'
86
+
87
+rm -fr cvswork2
88
+test_expect_success 'gitcvs.dbname' \
89
+ 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
90
+ GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&
91
+ GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
92
+ diff -q cvswork cvswork2 &&
93
+ test -f "$SERVERDIR/gitcvs.ext.master.sqlite" &&
94
+ cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs.ext.master.sqlite"'
95
+
96
+rm -fr cvswork2
97
+test_expect_success 'gitcvs.ext.dbname' \
98
+ 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
99
+ GIT_DIR="$SERVERDIR" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
100
+ GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
101
+ GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
102
+ diff -q cvswork cvswork2 &&
103
+ test -f "$SERVERDIR/gitcvs1.ext.master.sqlite" &&
104
+ test ! -f "$SERVERDIR/gitcvs2.ext.master.sqlite" &&
105
+ cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs1.ext.master.sqlite"'
106
+
107
+
108
+#------------
109
+# CVS UPDATE
110
+#------------
111
+
112
+rm -fr "$SERVERDIR"
113
+cd "$WORKDIR" &&
114
+git clone -q --local --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
115
+GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
116
+GIT_DIR="$SERVERDIR" git config --bool gitcvs.logfile "$SERVERDIR/gitcvs.log" ||
117
+exit 1
118
+
119
test_expect_success 'cvs update (create new file)' \
120
'echo testfile1 >testfile1 &&
121
git add testfile1 &&