From: Clemens Buchacher <drizzd@aon.at>
To: spearce@spearce.org
Cc: Mark Lodato <lodatom@gmail.com>,
git@vger.kernel.org, Clemens Buchacher <drizzd@aon.at>
Subject: [PATCH 3/3] add smart HTTP tests
Date: Sun, 25 Oct 2009 13:06:20 +0100 [thread overview]
Message-ID: <1256472380-924-4-git-send-email-drizzd@aon.at> (raw)
In-Reply-To: <1256472380-924-3-git-send-email-drizzd@aon.at>
Set LIB_HTTPD_GIT to enable smart HTTP tests.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---
t/lib-httpd.sh | 9 +++++++++
t/lib-httpd/apache.conf | 36 +++++++++++++++++++++++++++---------
t/t5540-http-push.sh | 46 ++++++++++++++++++++++++++++------------------
3 files changed, 64 insertions(+), 27 deletions(-)
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 6765b08..aaa0a71 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -88,6 +88,15 @@ prepare_httpd() {
svnrepo="http://127.0.0.1:$LIB_HTTPD_PORT/svn"
fi
fi
+
+ if test -n "$LIB_HTTPD_GIT"
+ then
+ HTTPD_PARA="$HTTPD_PARA -DGIT"
+ fi
+
+ HTTPD_GIT_PATH=$HTTPD_DOCUMENT_ROOT_PATH/git
+ mkdir -p "$HTTPD_GIT_PATH"
+ HTTPD_GIT_URL="$HTTPD_URL/git"
}
start_httpd() {
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 21aa42f..d8505f1 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -10,15 +10,15 @@ ErrorLog error.log
</IfModule>
<IfDefine SSL>
-LoadModule ssl_module modules/mod_ssl.so
-
-SSLCertificateFile httpd.pem
-SSLCertificateKeyFile httpd.pem
-SSLRandomSeed startup file:/dev/urandom 512
-SSLRandomSeed connect file:/dev/urandom 512
-SSLSessionCache none
-SSLMutex file:ssl_mutex
-SSLEngine On
+ LoadModule ssl_module modules/mod_ssl.so
+
+ SSLCertificateFile httpd.pem
+ SSLCertificateKeyFile httpd.pem
+ SSLRandomSeed startup file:/dev/urandom 512
+ SSLRandomSeed connect file:/dev/urandom 512
+ SSLSessionCache none
+ SSLMutex file:ssl_mutex
+ SSLEngine On
</IfDefine>
<IfDefine DAV>
@@ -39,3 +39,21 @@ SSLEngine On
SVNPath svnrepo
</Location>
</IfDefine>
+
+<IfDefine GIT>
+ LoadModule cgi_module modules/mod_cgi.so
+ LoadModule alias_module modules/mod_alias.so
+ LoadModule actions_module modules/mod_actions.so
+ ScriptAlias /git-http-backend ${GIT_EXEC_PATH}/git-http-backend
+
+ <Location /git>
+ SetHandler git-http-backend
+ Action git-http-backend /git-http-backend virtual
+ </Location>
+ <Directory ${GIT_EXEC_PATH}>
+ Options None
+ </Directory>
+ <Files ${GIT_EXEC_PATH}/git-http-backend>
+ Options ExecCGI
+ </Files>
+</IfDefine>
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index 2ece661..74ca08d 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -10,7 +10,10 @@ This test runs various sanity checks on http-push.'
. ./test-lib.sh
ROOT_PATH="$PWD"
-LIB_HTTPD_DAV=t
+if test -z "$LIB_HTTPD_GIT"
+then
+ LIB_HTTPD_DAV=t
+fi
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5540'}
if git http-push > /dev/null 2>&1 || [ $? -eq 128 ]
@@ -34,16 +37,21 @@ test_expect_success 'setup remote repository' '
cd - &&
git clone --bare test_repo test_repo.git &&
cd test_repo.git &&
- git --bare update-server-info &&
- mv hooks/post-update.sample hooks/post-update &&
ORIG_HEAD=$(git rev-parse --verify HEAD) &&
- cd - &&
- mv test_repo.git "$HTTPD_DOCUMENT_ROOT_PATH"
+ if test -n "$LIB_HTTPD_GIT"
+ then
+ git config http.receivepack true
+ else
+ git --bare update-server-info &&
+ mv hooks/post-update.sample hooks/post-update
+ fi
+ cd -
+ mv test_repo.git "$HTTPD_GIT_PATH"
'
test_expect_success 'clone remote repository' '
cd "$ROOT_PATH" &&
- git clone $HTTPD_URL/test_repo.git test_repo_clone
+ git clone $HTTPD_GIT_URL/test_repo.git test_repo_clone
'
test_expect_success 'push to remote repository with packed refs' '
@@ -54,7 +62,7 @@ test_expect_success 'push to remote repository with packed refs' '
git commit -m path2 &&
HEAD=$(git rev-parse --verify HEAD) &&
git push &&
- (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
+ (cd "$HTTPD_GIT_PATH"/test_repo.git &&
test $HEAD = $(git rev-parse --verify HEAD))
'
@@ -63,20 +71,20 @@ test_expect_success 'push already up-to-date' '
'
test_expect_success 'push to remote repository with unpacked refs' '
- (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
+ (cd "$HTTPD_GIT_PATH"/test_repo.git &&
rm packed-refs &&
git update-ref refs/heads/master $ORIG_HEAD &&
git --bare update-server-info) &&
git push &&
- (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
+ (cd "$HTTPD_GIT_PATH"/test_repo.git &&
test $HEAD = $(git rev-parse --verify HEAD))
'
test_expect_success 'http-push fetches unpacked objects' '
- cp -R "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
- "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_unpacked.git &&
+ cp -R "$HTTPD_GIT_PATH"/test_repo.git \
+ "$HTTPD_GIT_PATH"/test_repo_unpacked.git &&
- git clone $HTTPD_URL/test_repo_unpacked.git \
+ git clone $HTTPD_GIT_URL/test_repo_unpacked.git \
"$ROOT_PATH"/fetch_unpacked &&
# By reset, we force git to retrieve the object
@@ -85,17 +93,17 @@ test_expect_success 'http-push fetches unpacked objects' '
git remote rm origin &&
git reflog expire --expire=0 --all &&
git prune &&
- git push -f -v $HTTPD_URL/test_repo_unpacked.git master)
+ git push -f -v $HTTPD_GIT_URL/test_repo_unpacked.git master)
'
test_expect_success 'http-push fetches packed objects' '
- cp -R "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
- "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_packed.git &&
+ cp -R "$HTTPD_GIT_PATH"/test_repo.git \
+ "$HTTPD_GIT_PATH"/test_repo_packed.git &&
- git clone $HTTPD_URL/test_repo_packed.git \
+ git clone $HTTPD_GIT_URL/test_repo_packed.git \
"$ROOT_PATH"/test_repo_clone_packed &&
- (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_packed.git &&
+ (cd "$HTTPD_GIT_PATH"/test_repo_packed.git &&
git --bare repack &&
git --bare prune-packed) &&
@@ -105,7 +113,7 @@ test_expect_success 'http-push fetches packed objects' '
git remote rm origin &&
git reflog expire --expire=0 --all &&
git prune &&
- git push -f -v $HTTPD_URL/test_repo_packed.git master)
+ git push -f -v $HTTPD_GIT_URL/test_repo_packed.git master)
'
test_expect_success 'create and delete remote branch' '
@@ -122,6 +130,7 @@ test_expect_success 'create and delete remote branch' '
test_must_fail git show-ref --verify refs/remotes/origin/dev
'
+test -n "$LIB_HTTPD_GIT" ||
test_expect_success 'MKCOL sends directory names with trailing slashes' '
! grep "\"MKCOL.*[^/] HTTP/[^ ]*\"" < "$HTTPD_ROOT_PATH"/access.log
@@ -134,6 +143,7 @@ x5="$x1$x1$x1$x1$x1"
x38="$x5$x5$x5$x5$x5$x5$x5$x1$x1$x1"
x40="$x38$x2"
+test -n "$LIB_HTTPD_GIT" ||
test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '
sed -e "s/PUT /OP /" -e "s/MOVE /OP /" "$HTTPD_ROOT_PATH"/access.log |
grep -e "\"OP .*/objects/$x2/${x38}_$x40 HTTP/[.0-9]*\" 20[0-9] "
--
1.6.5.35.ge41a3
next prev parent reply other threads:[~2009-10-25 12:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-25 12:06 Smart HTTP tests Clemens Buchacher
2009-10-25 12:06 ` [PATCH 1/3] update http tests according to remote-curl capabilities Clemens Buchacher
2009-10-25 12:06 ` [PATCH 2/3] remote-helpers: return successfully if everything up-to-date Clemens Buchacher
2009-10-25 12:06 ` Clemens Buchacher [this message]
2009-10-28 0:17 ` [PATCH 3/3] add smart HTTP tests Shawn O. Pearce
2009-10-28 17:52 ` [PATCH] t5540: test both smart and dumb protocols Clemens Buchacher
2009-10-28 0:11 ` [PATCH 2/3] remote-helpers: return successfully if everything up-to-date Shawn O. Pearce
2009-10-28 7:18 ` Junio C Hamano
2009-10-28 0:10 ` [PATCH 1/3] update http tests according to remote-curl capabilities Shawn O. Pearce
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=1256472380-924-4-git-send-email-drizzd@aon.at \
--to=drizzd@aon.at \
--cc=git@vger.kernel.org \
--cc=lodatom@gmail.com \
--cc=spearce@spearce.org \
/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).