Skip to content

Commit 612c3df

Browse files
committed
Merge branch 'ew/git-svn-http-tests'
Tests for "git svn" have been taught to reuse the lib-httpd test infrastructure when testing the subversion integration that interacts with subversion repositories served over the http:// protocol. * ew/git-svn-http-tests: git svn: migrate tests to use lib-httpd t/t91*: do not say how to avoid the tests
2 parents 3819fb9 + a8a5d25 commit 612c3df

10 files changed

+30
-91
lines changed

t/lib-git-svn.sh

Lines changed: 16 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -65,81 +65,22 @@ svn_cmd () {
6565
svn "$orig_svncmd" --config-dir "$svnconf" "$@"
6666
}
6767

68-
prepare_httpd () {
69-
for d in \
70-
"$SVN_HTTPD_PATH" \
71-
/usr/sbin/apache2 \
72-
/usr/sbin/httpd \
73-
; do
74-
if test -f "$d"
75-
then
76-
SVN_HTTPD_PATH="$d"
77-
break
78-
fi
79-
done
80-
if test -z "$SVN_HTTPD_PATH"
81-
then
82-
echo >&2 '*** error: Apache not found'
83-
return 1
84-
fi
85-
for d in \
86-
"$SVN_HTTPD_MODULE_PATH" \
87-
/usr/lib/apache2/modules \
88-
/usr/libexec/apache2 \
89-
; do
90-
if test -d "$d"
91-
then
92-
SVN_HTTPD_MODULE_PATH="$d"
93-
break
94-
fi
95-
done
96-
if test -z "$SVN_HTTPD_MODULE_PATH"
97-
then
98-
echo >&2 '*** error: Apache module dir not found'
99-
return 1
100-
fi
101-
if test ! -f "$SVN_HTTPD_MODULE_PATH/mod_dav_svn.so"
102-
then
103-
echo >&2 '*** error: Apache module "mod_dav_svn" not found'
104-
return 1
105-
fi
106-
107-
repo_base_path="${1-svn}"
108-
mkdir "$GIT_DIR"/logs
109-
110-
cat > "$GIT_DIR/httpd.conf" <<EOF
111-
ServerName "git svn test"
112-
ServerRoot "$GIT_DIR"
113-
DocumentRoot "$GIT_DIR"
114-
PidFile "$GIT_DIR/httpd.pid"
115-
LockFile logs/accept.lock
116-
Listen 127.0.0.1:$SVN_HTTPD_PORT
117-
LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so
118-
LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so
119-
<Location /$repo_base_path>
120-
DAV svn
121-
SVNPath "$rawsvnrepo"
122-
</Location>
123-
EOF
124-
}
125-
126-
start_httpd () {
127-
if test -z "$SVN_HTTPD_PORT"
128-
then
129-
echo >&2 'SVN_HTTPD_PORT is not defined!'
130-
return
131-
fi
132-
133-
prepare_httpd "$1" || return 1
134-
135-
"$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k start
136-
svnrepo="http://127.0.0.1:$SVN_HTTPD_PORT/$repo_base_path"
137-
}
138-
139-
stop_httpd () {
140-
test -z "$SVN_HTTPD_PORT" && return
141-
test ! -f "$GIT_DIR/httpd.conf" && return
142-
"$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop
68+
maybe_start_httpd () {
69+
loc=${1-svn}
70+
71+
test_tristate GIT_SVN_TEST_HTTPD
72+
case $GIT_SVN_TEST_HTTPD in
73+
true)
74+
. "$TEST_DIRECTORY"/lib-httpd.sh
75+
LIB_HTTPD_SVN="$loc"
76+
start_httpd
77+
;;
78+
*)
79+
stop_httpd () {
80+
: noop
81+
}
82+
;;
83+
esac
14384
}
14485

14586
convert_to_rev_db () {

t/lib-httpd.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# LIB_HTTPD_MODULE_PATH web server modules path
2525
# LIB_HTTPD_PORT listening port
2626
# LIB_HTTPD_DAV enable DAV
27-
# LIB_HTTPD_SVN enable SVN
27+
# LIB_HTTPD_SVN enable SVN at given location (e.g. "svn")
2828
# LIB_HTTPD_SSL enable SSL
2929
#
3030
# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
@@ -162,8 +162,10 @@ prepare_httpd() {
162162
if test -n "$LIB_HTTPD_SVN"
163163
then
164164
HTTPD_PARA="$HTTPD_PARA -DSVN"
165-
rawsvnrepo="$HTTPD_ROOT_PATH/svnrepo"
166-
svnrepo="http://127.0.0.1:$LIB_HTTPD_PORT/svn"
165+
LIB_HTTPD_SVNPATH="$rawsvnrepo"
166+
svnrepo="http://127.0.0.1:$LIB_HTTPD_PORT/"
167+
svnrepo="$svnrepo$LIB_HTTPD_SVN"
168+
export LIB_HTTPD_SVN LIB_HTTPD_SVNPATH
167169
fi
168170
fi
169171
}

t/lib-httpd/apache.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ RewriteRule ^/half-auth-complete/ - [E=AUTHREQUIRED:yes]
208208
<IfDefine SVN>
209209
LoadModule dav_svn_module modules/mod_dav_svn.so
210210

211-
<Location /svn>
211+
<Location /${LIB_HTTPD_SVN}>
212212
DAV svn
213-
SVNPath svnrepo
213+
SVNPath "${LIB_HTTPD_SVNPATH}"
214214
</Location>
215215
</IfDefine>

t/t9100-git-svn-basic.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ GIT_SVN_LC_ALL=${LC_ALL:-$LANG}
88

99
. ./lib-git-svn.sh
1010

11-
say 'define NO_SVN_TESTS to skip git svn tests'
12-
1311
case "$GIT_SVN_LC_ALL" in
1412
*.UTF-8)
1513
test_set_prereq UTF8

t/t9115-git-svn-dcommit-funky-renames.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ test_description='git svn dcommit can commit renames of files with ugly names'
88
. ./lib-git-svn.sh
99

1010
test_expect_success 'load repository with strange names' '
11-
svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9115/funky-names.dump &&
12-
start_httpd gtk+
13-
'
11+
svnadmin load -q "$rawsvnrepo" <"$TEST_DIRECTORY"/t9115/funky-names.dump
12+
'
13+
14+
maybe_start_httpd gtk+
1415

1516
test_expect_success 'init and fetch repository' '
1617
git svn init "$svnrepo" &&

t/t9118-git-svn-funky-branch-names.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test_expect_success 'setup svnrepo' '
3232
"$svnrepo/pr ject/branches/trailing_dotlock.lock" &&
3333
svn_cmd cp -m "reflog" "$svnrepo/pr ject/trunk" \
3434
"$svnrepo/pr ject/branches/not-a@{0}reflog@" &&
35-
start_httpd
35+
maybe_start_httpd
3636
'
3737

3838
# SVN 1.7 will truncate "not-a%40{0]" to just "not-a".

t/t9120-git-svn-clone-with-percent-escapes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test_expect_success 'setup svnrepo' '
1515
svn_cmd cp -m "tag" "$svnrepo/pr ject/trunk" \
1616
"$svnrepo/pr ject/tags/v1" &&
1717
rm -rf project &&
18-
start_httpd
18+
maybe_start_httpd
1919
'
2020

2121
test_expect_success 'test clone with percent escapes' '

t/t9142-git-svn-shallow-clone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test_expect_success 'setup test repository' '
1818
svn_cmd add foo &&
1919
svn_cmd commit -m "add foo"
2020
) &&
21-
start_httpd
21+
maybe_start_httpd
2222
'
2323

2424
test_expect_success 'clone trunk with "-r HEAD"' '

t/t9158-git-svn-mergeinfo.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ test_description='git svn mergeinfo propagation'
77

88
. ./lib-git-svn.sh
99

10-
say 'define NO_SVN_TESTS to skip git svn tests'
11-
1210
test_expect_success 'initialize source svn repo' '
1311
svn_cmd mkdir -m x "$svnrepo"/trunk &&
1412
svn_cmd co "$svnrepo"/trunk "$SVN_TREE" &&

t/t9160-git-svn-preserve-empty-dirs.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ local Git repository with placeholder files.'
1111

1212
. ./lib-git-svn.sh
1313

14-
say 'define NO_SVN_TESTS to skip git svn tests'
1514
GIT_REPO=git-svn-repo
1615

1716
test_expect_success 'initialize source svn repo containing empty dirs' '

0 commit comments

Comments
 (0)