From 60d02ccc18408e54ace8692532fcc73d4035b3c2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 6 Jul 2006 00:14:16 -0700 Subject: git-svn: migrate out of contrib Allow NO_SVN_TESTS to be defined to skip git-svn tests. These tests are time-consuming due to SVN being slow, and even more so if SVN Perl libraries are not available. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 t/lib-git-svn.sh (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh new file mode 100644 index 0000000000..450fee8997 --- /dev/null +++ b/t/lib-git-svn.sh @@ -0,0 +1,43 @@ +. ./test-lib.sh + +if test -n "$NO_SVN_TESTS" +then + test_expect_success 'skipping git-svn tests, NO_SVN_TESTS defined' : + test_done + exit +fi + +GIT_DIR=$PWD/.git +GIT_SVN_DIR=$GIT_DIR/svn/git-svn +SVN_TREE=$GIT_SVN_DIR/svn-tree + +svnadmin >/dev/null 2>&1 +if test $? != 1 +then + test_expect_success 'skipping git-svn tests, svnadmin not found' : + test_done + exit +fi + +svn >/dev/null 2>&1 +if test $? != 1 +then + test_expect_success 'skipping git-svn tests, svn not found' : + test_done + exit +fi + +svnrepo=$PWD/svnrepo + +set -e + +if svnadmin create --help | grep fs-type >/dev/null +then + svnadmin create --fs-type fsfs "$svnrepo" +else + svnadmin create "$svnrepo" +fi + +svnrepo="file://$svnrepo/test-git-svn" + + -- cgit v1.2.1 From 4b832e819de51bd2f32eb798cb648dc8d4064dbc Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 7 Jul 2006 03:17:16 -0700 Subject: git-svn: migrate out of contrib (follow-up) Check for SVN::Core so test 910[45] don't fail if the user doesn't have those installed. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 450fee8997..29a1e72c61 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -11,8 +11,15 @@ GIT_DIR=$PWD/.git GIT_SVN_DIR=$GIT_DIR/svn/git-svn SVN_TREE=$GIT_SVN_DIR/svn-tree +perl -e 'use SVN::Core' >/dev/null 2>&1 +if test $? -ne 0 +then + echo 'Perl SVN libraries not found, tests requiring those will be skipped' + GIT_SVN_NO_LIB=1 +fi + svnadmin >/dev/null 2>&1 -if test $? != 1 +if test $? -ne 1 then test_expect_success 'skipping git-svn tests, svnadmin not found' : test_done @@ -20,7 +27,7 @@ then fi svn >/dev/null 2>&1 -if test $? != 1 +if test $? -ne 1 then test_expect_success 'skipping git-svn tests, svn not found' : test_done -- cgit v1.2.1 From e15161198a381334b8c8ccee707392163f3a1ab7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 27 Nov 2006 21:46:50 -0800 Subject: git-svn: update tests for recent changes * Enable test for delta transfers in full-svn-test. * Run tests against the root of the repository so we won't have to revisit 308906fa6e98132cab839a4f42701386fba368ef and efe4631def181d32f932672a7ea31e52ee0ab308 again. The graft-branches test still runs as before. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 29a1e72c61..63c670304f 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -45,6 +45,6 @@ else svnadmin create "$svnrepo" fi -svnrepo="file://$svnrepo/test-git-svn" +svnrepo="file://$svnrepo" -- cgit v1.2.1 From b9c8518722687fae6182162f9a244915ba94db02 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 15 Dec 2006 23:58:07 -0800 Subject: git-svn: remove support for the svn command-line client Using the command-line client was great for prototyping and getting something working quickly. Eventually I found time to study the library documentation and add support for using the libraries which are much faster and more flexible when it comes to supporting new features. Note that we require version 1.1 of the SVN libraries, whereas we supported the command-line svn client down to version 1.0. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 63c670304f..99ada71349 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -7,17 +7,18 @@ then exit fi -GIT_DIR=$PWD/.git -GIT_SVN_DIR=$GIT_DIR/svn/git-svn -SVN_TREE=$GIT_SVN_DIR/svn-tree - -perl -e 'use SVN::Core' >/dev/null 2>&1 +perl -e 'use SVN::Core; $SVN::Core::VERSION gt "1.1.0" or die' >/dev/null 2>&1 if test $? -ne 0 then - echo 'Perl SVN libraries not found, tests requiring those will be skipped' - GIT_SVN_NO_LIB=1 + test_expect_success 'Perl SVN libraries not found, skipping test' : + test_done + exit fi +GIT_DIR=$PWD/.git +GIT_SVN_DIR=$GIT_DIR/svn/git-svn +SVN_TREE=$GIT_SVN_DIR/svn-tree + svnadmin >/dev/null 2>&1 if test $? -ne 1 then -- cgit v1.2.1 From c6d499a82fbb02e2a03fe3d858ff144fa570fb34 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 31 Dec 2006 21:49:45 -0800 Subject: git-svn: remove svnadmin dependency from the tests We require the libraries now, so we can create repositories using them (and save some executable load time while we're at it). Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 99ada71349..af42ccc8d1 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -7,26 +7,10 @@ then exit fi -perl -e 'use SVN::Core; $SVN::Core::VERSION gt "1.1.0" or die' >/dev/null 2>&1 -if test $? -ne 0 -then - test_expect_success 'Perl SVN libraries not found, skipping test' : - test_done - exit -fi - GIT_DIR=$PWD/.git GIT_SVN_DIR=$GIT_DIR/svn/git-svn SVN_TREE=$GIT_SVN_DIR/svn-tree -svnadmin >/dev/null 2>&1 -if test $? -ne 1 -then - test_expect_success 'skipping git-svn tests, svnadmin not found' : - test_done - exit -fi - svn >/dev/null 2>&1 if test $? -ne 1 then @@ -37,13 +21,24 @@ fi svnrepo=$PWD/svnrepo -set -e - -if svnadmin create --help | grep fs-type >/dev/null +perl -w -e " +use SVN::Core; +use SVN::Repos; +\$SVN::Core::VERSION gt '1.1.0' or exit(42); +SVN::Repos::create('$svnrepo', undef, undef, undef, + { 'fs-config' => 'fsfs'}); +" +x=$? +if test $x -ne 0 then - svnadmin create --fs-type fsfs "$svnrepo" -else - svnadmin create "$svnrepo" + if test $x -eq 42; then + err='Perl SVN libraries must be >= 1.1.0' + else + err='Perl SVN libraries not found or unusable, skipping test' + fi + test_expect_success "$err" : + test_done + exit fi svnrepo="file://$svnrepo" -- cgit v1.2.1 From e66191f4837f2d18bb70ceaf3cad4eb52cc4000c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 13 Jan 2007 02:47:53 -0800 Subject: git-svn: fix tests to work with older svn Some of the recent changes and shortcuts to the tests broke things for people using older versions of svn: t9104-git-svn-follow-parent.sh: v1.2.3 (from SuSE 10.0 as reported by riddochc on #git (thanks!)) required an extra 'svn up'. I was also able to reproduce this with v1.1.4 (Debian Sarge). lib-git-svn.sh: SVN::Repos bindings in versions up to and including 1.1.4 (Sarge again) do not pass fs-config options to the underlying library. BerkeleyDB repositories also seem completely broken on all my Sarge machines; so not using FSFS does not seem to be an option for most people. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index af42ccc8d1..a0f2814083 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -25,14 +25,15 @@ perl -w -e " use SVN::Core; use SVN::Repos; \$SVN::Core::VERSION gt '1.1.0' or exit(42); -SVN::Repos::create('$svnrepo', undef, undef, undef, - { 'fs-config' => 'fsfs'}); +system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or exit(41); " x=$? if test $x -ne 0 then if test $x -eq 42; then err='Perl SVN libraries must be >= 1.1.0' + elif test $x -eq 41; then + err='svnadmin failed to create fsfs repository' else err='Perl SVN libraries not found or unusable, skipping test' fi -- cgit v1.2.1 From 38434f2eed45f42ed706d07564079c23ee686511 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 14 Jan 2007 03:22:47 -0500 Subject: Hide output about SVN::Core not being found during tests. If the user doesn't have SVN::Core installed or working then the SVN tests properly turn themselves off. But the user doesn't need to know that SVN::Core isn't loadable as a Perl module. Unless of course they are trying to debug the test, so lets relegate the Perl failures to --verbose only. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index a0f2814083..bb1d7b84bc 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -26,7 +26,7 @@ use SVN::Core; use SVN::Repos; \$SVN::Core::VERSION gt '1.1.0' or exit(42); system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or exit(41); -" +" >&3 2>&4 x=$? if test $x -ne 0 then -- cgit v1.2.1 From 7b3fab877d468a51bab6050385ab701697301c62 Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Mon, 12 Feb 2007 19:33:37 -0500 Subject: Work around Subversion race in git-svn tests. Some of the git-svn tests can fail on fast machines due to a race in Subversion: if a file is modified in the same second it was checked out (or in for that matter), Subversion will not consider it modified. This works around the problem by increasing the timestamp by one second before each commit. [jc: with "touch -r -d" replacement from Eric] Acked-by: Eric Wong Signed-off-by: Michael Spang Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index bb1d7b84bc..67d08cf740 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -45,3 +45,6 @@ fi svnrepo="file://$svnrepo" +poke() { + perl -e '@x = stat($ARGV[0]); utime($x[8], $x[9] + 1, $ARGV[0])' "$1" +} -- cgit v1.2.1 From 2edb9c5cf98e1a65c775ede6fc5b10a15bb94384 Mon Sep 17 00:00:00 2001 From: "sam@vilain.net" Date: Tue, 5 Dec 2006 16:17:38 +1100 Subject: git-svn: make test for SVK mirror path import A manual test that sets up a repository that looks like an SVK depot, and then imports it to check that it looks like we mirrored the 'original' source. There is also a minor modification to the git-svn test library shell file which sets a variable for the subversion repository's filesystem path. [ew: made some of the tests stricter and more thorough] Signed-off-by: Eric Wong --- t/lib-git-svn.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 67d08cf740..27ad3b70f9 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -42,9 +42,9 @@ then exit fi +rawsvnrepo="$svnrepo" svnrepo="file://$svnrepo" - poke() { perl -e '@x = stat($ARGV[0]); utime($x[8], $x[9] + 1, $ARGV[0])' "$1" } -- cgit v1.2.1 From 56cf9806a97f5fe9a91c38aa3eb8cec0c76480e6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 24 Feb 2007 16:59:52 -0800 Subject: Update tests to use test-chmtime test-lib: Make sure test-chmtime has been built before starting. t4200-rerere: Removed non-portable date dependency and avoid touch Avoid "test -a" which isn't portable, either lib-git-svn: Use test-chmtime instead of Perl one-liner to poke Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 27ad3b70f9..f6fe78cd27 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -46,5 +46,5 @@ rawsvnrepo="$svnrepo" svnrepo="file://$svnrepo" poke() { - perl -e '@x = stat($ARGV[0]); utime($x[8], $x[9] + 1, $ARGV[0])' "$1" + test-chmtime +1 "$1" } -- cgit v1.2.1 From 29633bb91c7bcff31ff3bb59378709e3e3ef627d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 15 Jul 2007 21:53:50 -0700 Subject: git-svn: fix commiting renames over DAV with funky file names Renaming files with non-URI friendly characters caused breakage when committing to DAV repositories (over http(s)). Even if I try leaving out the $self->{url} from the return value of url_path(), a partial (without host), unescaped path name does not work. Filenames for DAV repos need to be URI-encoded before being passed to the library. Since this bug did not affect file:// and svn:// repos, the git-svn test library needed to be expanded to include support for starting Apache with mod_dav_svn enabled. This new test is not enabled by default, but can be enabled by setting SVN_HTTPD_PORT to any available TCP/IP port on 127.0.0.1. Additionally, for running this test, the following variables (with defaults shown) can be changed for the suitable system. The default values are set for Debian systems: SVN_HTTPD_MODULE_PATH=/usr/lib/apache2/modules SVN_HTTPD_PATH=/usr/sbin/apache2 Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index f6fe78cd27..8d4a447213 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -48,3 +48,37 @@ svnrepo="file://$svnrepo" poke() { test-chmtime +1 "$1" } + +SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'} +SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'} + +start_httpd () { + if test -z "$SVN_HTTPD_PORT" + then + echo >&2 'SVN_HTTPD_PORT is not defined!' + return + fi + + mkdir "$GIT_DIR"/logs + + cat > "$GIT_DIR/httpd.conf" < + DAV svn + SVNPath $rawsvnrepo + +EOF + "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k start + svnrepo=http://127.0.0.1:$SVN_HTTPD_PORT/svn +} + +stop_httpd () { + test -z "$SVN_HTTPD_PORT" && return + "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop +} -- cgit v1.2.1 From 060610c572b21d00bb09ebbab664c0452c7eac9d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 8 Dec 2007 23:27:41 -0800 Subject: git-svn: replace .rev_db with a more space-efficient .rev_map format Migrations are done automatically on an as-needed basis when new revisions are to be fetched. Stale remote branches do not get migrated, yet. However, unless you set noMetadata or useSvkProps it's safe to just do: find $GIT_DIR/svn -name '.rev_db*' -print0 | xargs rm -f to purge all the old .rev_db files. The new format is a one-way migration and is NOT compatible with old versions of git-svn. This is the replacement for the rev_db format, which was too big and inefficient for large repositories with a lot of sparse history (mainly tags). The format is this: - 24 bytes for every record, * 4 bytes for the integer representing an SVN revision number * 20 bytes representing the sha1 of a git commit - No empty padding records like the old format - new records are written append-only since SVN revision numbers increase monotonically - lookups on SVN revision number are done via a binary search - Piping the file to xxd(1) -c24 is a good way of dumping it for viewing or editing, should the need ever arise. As with .rev_db, these files are disposable unless noMetadata or useSvmProps is set. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 8d4a447213..9ee35e7901 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -82,3 +82,29 @@ stop_httpd () { test -z "$SVN_HTTPD_PORT" && return "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop } + +convert_to_rev_db () { + perl -w -- - "$@" <<\EOF +use strict; +@ARGV == 2 or die "Usage: convert_to_rev_db "; +open my $wr, '+>', $ARGV[1] or die "$!: couldn't open: $ARGV[1]"; +open my $rd, '<', $ARGV[0] or die "$!: couldn't open: $ARGV[0]"; +my $size = (stat($rd))[7]; +($size % 24) == 0 or die "Inconsistent size: $size"; +while (sysread($rd, my $buf, 24) == 24) { + my ($r, $c) = unpack('NH40', $buf); + my $offset = $r * 41; + seek $wr, 0, 2 or die $!; + my $pos = tell $wr; + if ($pos < $offset) { + for (1 .. (($offset - $pos) / 41)) { + print $wr (('0' x 40),"\n") or die $!; + } + } + seek $wr, $offset, 0 or die $!; + print $wr $c,"\n" or die $!; +} +close $wr or die $!; +close $rd or die $!; +EOF +} -- cgit v1.2.1 From 3644da7214055d2e84223b45dfca42d437fb7ea7 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Fri, 21 Mar 2008 03:27:35 -0400 Subject: Make git-svn tests behave better on OS X Give lib-git-svn.sh a few alternate paths to look for apache2. Explicitly define the LockFile so httpd will actually start under OS X Signed-off-by: Kevin Ballard Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 9ee35e7901..9decd2e1e8 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -49,8 +49,28 @@ poke() { test-chmtime +1 "$1" } -SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'} -SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'} +for d in \ + "$SVN_HTTPD_PATH" \ + /usr/sbin/apache2 \ + /usr/sbin/httpd \ +; do + if test -f "$d" + then + SVN_HTTPD_PATH="$d" + break + fi +done +for d in \ + "$SVN_HTTPD_MODULE_PATH" \ + /usr/lib/apache2/modules \ + /usr/libexec/apache2 \ +; do + if test -d "$d" + then + SVN_HTTPD_MODULE_PATH="$d" + break + fi +done start_httpd () { if test -z "$SVN_HTTPD_PORT" @@ -66,6 +86,7 @@ ServerName "git-svn test" ServerRoot "$GIT_DIR" DocumentRoot "$GIT_DIR" PidFile "$GIT_DIR/httpd.pid" +LockFile logs/accept.lock Listen 127.0.0.1:$SVN_HTTPD_PORT LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so -- cgit v1.2.1 From cdf3ec01acb8785b8e61ce6e006c9c4c763de663 Mon Sep 17 00:00:00 2001 From: Bryan Donlan Date: Sun, 4 May 2008 01:37:57 -0400 Subject: lib-git-svn.sh: Fix quoting issues with paths containing shell metacharacters Signed-off-by: Bryan Donlan Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 9decd2e1e8..445df78cac 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -20,12 +20,13 @@ then fi svnrepo=$PWD/svnrepo +export svnrepo perl -w -e " use SVN::Core; use SVN::Repos; \$SVN::Core::VERSION gt '1.1.0' or exit(42); -system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or exit(41); +system(qw/svnadmin create --fs-type fsfs/, \$ENV{svnrepo}) == 0 or exit(41); " >&3 2>&4 x=$? if test $x -ne 0 -- cgit v1.2.1 From d1a8d0ea5fb2d4d43d0ea8f2fe45ec1fce7ec4bc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 10 May 2008 17:14:49 -0700 Subject: git-svn: fix cloning of HTTP URLs with '+' in their path With this, git svn clone -s http://svn.gnome.org/svn/gtk+ is successful. Also modified the funky rename test for this, which _does_ include escaped '+' signs for HTTP URLs. SVN seems to accept either "+" or "%2B" in filenames and directories (just not the main URL), so I'll leave it alone for now. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 9decd2e1e8..d8f3355791 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -73,11 +73,16 @@ for d in \ done start_httpd () { + repo_base_path="$1" if test -z "$SVN_HTTPD_PORT" then echo >&2 'SVN_HTTPD_PORT is not defined!' return fi + if test -z "$repo_base_path" + then + repo_base_path=svn + fi mkdir "$GIT_DIR"/logs @@ -90,13 +95,13 @@ LockFile logs/accept.lock Listen 127.0.0.1:$SVN_HTTPD_PORT LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so - + DAV svn SVNPath $rawsvnrepo EOF "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k start - svnrepo=http://127.0.0.1:$SVN_HTTPD_PORT/svn + svnrepo="http://127.0.0.1:$SVN_HTTPD_PORT/$repo_base_path" } stop_httpd () { -- cgit v1.2.1 From 3901a8c86645063c06dd81f12968012cbc697304 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 14 Jul 2008 02:13:56 -0700 Subject: t/lib-git-svn: fix SVN_HTTPD tests to work with "trash directory" Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 5d3bd9dda9..a841df2a9e 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -98,7 +98,7 @@ LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so DAV svn - SVNPath $rawsvnrepo + SVNPath "$rawsvnrepo" EOF "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k start -- cgit v1.2.1 From 16805d3e59250769f409480ca3cb739281bc906c Mon Sep 17 00:00:00 2001 From: Nanako Shiraishi Date: Mon, 8 Sep 2008 19:02:05 +0900 Subject: t/t91XX-svn: start removing use of "git-" from these tests Subversion tests use too many "git-foo" form, so I am converting them in two steps. This first step replaces literal strings "remotes/git-svn" and "git-svn-id" by introducing $remotes_git_svn and $git_svn_id constants defined as shell variables. This will reduce the number of false hits from "git grep". Signed-off-by: Nanako Shiraishi Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index a841df2a9e..c33dc2d5d5 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -1,5 +1,8 @@ . ./test-lib.sh +remotes_git_svn=remotes/git""-svn +git_svn_id=git""-svn-id + if test -n "$NO_SVN_TESTS" then test_expect_success 'skipping git-svn tests, NO_SVN_TESTS defined' : -- cgit v1.2.1 From 1364ff27dc5ecca4c1932d8fa09fe88a7c09fda0 Mon Sep 17 00:00:00 2001 From: Nanako Shiraishi Date: Mon, 8 Sep 2008 19:02:08 +0900 Subject: t/t91XX git-svn tests: run "git svn" not "git-svn" This replaces 'git-svn' with 'git svn' in the tests. Signed-off-by: Nanako Shiraishi Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index c33dc2d5d5..c526eedd62 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -5,7 +5,7 @@ git_svn_id=git""-svn-id if test -n "$NO_SVN_TESTS" then - test_expect_success 'skipping git-svn tests, NO_SVN_TESTS defined' : + test_expect_success 'skipping git svn tests, NO_SVN_TESTS defined' : test_done exit fi @@ -17,7 +17,7 @@ SVN_TREE=$GIT_SVN_DIR/svn-tree svn >/dev/null 2>&1 if test $? -ne 1 then - test_expect_success 'skipping git-svn tests, svn not found' : + test_expect_success 'skipping git svn tests, svn not found' : test_done exit fi @@ -91,7 +91,7 @@ start_httpd () { mkdir "$GIT_DIR"/logs cat > "$GIT_DIR/httpd.conf" < Date: Sun, 14 Sep 2008 17:14:15 -0400 Subject: git-svn: factor out svnserve test code for later use Signed-off-by: Alec Berryman Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index a841df2a9e..5b5f288809 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -135,3 +135,20 @@ close $wr or die $!; close $rd or die $!; EOF } + +require_svnserve () { + if test -z "$SVNSERVE_PORT" + then + say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)' + test_done + exit + fi +} + +start_svnserve () { + svnserve --listen-port $SVNSERVE_PORT \ + --root "$rawsvnrepo" \ + --listen-once \ + --listen-host 127.0.0.1 & +} + -- cgit v1.2.1 From fae74a04d75e820c5150cfb0cb4c044bf4488007 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 1 Mar 2009 19:52:51 +0100 Subject: test suite: Use 'say' to say something instead of 'test_expect_success' Some tests report that some tests will be skipped. They used 'test_expect_success' with a trivially successful test. Nowadays we have the helper function 'say' for this purpose. In on case, 'say_color skip' is replaced by 'say' because the former is not intended as a public API. Signed-off-by: Johannes Sixt --- t/lib-git-svn.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 67c431d4eb..de384e6ac3 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -5,7 +5,7 @@ git_svn_id=git""-svn-id if test -n "$NO_SVN_TESTS" then - test_expect_success 'skipping git svn tests, NO_SVN_TESTS defined' : + say 'skipping git svn tests, NO_SVN_TESTS defined' test_done exit fi @@ -17,7 +17,7 @@ SVN_TREE=$GIT_SVN_DIR/svn-tree svn >/dev/null 2>&1 if test $? -ne 1 then - test_expect_success 'skipping git svn tests, svn not found' : + say 'skipping git svn tests, svn not found' test_done exit fi @@ -41,7 +41,7 @@ then else err='Perl SVN libraries not found or unusable, skipping test' fi - test_expect_success "$err" : + say "$err" test_done exit fi -- cgit v1.2.1 From 5dba35912474770d0df45ed801d78c4c9ed5e949 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 3 Apr 2009 15:31:10 -0400 Subject: tests: remove exit after test_done call test_done always exits, so this line is never executed. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 4 ---- 1 file changed, 4 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index de384e6ac3..cdd7ccdd2a 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -7,7 +7,6 @@ if test -n "$NO_SVN_TESTS" then say 'skipping git svn tests, NO_SVN_TESTS defined' test_done - exit fi GIT_DIR=$PWD/.git @@ -19,7 +18,6 @@ if test $? -ne 1 then say 'skipping git svn tests, svn not found' test_done - exit fi svnrepo=$PWD/svnrepo @@ -43,7 +41,6 @@ then fi say "$err" test_done - exit fi rawsvnrepo="$svnrepo" @@ -144,7 +141,6 @@ require_svnserve () { then say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)' test_done - exit fi } -- cgit v1.2.1 From 1b19ccd236e3369ac77d74ded207406ffbf9feca Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 3 Apr 2009 15:33:59 -0400 Subject: tests: skip perl tests if NO_PERL is defined These scripts all test git programs that are written in perl, and thus obviously won't work if NO_PERL is defined. We pass NO_PERL to the scripts from the building Makefile via the GIT-BUILD-OPTIONS file. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index cdd7ccdd2a..773d47cf3c 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -8,6 +8,10 @@ then say 'skipping git svn tests, NO_SVN_TESTS defined' test_done fi +if ! test_have_prereq PERL; then + say 'skipping git svn tests, perl not available' + test_done +fi GIT_DIR=$PWD/.git GIT_SVN_DIR=$GIT_DIR/svn/git-svn -- cgit v1.2.1 From da083d688e41f9a4328fab262f315f9e4fe52a32 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Fri, 8 May 2009 12:06:16 +0400 Subject: git-svn testsuite: use standard configuration for Subversion tools I have tweaked configuration in my ~/.subversion directory, namely I am running auto-properties and automatically adding '$Id$' expansion to every file. This choke the last test named 'proplist' from t9101-git-svn-props.sh, because one more property, svn:keywords is automatically added. I had just wrapped svn invocation with the svn_cmd that specifies empty directory via --config-dir argument. Since the latter is the global option, it should be recognized by all svn subcommands, so no regressions will be introduced. Now svn_cmd is used everywhere, not just in the failed test module: this should guard us from the future clashes with user-defined configuration tweaks. Signed-off-by: Eygene Ryabinkin Acked-by: Eric Wong --- t/lib-git-svn.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 773d47cf3c..5654962343 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -26,6 +26,8 @@ fi svnrepo=$PWD/svnrepo export svnrepo +svnconf=$PWD/svnconf +export svnconf perl -w -e " use SVN::Core; @@ -54,6 +56,19 @@ poke() { test-chmtime +1 "$1" } +# We need this, because we should pass empty configuration directory to +# the 'svn commit' to avoid automated property changes and other stuff +# that could be set from user's configuration files in ~/.subversion. +svn_cmd () { + [ -d "$svnconf" ] || mkdir "$svnconf" + orig_svncmd="$1"; shift + if [ -z "$orig_svncmd" ]; then + svn + return + fi + svn "$orig_svncmd" --config-dir "$svnconf" "$@" +} + for d in \ "$SVN_HTTPD_PATH" \ /usr/sbin/apache2 \ -- cgit v1.2.1 From 6f5748e14cc5bb0a836b649fb8e2d6a5eb166f1d Mon Sep 17 00:00:00 2001 From: Adam Brewster Date: Tue, 11 Aug 2009 23:14:27 -0400 Subject: svn: allow branches outside of refs/remotes It may be convenient for some users to store svn remote tracking branches outside of the refs/remotes/ heirarchy. To accomplish this feat, this patch includes the entire path to the ref in $r->{'refname'} in &read_all_remotes and tries to change references to this entry so the new value makes sense. [ew: fixed backwards compatibility, long lines] Signed-off-by: Adam Brewster Signed-off-by: Eric Wong --- t/lib-git-svn.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 5654962343..fd8631f906 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -14,7 +14,7 @@ if ! test_have_prereq PERL; then fi GIT_DIR=$PWD/.git -GIT_SVN_DIR=$GIT_DIR/svn/git-svn +GIT_SVN_DIR=$GIT_DIR/svn/refs/remotes/git-svn SVN_TREE=$GIT_SVN_DIR/svn-tree svn >/dev/null 2>&1 -- cgit v1.2.1 From a5e9c7dfe4732b560ab5dfc75e718bfda2027990 Mon Sep 17 00:00:00 2001 From: Sam Vilain Date: Tue, 20 Oct 2009 15:42:00 +1300 Subject: git-svn: allow test setup script to support PERL env. var Possibly the 'perl' in the PATH is not the one to be used for the tests; let PERL set in the environment select it. Signed-off-by: Sam Vilain Acked-by: Eric Wong --- t/lib-git-svn.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index fd8631f906..0f7f35ccc9 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -16,6 +16,7 @@ fi GIT_DIR=$PWD/.git GIT_SVN_DIR=$GIT_DIR/svn/refs/remotes/git-svn SVN_TREE=$GIT_SVN_DIR/svn-tree +PERL=${PERL:-perl} svn >/dev/null 2>&1 if test $? -ne 1 @@ -29,7 +30,7 @@ export svnrepo svnconf=$PWD/svnconf export svnconf -perl -w -e " +$PERL -w -e " use SVN::Core; use SVN::Repos; \$SVN::Core::VERSION gt '1.1.0' or exit(42); @@ -130,7 +131,7 @@ stop_httpd () { } convert_to_rev_db () { - perl -w -- - "$@" <<\EOF + $PERL -w -- - "$@" <<\EOF use strict; @ARGV == 2 or die "Usage: convert_to_rev_db "; open my $wr, '+>', $ARGV[1] or die "$!: couldn't open: $ARGV[1]"; -- cgit v1.2.1 From fadb5156e485e9d25c89d4b4f96c2d4fe6db6187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 24 Jun 2010 17:44:48 +0000 Subject: tests: Skip tests in a way that makes sense under TAP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SKIP messages are now part of the TAP plan. A TAP harness now knows why a particular test was skipped and can report that information. The non-TAP harness built into Git's test-lib did nothing special with these messages, and is unaffected by these changes. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 0f7f35ccc9..344785dd7d 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -5,11 +5,11 @@ git_svn_id=git""-svn-id if test -n "$NO_SVN_TESTS" then - say 'skipping git svn tests, NO_SVN_TESTS defined' + skip_all='skipping git svn tests, NO_SVN_TESTS defined' test_done fi if ! test_have_prereq PERL; then - say 'skipping git svn tests, perl not available' + skip_all='skipping git svn tests, perl not available' test_done fi -- cgit v1.2.1 From e8344e866655cfae1f870d7e8d5046c1bdf08adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 8 Jul 2010 01:16:06 +0000 Subject: tests: Use skip_all=* to skip tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change tests to skip with skip_all=* + test_done instead of using say + test_done. This is a follow-up to "tests: Skip tests in a way that makes sense under TAP" (fadb5156e4). I missed these cases when prepearing that patch, hopefully this is all of them. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 344785dd7d..c3f6676ca2 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -21,7 +21,7 @@ PERL=${PERL:-perl} svn >/dev/null 2>&1 if test $? -ne 1 then - say 'skipping git svn tests, svn not found' + skip_all='skipping git svn tests, svn not found' test_done fi @@ -40,13 +40,12 @@ x=$? if test $x -ne 0 then if test $x -eq 42; then - err='Perl SVN libraries must be >= 1.1.0' + skip_all='Perl SVN libraries must be >= 1.1.0' elif test $x -eq 41; then - err='svnadmin failed to create fsfs repository' + skip_all='svnadmin failed to create fsfs repository' else - err='Perl SVN libraries not found or unusable, skipping test' + skip_all='Perl SVN libraries not found or unusable' fi - say "$err" test_done fi @@ -159,7 +158,7 @@ EOF require_svnserve () { if test -z "$SVNSERVE_PORT" then - say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)' + skip_all='skipping svnserve test. (set $SVNSERVE_PORT to enable)' test_done fi } -- cgit v1.2.1 From 5536934239ed0a66fc5ac1d08cfd7e6a0905f80c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 10 Aug 2010 12:14:25 +0000 Subject: t/lib-git-svn.sh: use $PERL_PATH for perl, not perl from $PATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the git-svn tests to use $PERL_PATH, not the "perl" in $PATH. Using perl in $PATH was added by Sam Vilain in v1.6.6-rc0~95^2~3, Philippe Bruhat introduced $PERL_PATH to the test suite in v1.6.6-rc0~9^2, but the lib-git-svn.sh tests weren't updated to use the new convention. This resulted in the git-svn tests always being skipped on my system. My /usr/bin/perl has access to SVN::Core and SVN::Repos, but the perl in my $PATH does not. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index c3f6676ca2..92d6d31942 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -16,7 +16,6 @@ fi GIT_DIR=$PWD/.git GIT_SVN_DIR=$GIT_DIR/svn/refs/remotes/git-svn SVN_TREE=$GIT_SVN_DIR/svn-tree -PERL=${PERL:-perl} svn >/dev/null 2>&1 if test $? -ne 1 @@ -30,7 +29,7 @@ export svnrepo svnconf=$PWD/svnconf export svnconf -$PERL -w -e " +"$PERL_PATH" -w -e " use SVN::Core; use SVN::Repos; \$SVN::Core::VERSION gt '1.1.0' or exit(42); @@ -130,7 +129,7 @@ stop_httpd () { } convert_to_rev_db () { - $PERL -w -- - "$@" <<\EOF + "$PERL_PATH" -w -- - "$@" <<\EOF use strict; @ARGV == 2 or die "Usage: convert_to_rev_db "; open my $wr, '+>', $ARGV[1] or die "$!: couldn't open: $ARGV[1]"; -- cgit v1.2.1 From b6fe97483fdfec2176cf17dd38821cad0200a126 Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Tue, 14 Dec 2010 18:22:29 +0000 Subject: lib-git-svn.sh: Avoid setting web server variables unnecessarily If the SVN_HTTPD_PORT variable is not set, then we will not even attempt to start a web server in the start_httpd function (despite it's name), so there is no need to determine values for the SVN_HTTPD_PATH and SVN_HTTPD_MODULE_PATH variables. Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 92d6d31942..919d45a7d4 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -68,28 +68,31 @@ svn_cmd () { svn "$orig_svncmd" --config-dir "$svnconf" "$@" } -for d in \ - "$SVN_HTTPD_PATH" \ - /usr/sbin/apache2 \ - /usr/sbin/httpd \ -; do - if test -f "$d" - then - SVN_HTTPD_PATH="$d" - break - fi -done -for d in \ - "$SVN_HTTPD_MODULE_PATH" \ - /usr/lib/apache2/modules \ - /usr/libexec/apache2 \ -; do - if test -d "$d" - then - SVN_HTTPD_MODULE_PATH="$d" - break - fi -done +if test -n "$SVN_HTTPD_PORT" +then + for d in \ + "$SVN_HTTPD_PATH" \ + /usr/sbin/apache2 \ + /usr/sbin/httpd \ + ; do + if test -f "$d" + then + SVN_HTTPD_PATH="$d" + break + fi + done + for d in \ + "$SVN_HTTPD_MODULE_PATH" \ + /usr/lib/apache2/modules \ + /usr/libexec/apache2 \ + ; do + if test -d "$d" + then + SVN_HTTPD_MODULE_PATH="$d" + break + fi + done +fi start_httpd () { repo_base_path="$1" -- cgit v1.2.1 From cff484a98baf57f11daed62744bcf0774bd78c2f Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Tue, 14 Dec 2010 18:25:11 +0000 Subject: lib-git-svn.sh: Add check for mis-configured web server variables Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 919d45a7d4..6a9d975723 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -81,6 +81,11 @@ then break fi done + if test -z "$SVN_HTTPD_PATH" + then + skip_all='skipping git svn tests, Apache not found' + test_done + fi for d in \ "$SVN_HTTPD_MODULE_PATH" \ /usr/lib/apache2/modules \ @@ -92,6 +97,11 @@ then break fi done + if test -z "$SVN_HTTPD_MODULE_PATH" + then + skip_all='skipping git svn tests, Apache module dir not found' + test_done + fi fi start_httpd () { -- cgit v1.2.1 From 3aa30471065b212ee6563f3bfcb2de92a2bf2fa9 Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Thu, 30 Dec 2010 19:44:48 +0000 Subject: lib-git-svn.sh: Move web-server handling code into separate function This library file is currently sourced by 57 test files, of which only four may (optionally) start a web-server in order to access the svn repo via an http url, rather than a file url. In addition to isolating the current web-server handling code from the majority of tests, in a new prepare_httpd function, we also add some more error checking and reporting code to validate the apache installation. Only those tests which attempt to start the web-server, by calling start_httpd, will execute this code. Note that it is important for start_httpd to return an error indication, if prepare_httpd fails, so that the failure to use the web-server, as requested by the user, should not go unnoticed. (Unless the svnrepo variable is set to an http url at the end of start_httpd, the remaining tests will use file urls, without comment.) Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 't/lib-git-svn.sh') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 6a9d975723..199f22c231 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -68,8 +68,7 @@ svn_cmd () { svn "$orig_svncmd" --config-dir "$svnconf" "$@" } -if test -n "$SVN_HTTPD_PORT" -then +prepare_httpd () { for d in \ "$SVN_HTTPD_PATH" \ /usr/sbin/apache2 \ @@ -83,8 +82,8 @@ then done if test -z "$SVN_HTTPD_PATH" then - skip_all='skipping git svn tests, Apache not found' - test_done + echo >&2 '*** error: Apache not found' + return 1 fi for d in \ "$SVN_HTTPD_MODULE_PATH" \ @@ -99,23 +98,16 @@ then done if test -z "$SVN_HTTPD_MODULE_PATH" then - skip_all='skipping git svn tests, Apache module dir not found' - test_done - fi -fi - -start_httpd () { - repo_base_path="$1" - if test -z "$SVN_HTTPD_PORT" - then - echo >&2 'SVN_HTTPD_PORT is not defined!' - return + echo >&2 '*** error: Apache module dir not found' + return 1 fi - if test -z "$repo_base_path" + if test ! -f "$SVN_HTTPD_MODULE_PATH/mod_dav_svn.so" then - repo_base_path=svn + echo >&2 '*** error: Apache module "mod_dav_svn" not found' + return 1 fi + repo_base_path="${1-svn}" mkdir "$GIT_DIR"/logs cat > "$GIT_DIR/httpd.conf" < EOF +} + +start_httpd () { + if test -z "$SVN_HTTPD_PORT" + then + echo >&2 'SVN_HTTPD_PORT is not defined!' + return + fi + + prepare_httpd "$1" || return 1 + "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k start svnrepo="http://127.0.0.1:$SVN_HTTPD_PORT/$repo_base_path" } stop_httpd () { test -z "$SVN_HTTPD_PORT" && return + test ! -f "$GIT_DIR/httpd.conf" && return "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop } -- cgit v1.2.1