From: Dmitry Ivankov <divanorama@gmail.com>
To: git@vger.kernel.org
Cc: Jonathan Nieder <jrnieder@gmail.com>,
David Barr <davidbarr@google.com>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Dmitry Ivankov <divanorama@gmail.com>
Subject: [PATCH v2 4/9] svn-fe: add a test for remote-svn-alpha
Date: Wed, 13 Jul 2011 21:26:48 +0600 [thread overview]
Message-ID: <1310570813-16648-5-git-send-email-divanorama@gmail.com> (raw)
In-Reply-To: <1310570813-16648-1-git-send-email-divanorama@gmail.com>
The test creates a few svn repositories from fixed dumps using svnadmin.
Currently it checks for crashes on first time import mostly.
Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
contrib/svn-fe/t/.gitignore | 3 +
contrib/svn-fe/t/t9010-remote-svn-alpha.sh | 259 ++++++++++++++++++++++++++++
2 files changed, 262 insertions(+), 0 deletions(-)
create mode 100644 contrib/svn-fe/t/.gitignore
create mode 100755 contrib/svn-fe/t/t9010-remote-svn-alpha.sh
diff --git a/contrib/svn-fe/t/.gitignore b/contrib/svn-fe/t/.gitignore
new file mode 100644
index 0000000..4e731dc
--- /dev/null
+++ b/contrib/svn-fe/t/.gitignore
@@ -0,0 +1,3 @@
+/trash directory*
+/test-results
+/.prove
diff --git a/contrib/svn-fe/t/t9010-remote-svn-alpha.sh b/contrib/svn-fe/t/t9010-remote-svn-alpha.sh
new file mode 100755
index 0000000..92bc4b2
--- /dev/null
+++ b/contrib/svn-fe/t/t9010-remote-svn-alpha.sh
@@ -0,0 +1,259 @@
+#!/bin/sh
+
+test_description='check svn-alpha remote helper'
+
+PATH=$(pwd)/..:$PATH
+TEST_DIRECTORY=$(pwd)/../../../t
+. $TEST_DIRECTORY/test-lib.sh
+
+if command -v svnrdump >/dev/null; then
+ test_set_prereq SVNRDUMP
+fi
+
+deinit_git () {
+ rm -fr .git
+}
+
+reinit_git () {
+ deinit_git &&
+ git init
+}
+
+properties () {
+ while test "$#" -ne 0
+ do
+ property="$1" &&
+ value="$2" &&
+ printf "%s\n" "K ${#property}" &&
+ printf "%s\n" "$property" &&
+ printf "%s\n" "V ${#value}" &&
+ printf "%s\n" "$value" &&
+ shift 2 ||
+ return 1
+ done
+}
+
+text_no_props () {
+ text="$1
+" &&
+ printf "%s\n" "Prop-content-length: 10" &&
+ printf "%s\n" "Text-content-length: ${#text}" &&
+ printf "%s\n" "Content-length: $((${#text} + 10))" &&
+ printf "%s\n" "" "PROPS-END" &&
+ printf "%s\n" "$text"
+}
+
+dump_to_svnrepo () {
+ dump="$1" &&
+ path="$2" &&
+ svnadmin create "$path" &&
+ svnadmin load "$path" < "$dump"
+}
+
+svnurl () {
+ printf "svn-alpha::file://%s/%s" "$(pwd)" "$1"
+}
+
+test_nr_revs () {
+ n=$1 &&
+ repo=$2 &&
+ ref=$3 &&
+ git --git-dir="$repo" log --format=oneline "$ref" >revs &&
+ test_line_count = "$n" revs
+}
+
+test_expect_success 'svnadmin is present' '
+ command -v svnadmin &&
+ test_set_prereq SVNADMIN
+'
+
+test_expect_success SVNADMIN 'create empty svnrepo' '
+ echo "SVN-fs-dump-format-version: 2" > empty.dump &&
+ dump_to_svnrepo empty.dump empty.svn &&
+ test_set_prereq EMPTY_SVN
+'
+
+test_expect_success SVNADMIN 'create tiny svnrepo' '
+ {
+ properties \
+ svn:author author@example.com \
+ svn:date "1999-02-01T00:01:002.000000Z" \
+ svn:log "add directory with some files in it" &&
+ echo PROPS-END
+ } >props &&
+ {
+ cat <<-EOF &&
+ SVN-fs-dump-format-version: 3
+
+ Revision-number: 1
+ EOF
+ echo Prop-content-length: $(wc -c <props) &&
+ echo Content-length: $(wc -c <props) &&
+ echo &&
+ cat props &&
+ cat <<-\EOF &&
+
+ Node-path: directory
+ Node-kind: dir
+ Node-action: add
+ Prop-content-length: 10
+ Content-length: 10
+
+ PROPS-END
+ Node-path: directory/somefile
+ Node-kind: file
+ Node-action: add
+ EOF
+ text_no_props hi
+ } >tiny.dump &&
+ dump_to_svnrepo tiny.dump tiny.svn &&
+ test_set_prereq TINY_SVN
+'
+
+test_expect_success SVNADMIN 'create small svndump' '
+ {
+ properties \
+ svn:author author@example.com \
+ svn:date "1999-02-01T00:01:002.000000Z" \
+ svn:log "add directory with some files in it" &&
+ echo PROPS-END
+ } >props &&
+ {
+ echo Prop-content-length: $(wc -c <props) &&
+ echo Content-length: $(wc -c <props) &&
+ echo &&
+ cat props
+ } >props_dump &&
+ cat >small.dump.r0 <<-EOF &&
+ SVN-fs-dump-format-version: 3
+ EOF
+ for x in `seq 1 1 10`; do
+ {
+ echo &&
+ echo "Revision-number: $x" &&
+ cat props_dump &&
+
+ if test "$x" -eq "1"; then
+ cat <<-\EOF
+
+ Node-path: directory
+ Node-kind: dir
+ Node-action: add
+ Prop-content-length: 10
+ Content-length: 10
+
+ PROPS-END
+
+ EOF
+ fi
+ echo "Node-path: directory/somefile$x" &&
+ echo "Node-kind: file" &&
+ echo "Node-action: add" &&
+ text_no_props hi
+ } >small.dump.r$x
+ done &&
+ test_set_prereq SMALL_SVNDUMP
+'
+
+test_expect_success SMALL_SVNDUMP 'create small svnrepo' '
+ rm -rf small.svn* &&
+ svnadmin create small.svn &&
+ for x in `seq 1 1 10`; do
+ cat small.dump.r0 small.dump.r$x >part.dump &&
+ svnadmin load small.svn <part.dump &&
+ cp -r small.svn small.svn.r0-$x
+ done &&
+ test_set_prereq SMALL_SVN
+'
+
+test_expect_failure EMPTY_SVN 'fetch empty' '
+ reinit_git &&
+ url=$(svnurl empty.svn) &&
+ git remote add svn "$url" &&
+ git fetch svn
+'
+
+test_expect_failure TINY_SVN 'clone tiny' '
+ deinit_git &&
+ url=$(svnurl tiny.svn) &&
+ git clone "$url" tiny1.git &&
+ test_nr_revs 1 tiny1.git refs/remotes/origin/master
+'
+
+test_expect_success TINY_SVN 'clone --mirror tiny' '
+ deinit_git &&
+ url=$(svnurl tiny.svn) &&
+ git clone --mirror "$url" tiny2.git &&
+ test_nr_revs 1 tiny2.git refs/heads/master
+'
+
+test_expect_success TINY_SVN 'clone --bare tiny' '
+ deinit_git &&
+ url=$(svnurl tiny.svn) &&
+ git clone --bare "$url" tiny3.git &&
+ test_nr_revs 1 tiny3.git refs/heads/master
+'
+
+test_expect_success TINY_SVN 'clone -b master tiny' '
+ deinit_git &&
+ url=$(svnurl tiny.svn) &&
+ git clone -b master "$url" tiny4.git &&
+ test_nr_revs 1 tiny4.git/.git refs/heads/master
+'
+
+test_expect_success SMALL_SVN 'clone -b master small' '
+ deinit_git &&
+ url=$(svnurl small.svn) &&
+ git clone -b master "$url" small.git &&
+ test_nr_revs 10 small.git/.git refs/heads/master
+'
+
+test_expect_success TINY_SVN,SVNRDUMP 'no crash on clone url/path' '
+ deinit_git &&
+ url=$(svnurl small.svn)/directory &&
+ git clone -b master "$url" small_dir.git &&
+ test_nr_revs 10 small_dir.git/.git refs/heads/master
+'
+
+test_expect_success TINY_SVN,SVNRDUMP 'no crash on clone url/path/file' '
+ deinit_git &&
+ url=$(svnurl small.svn)/directory/somefile3 &&
+ git clone -b master "$url" small_dir_file.git &&
+ test_nr_revs 10 small_dir_file.git/.git refs/heads/master
+'
+
+test_expect_success SMALL_SVN 'fetch each rev of SMALL separately' '
+ reinit_git &&
+ url=$(svnurl small.svn) &&
+
+ for x in `seq 1 1 10`; do
+ git remote add svn_$x "$url.r0-$x"
+ done &&
+ git remote update &&
+
+ git remote add svn "$url" &&
+ git fetch svn &&
+
+ git rev-parse -s remotes/svn_7/master~5 >ref7_2 &&
+ git rev-parse -s remotes/svn/master~8 >ref_2 &&
+ test_cmp ref7_2 ref_2
+'
+
+test_expect_success SMALL_SVN 'fetch updates from SMALL' '
+ reinit_git &&
+ url=$(svnurl link.svn) &&
+ git remote add svn "$url" &&
+
+ ln -sfn small.svn.r0-5 link.svn &&
+ git fetch svn &&
+ test_nr_revs 5 .git refs/remotes/svn/master &&
+
+ ln -sfn small.svn.r0-10 link.svn &&
+ git fetch svn &&
+ test_nr_revs 10 .git refs/remotes/svn/master &&
+
+ git fetch svn &&
+ test_nr_revs 10 .git refs/remotes/svn/master
+'
+
+test_done
--
1.7.3.4
next prev parent reply other threads:[~2011-07-13 15:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-13 15:26 [GSoC'11] [PATCH/RFC v2 0/9] remote-svn-alpha updates Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 1/9] svn-fe: use svnrdump --quiet in remote-svn-alpha Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 2/9] svn-fe: avoid error on no-op imports " Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 3/9] svn-fe: allow svnadmin instead of svnrdump " Dmitry Ivankov
2011-07-13 15:26 ` Dmitry Ivankov [this message]
2011-07-13 15:26 ` [PATCH v2 5/9] svn-fe: use svn-fe --no-progress " Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 6/9] svn-fe: use proper refspec " Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 7/9] svn-fe: write svnrev notes " Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 8/9] svn-fe: import incrementally in svn-remote-alpha Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 9/9] svn-fe: reuse import-marks in remote-svn-alpha Dmitry Ivankov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1310570813-16648-5-git-send-email-divanorama@gmail.com \
--to=divanorama@gmail.com \
--cc=artagnon@gmail.com \
--cc=davidbarr@google.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).