[PATCH] cvsserver: Add some basic pserver tests
From: Frank Lichtenheld <hidden>
Date: 2016-06-15 22:43:10
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted> --- 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