1 if test -z "$TEST_FAILS_SANITIZE_LEAK"
3 TEST_PASSES_SANITIZE_LEAK
=true
7 if test -n "$NO_SVN_TESTS"
9 skip_all
='skipping git svn tests, NO_SVN_TESTS defined'
12 if ! test_have_prereq PERL
; then
13 skip_all
='skipping git svn tests, perl not available'
18 GIT_SVN_DIR
=$GIT_DIR/svn
/refs
/remotes
/git-svn
19 SVN_TREE
=$GIT_SVN_DIR/svn-tree
20 test_set_port SVNSERVE_PORT
25 skip_all
='skipping git svn tests, svn not found'
37 \$SVN::Core::VERSION gt '1.1.0' or exit(42);
38 system(qw/svnadmin create --fs-type fsfs/, \$ENV{svnrepo}) == 0 or exit(41);
43 if test $x -eq 42; then
44 skip_all
='Perl SVN libraries must be >= 1.1.0'
45 elif test $x -eq 41; then
46 skip_all
='svnadmin failed to create fsfs repository'
48 skip_all
='Perl SVN libraries not found or unusable'
54 svnrepo
="file://$svnrepo"
57 test-tool chmtime
+1 "$1"
60 # We need this, because we should pass empty configuration directory to
61 # the 'svn commit' to avoid automated property changes and other stuff
62 # that could be set from user's configuration files in ~/.subversion.
64 [ -d "$svnconf" ] || mkdir
"$svnconf"
65 orig_svncmd
="$1"; shift
66 if [ -z "$orig_svncmd" ]; then
70 svn
"$orig_svncmd" --config-dir "$svnconf" "$@"
73 maybe_start_httpd
() {
76 if test_bool_env GIT_TEST_SVN_HTTPD false
78 .
"$TEST_DIRECTORY"/lib-httpd.sh
84 convert_to_rev_db
() {
85 perl
-w -- - "$(test_oid rawsz)" "$@" <<\EOF
88 @ARGV
== 2 or die
"usage: convert_to_rev_db <input> <output>";
89 my
$record_size = $oidlen + 4;
90 my
$hexlen = $oidlen * 2;
91 open my
$wr, '+>', $ARGV[1] or die
"$!: couldn't open: $ARGV[1]";
92 open my
$rd, '<', $ARGV[0] or die
"$!: couldn't open: $ARGV[0]";
93 my
$size = (stat
($rd))[7];
94 ($size % $record_size) == 0 or die
"Inconsistent size: $size";
95 while (sysread
($rd, my
$buf, $record_size) == $record_size) {
96 my
($r, $c) = unpack
("NH$hexlen", $buf);
97 my
$offset = $r * ($hexlen + 1);
98 seek
$wr, 0, 2 or die $
!;
100 if ($pos < $offset) {
101 for (1 ..
(($offset - $pos) / ($hexlen + 1))) {
102 print
$wr (('0' x
$hexlen),"\n") or die $
!;
105 seek
$wr, $offset, 0 or die $
!;
106 print
$wr $c,"\n" or die $
!;
113 require_svnserve
() {
114 if ! test_bool_env GIT_TEST_SVNSERVE false
116 skip_all
='skipping svnserve test. (set $GIT_TEST_SVNSERVE to enable)'
122 svnserve
--listen-port $SVNSERVE_PORT \
123 --root "$rawsvnrepo" \
125 --listen-host 127.0.0.1 &
128 prepare_utf8_locale
() {
129 if test -z "$GIT_TEST_UTF8_LOCALE"
131 case "${LC_ALL:-$LANG}" in
132 *.
[Uu
][Tt
][Ff
]8 |
*.
[Uu
][Tt
][Ff
]-8)
133 GIT_TEST_UTF8_LOCALE
="${LC_ALL:-$LANG}"
136 GIT_TEST_UTF8_LOCALE
=$
(locale
-a |
sed -n '/\.[uU][tT][fF]-*8$/{
143 if test -n "$GIT_TEST_UTF8_LOCALE"
147 say
"# UTF-8 locale not available, some tests are skipped"