3 if test -n "$NO_SVN_TESTS"
5 skip_all='skipping git svn tests, NO_SVN_TESTS defined'
8 if ! test_have_prereq PERL; then
9 skip_all='skipping git svn tests, perl not available'
14 GIT_SVN_DIR=$GIT_DIR/svn/refs/remotes/git-svn
15 SVN_TREE=$GIT_SVN_DIR/svn-tree
20 skip_all='skipping git svn tests, svn not found'
32 \$SVN::Core::VERSION gt '1.1.0' or exit(42);
33 system(qw/svnadmin create --fs-type fsfs/, \$ENV{svnrepo}) == 0 or exit(41);
38 if test $x -eq 42; then
39 skip_all='Perl SVN libraries must be >= 1.1.0'
40 elif test $x -eq 41; then
41 skip_all='svnadmin failed to create fsfs repository'
43 skip_all='Perl SVN libraries not found or unusable'
49 svnrepo="file://$svnrepo"
55 # We need this, because we should pass empty configuration directory to
56 # the 'svn commit' to avoid automated property changes and other stuff
57 # that could be set from user's configuration files in ~/.subversion.
59 [ -d "$svnconf" ] || mkdir "$svnconf"
60 orig_svncmd="$1"; shift
61 if [ -z "$orig_svncmd" ]; then
65 svn "$orig_svncmd" --config-dir "$svnconf" "$@"
80 if test -z "$SVN_HTTPD_PATH"
82 echo >&2 '*** error: Apache not found'
86 "$SVN_HTTPD_MODULE_PATH" \
87 /usr/lib/apache2/modules \
88 /usr/libexec/apache2 \
92 SVN_HTTPD_MODULE_PATH="$d"
96 if test -z "$SVN_HTTPD_MODULE_PATH"
98 echo >&2 '*** error: Apache module dir not found'
101 if test ! -f "$SVN_HTTPD_MODULE_PATH/mod_dav_svn.so"
103 echo >&2 '*** error: Apache module "mod_dav_svn" not found'
107 repo_base_path="${1-svn}"
108 mkdir "$GIT_DIR"/logs
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>
121 SVNPath "$rawsvnrepo"
127 if test -z "$SVN_HTTPD_PORT"
129 echo >&2 'SVN_HTTPD_PORT is not defined!'
133 prepare_httpd "$1" || return 1
135 "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k start
136 svnrepo="http://127.0.0.1:$SVN_HTTPD_PORT/$repo_base_path"
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
145 convert_to_rev_db () {
146 perl -w -- - "$@" <<\EOF
148 @ARGV == 2 or die "usage: convert_to_rev_db <input> <output>";
149 open my $wr, '+>', $ARGV[1] or die "$!: couldn't open: $ARGV[1]";
150 open my $rd, '<', $ARGV[0] or die "$!: couldn't open: $ARGV[0]";
151 my $size = (stat($rd))[7];
152 ($size % 24) == 0 or die "Inconsistent size: $size";
153 while (sysread($rd, my $buf, 24) == 24) {
154 my ($r, $c) = unpack('NH40', $buf);
155 my $offset = $r * 41;
156 seek $wr, 0, 2 or die $!;
158 if ($pos < $offset) {
159 for (1 .. (($offset - $pos) / 41)) {
160 print $wr (('0' x 40),"\n") or die $!;
163 seek $wr, $offset, 0 or die $!;
164 print $wr $c,"\n" or die $!;
171 require_svnserve () {
172 if test -z "$SVNSERVE_PORT"
174 skip_all='skipping svnserve test. (set $SVNSERVE_PORT to enable)'
180 svnserve --listen-port $SVNSERVE_PORT \
181 --root "$rawsvnrepo" \
183 --listen-host 127.0.0.1 &
186 prepare_a_utf8_locale () {
187 a_utf8_locale=$(locale -a | sed -n '/\.[uU][tT][fF]-*8$/{
191 if test -n "$a_utf8_locale"
195 say "# UTF-8 locale not available, some tests are skipped"