* [PATCH/RFC] git-cvsserver: Add a basic test file for cvsserver
@ 2007-04-29 20:10 Frank Lichtenheld
2007-05-01 8:50 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Frank Lichtenheld @ 2007-04-29 20:10 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Martin Langhoff, Frank Lichtenheld
Contains only one test (checkout) at this point and is
mostly indented to be used as a RFC to discuss
how to properly implement tests for git-cvsserver.
Currently the test uses netcat to run git-cvsserver
pserver on a unprivilegded port.
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
---
t/t9400-git-cvsserver-read.sh | 56 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
create mode 100644 t/t9400-git-cvsserver-read.sh
Since this is my first test script for git I would welcome comments
and suggestions. Especially if someone has a simpler method of
testing it than the somewhat fragile netcat hack I used.
diff --git a/t/t9400-git-cvsserver-read.sh b/t/t9400-git-cvsserver-read.sh
new file mode 100644
index 0000000..311d6c5
--- /dev/null
+++ b/t/t9400-git-cvsserver-read.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Frank Lichtenheld
+#
+
+test_description='git-cvsserver read access
+
+tests read access to a git repository with the
+cvs CLI client via git-cvsserver pserver'
+
+. ./test-lib.sh
+
+cvs >/dev/null 2>&1
+if test $? -ne 1
+then
+ test_expect_success 'skipping git-cvsserver tests, cvs not found' :
+ test_done
+ exit
+fi
+netcat -h >/dev/null 2>&1
+if test $? -ne 1
+then
+ test_expect_success 'skipping git-cvsserver tests, netcat not found' :
+ test_done
+ exit
+fi
+
+unset GIT_DIR GIT_CONFIG
+WORKDIR=$(pwd)
+SERVERDIR=$(pwd)/gitcvs.git
+CVSROOT=":pserver:anonymous@localhost:12345$SERVERDIR"
+CVSWORK=$(pwd)/cvswork
+export CVSROOT CVSWORK
+
+rm -rf "$CVSWORK" "$SERVERDIR"
+echo >empty &&
+ git add empty &&
+ git commit -q -m "First Commit" &&
+ git clone -q --local --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
+ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true ||
+ exit 1
+
+start_pserver () {
+ netcat -l -p 12345 -c "git-cvsserver pserver" localhost &
+ echo $! >nc.pid
+}
+start_pserver
+
+# note that cvs doesn't accept absolute pathnames
+# as argument to co -d
+test_expect_success 'basic checkout' \
+ "cvs -Q co -d cvswork master"
+
+kill $(cat nc.pid) 2>/dev/null
+
+test_done
--
1.5.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH/RFC] git-cvsserver: Add a basic test file for cvsserver
2007-04-29 20:10 [PATCH/RFC] git-cvsserver: Add a basic test file for cvsserver Frank Lichtenheld
@ 2007-05-01 8:50 ` Junio C Hamano
2007-05-01 11:29 ` Frank Lichtenheld
2007-05-02 0:45 ` [PATCH] cvsserver: Add test cases for git-cvsserver Frank Lichtenheld
0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-05-01 8:50 UTC (permalink / raw)
To: Frank Lichtenheld; +Cc: git, Martin Langhoff
Frank Lichtenheld <frank@lichtenheld.de> writes:
> Contains only one test (checkout) at this point and is
> mostly indented to be used as a RFC to discuss
> how to properly implement tests for git-cvsserver.
>
> Currently the test uses netcat to run git-cvsserver
> pserver on a unprivilegded port.
>
> Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
> ---
> t/t9400-git-cvsserver-read.sh | 56 +++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 56 insertions(+), 0 deletions(-)
> create mode 100644 t/t9400-git-cvsserver-read.sh
>
> Since this is my first test script for git I would welcome comments
> and suggestions. Especially if someone has a simpler method of
> testing it than the somewhat fragile netcat hack I used.
Yes, before reading this three-line paragraph, use of netcat and
hardcoded port number made my eyebrows raise.
But a git-cvsserver test suite that can be run from "make test"
is a really good thing to have for us.
I haven't pursued this but have you considered :fork: connect
method instead of :ext:, so that you do not have to use pserver
nor ssh connection?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH/RFC] git-cvsserver: Add a basic test file for cvsserver
2007-05-01 8:50 ` Junio C Hamano
@ 2007-05-01 11:29 ` Frank Lichtenheld
2007-05-02 0:45 ` [PATCH] cvsserver: Add test cases for git-cvsserver Frank Lichtenheld
1 sibling, 0 replies; 4+ messages in thread
From: Frank Lichtenheld @ 2007-05-01 11:29 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Martin Langhoff
On Tue, May 01, 2007 at 01:50:12AM -0700, Junio C Hamano wrote:
> But a git-cvsserver test suite that can be run from "make test"
> is a really good thing to have for us.
>
> I haven't pursued this but have you considered :fork: connect
> method instead of :ext:, so that you do not have to use pserver
> nor ssh connection?
Ok, I have to confess I never heard of :fork: before :| (or forgot about
it again)
Thanks for the tip...
Gruesse,
--
Frank Lichtenheld <frank@lichtenheld.de>
www: http://www.djpig.de/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] cvsserver: Add test cases for git-cvsserver
2007-05-01 8:50 ` Junio C Hamano
2007-05-01 11:29 ` Frank Lichtenheld
@ 2007-05-02 0:45 ` Frank Lichtenheld
1 sibling, 0 replies; 4+ messages in thread
From: Frank Lichtenheld @ 2007-05-02 0:45 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Martin Langhoff, Frank Lichtenheld
Use the :fork: access method to force cvs to
call "$CVS_SERVER server" even when accessing a local
repository.
Add a basic test for checkout and some tests for update.
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
---
t/t9400-git-cvsserver-server.sh | 120 +++++++++++++++++++++++++++++++++++++++
1 files changed, 120 insertions(+), 0 deletions(-)
create mode 100644 t/t9400-git-cvsserver-server.sh
Still my first test cases so careful review and comments
on style and implementation would be very welcome :)
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
new file mode 100644
index 0000000..19b504b
--- /dev/null
+++ b/t/t9400-git-cvsserver-server.sh
@@ -0,0 +1,120 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Frank Lichtenheld
+#
+
+test_description='git-cvsserver access
+
+tests read access to a git repository with the
+cvs CLI client via git-cvsserver server'
+
+. ./test-lib.sh
+
+cvs >/dev/null 2>&1
+if test $? -ne 1
+then
+ test_expect_success 'skipping git-cvsserver tests, cvs not found' :
+ test_done
+ exit
+fi
+
+unset GIT_DIR GIT_CONFIG
+WORKDIR=$(pwd)
+SERVERDIR=$(pwd)/gitcvs.git
+CVSROOT=":fork:$SERVERDIR"
+CVSWORK=$(pwd)/cvswork
+CVS_SERVER=git-cvsserver
+export CVSROOT CVS_SERVER
+
+rm -rf "$CVSWORK" "$SERVERDIR"
+echo >empty &&
+ git add empty &&
+ git commit -q -m "First Commit" &&
+ git clone -q --local --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
+ GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
+ GIT_DIR="$SERVERDIR" git config --bool gitcvs.logfile "$SERVERDIR/gitcvs.log" ||
+ exit 1
+
+# note that cvs doesn't accept absolute pathnames
+# as argument to co -d
+test_expect_success 'basic checkout' \
+ 'cvs -Q co -d cvswork master &&
+ test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))" = "empty/1.1/"'
+
+test_expect_success 'cvs update (create new file)' \
+ 'echo testfile1 >testfile1 &&
+ git add testfile1 &&
+ git commit -q -m "Add testfile1" &&
+ git push gitcvs.git >/dev/null &&
+ cd cvswork &&
+ cvs -Q update &&
+ test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.1/" &&
+ diff -q testfile1 ../testfile1'
+
+cd "$WORKDIR"
+test_expect_success 'cvs update (update existing file)' \
+ 'echo line 2 >>testfile1 &&
+ git add testfile1 &&
+ git commit -q -m "Append to testfile1" &&
+ git push gitcvs.git >/dev/null &&
+ cd cvswork &&
+ cvs -Q update &&
+ test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.2/" &&
+ diff -q testfile1 ../testfile1'
+
+cd "$WORKDIR"
+#TODO: cvsserver doesn't support update w/o -d
+test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" \
+ 'mkdir test &&
+ echo >test/empty &&
+ git add test &&
+ git commit -q -m "Single Subdirectory" &&
+ git push gitcvs.git >/dev/null &&
+ cd cvswork &&
+ cvs -Q update &&
+ test ! -d test'
+
+cd "$WORKDIR"
+test_expect_success 'cvs update (subdirectories)' \
+ '(for dir in A A/B A/B/C A/D E; do
+ mkdir $dir &&
+ echo "test file in $dir" >"$dir/file_in_$(echo $dir|sed -e "s#/# #g")" &&
+ git add $dir;
+ done) &&
+ git commit -q -m "deep sub directory structure" &&
+ git push gitcvs.git >/dev/null &&
+ cd cvswork &&
+ cvs -Q update -d &&
+ (for dir in A A/B A/B/C A/D E; do
+ filename="file_in_$(echo $dir|sed -e "s#/# #g")" &&
+ if test "$(echo $(grep -v ^D $dir/CVS/Entries|cut -d/ -f2,3,5))" = "$filename/1.1/" &&
+ diff -q "$dir/$filename" "../$dir/$filename"; then
+ :
+ else
+ echo >failure
+ fi
+ done) &&
+ test ! -f failure'
+
+cd "$WORKDIR"
+test_expect_success 'cvs update (delete file)' \
+ 'git rm testfile1 &&
+ git commit -q -m "Remove testfile1" &&
+ git push gitcvs.git >/dev/null &&
+ cd cvswork &&
+ cvs -Q update &&
+ test -z "$(grep testfile1 CVS/Entries)" &&
+ test ! -f testfile1'
+
+cd "$WORKDIR"
+test_expect_success 'cvs update (re-add deleted file)' \
+ 'echo readded testfile >testfile1 &&
+ git add testfile1 &&
+ git commit -q -m "Re-Add testfile1" &&
+ git push gitcvs.git >/dev/null &&
+ cd cvswork &&
+ cvs -Q update &&
+ test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" &&
+ diff -q testfile1 ../testfile1'
+
+test_done
--
1.5.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-05-02 0:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-29 20:10 [PATCH/RFC] git-cvsserver: Add a basic test file for cvsserver Frank Lichtenheld
2007-05-01 8:50 ` Junio C Hamano
2007-05-01 11:29 ` Frank Lichtenheld
2007-05-02 0:45 ` [PATCH] cvsserver: Add test cases for git-cvsserver Frank Lichtenheld
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).