git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t9400: Add some more cvs update tests
@ 2007-05-13 17:49 Frank Lichtenheld
  2007-05-13 17:49 ` [PATCH] cvsserver: Add some basic pserver tests Frank Lichtenheld
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Lichtenheld @ 2007-05-13 17:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Frank Lichtenheld

Add some cvs update tests that include various merge
situations. Also add a basic test for update -C
since it fits so well in there.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
---
 t/t9400-git-cvsserver-server.sh |   66 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index d406a88..1d40ee8 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -123,4 +123,70 @@ test_expect_success 'cvs update (re-add deleted file)' \
    test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" &&
    diff -q testfile1 ../testfile1'
 
+cd "$WORKDIR"
+test_expect_success 'cvs update (merge)' \
+  'echo Line 0 >expected &&
+   for i in 1 2 3 4 5 6 7
+   do
+     echo Line $i >>merge
+     echo Line $i >>expected
+   done &&
+   echo Line 8 >>expected &&
+   git add merge &&
+   git commit -q -m "Merge test (pre-merge)" &&
+   git push gitcvs.git >/dev/null &&
+   cd cvswork &&
+   GIT_CONFIG="$git_config" cvs -Q update &&
+   test "$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))" = "merge/1.1/" &&
+   diff -q merge ../merge &&
+   ( echo Line 0; cat merge ) >merge.tmp &&
+   mv merge.tmp merge &&  
+   cd "$WORKDIR" &&
+   echo Line 8 >>merge &&
+   git add merge &&
+   git commit -q -m "Merge test (merge)" &&
+   git push gitcvs.git >/dev/null &&
+   cd cvswork &&
+   GIT_CONFIG="$git_config" cvs -Q update &&
+   diff -q merge ../expected'
+
+cd "$WORKDIR"
+test_expect_success 'cvs update (conflict merge)' \
+  '( echo LINE 0; cat merge ) >merge.tmp &&
+   mv merge.tmp merge &&
+   cat >expected.C <<EOF &&
+<<<<<<< merge.mine
+Line 0
+=======
+LINE 0
+>>>>>>> merge.3
+EOF
+   for i in 1 2 3 4 5 6 7 8
+   do
+     echo Line $i >>expected.C
+   done &&
+   git add merge &&
+   git commit -q -m "Merge test (conflict)" &&
+   git push gitcvs.git >/dev/null &&
+   cd cvswork &&
+   GIT_CONFIG="$git_config" cvs -Q update &&
+   diff -q merge ../expected.C'
+
+cd "$WORKDIR"
+test_expect_success 'cvs update (-C)' \
+  'cd cvswork &&
+   GIT_CONFIG="$git_config" cvs -Q update -C &&
+   diff -q merge ../merge'
+
+cd "$WORKDIR"
+test_expect_success 'cvs update (merge no-op)' \
+   'echo Line 9 >>merge &&
+    cp merge cvswork/merge &&
+    git add merge &&
+    git commit -q -m "Merge test (no-op)" &&
+    git push gitcvs.git >/dev/null &&
+    cd cvswork &&
+    GIT_CONFIG="$git_config" cvs -Q update &&
+    diff -q merge ../merge'
+
 test_done
-- 
1.5.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] cvsserver: Add some basic pserver tests
  2007-05-13 17:49 [PATCH] t9400: Add some more cvs update tests Frank Lichtenheld
@ 2007-05-13 17:49 ` Frank Lichtenheld
  2007-05-13 18:38   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Lichtenheld @ 2007-05-13 17:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Frank Lichtenheld

While we can easily test the cvs <-> git-cvsserver
communication with :fork: and git-cvsserver server
there are some pserver specifics we should test, too.

Currently this are two tests of the pserver authentication.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
---
 t/t9410-git-cvsserver-pserver.sh |   53 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
 create mode 100644 t/t9410-git-cvsserver-pserver.sh

diff --git a/t/t9410-git-cvsserver-pserver.sh b/t/t9410-git-cvsserver-pserver.sh
new file mode 100644
index 0000000..1cf9bc7
--- /dev/null
+++ b/t/t9410-git-cvsserver-pserver.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+# 
+# Copyright (c) 2007 Frank Lichtenheld
+#
+
+test_description='git-cvsserver pserver access
+
+tests some pserver specific features (like
+authentication).'
+
+. ./test-lib.sh
+
+unset GIT_DIR GIT_CONFIG
+WORKDIR=$(pwd)
+SERVERDIR=$(pwd)/gitcvs.git
+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
+
+test_expect_success 'authentication' \
+  'cat <<EOF | git-cvsserver pserver >log 2>&1 &&
+BEGIN AUTH REQUEST
+$SERVERDIR
+anonymous
+
+END AUTH REQUEST
+EOF
+   tail -n1 log | grep -q "^I LOVE YOU$"'
+
+test_expect_success 'authentication failure (non-anonymous user)' \
+  'if cat <<EOF | git-cvsserver pserver >log 2>&1
+BEGIN AUTH REQUEST
+$SERVERDIR
+git
+
+END AUTH REQUEST
+EOF
+   then
+       false
+   else
+       true
+   fi &&
+   tail -n1 log | grep -q "^I HATE YOU$"'
+
+
+test_done
-- 
1.5.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cvsserver: Add some basic pserver tests
  2007-05-13 17:49 ` [PATCH] cvsserver: Add some basic pserver tests Frank Lichtenheld
@ 2007-05-13 18:38   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-05-13 18:38 UTC (permalink / raw)
  To: Frank Lichtenheld; +Cc: git

Frank Lichtenheld <frank@lichtenheld.de> writes:

> While we can easily test the cvs <-> git-cvsserver
> communication with :fork: and git-cvsserver server
> there are some pserver specifics we should test, too.
>
> Currently this are two tests of the pserver authentication.
>
> Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
>...
> +test_expect_success 'authentication' \
> +  'cat <<EOF | git-cvsserver pserver >log 2>&1 &&
> +BEGIN AUTH REQUEST
> +$SERVERDIR
> +anonymous
> +
> +END AUTH REQUEST
> +EOF
> +   tail -n1 log | grep -q "^I LOVE YOU$"'

In the past, some people with non-bash shells had trouble with
here text (i.e. <<HERE) inside our test scripts Either our use
of eval to run the test in test_expect_success is not kosher, or
their implementation of eval was slightly broken --- I do not
recall if we ever dug down to the bottom of the problem.  That
is why most tests have here-text to prepare test vectors outside
of tests themselves.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-13 18:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-13 17:49 [PATCH] t9400: Add some more cvs update tests Frank Lichtenheld
2007-05-13 17:49 ` [PATCH] cvsserver: Add some basic pserver tests Frank Lichtenheld
2007-05-13 18:38   ` Junio C Hamano

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).