From: Matthias Lederhofer <matled@gmx.net>
To: git@vger.kernel.org
Subject: [RFC] gitweb test script
Date: Sun, 6 Aug 2006 18:51:51 +0200 [thread overview]
Message-ID: <20060806165151.GB9548@moooo.ath.cx> (raw)
Perhaps this script has a place in the git repository. Creating some automated
tests at least checking for warnings should be easy too. This should work from
the git repository and makes gitweb use .git as repository. At the moment it
still needs the git binary to be in the path already to find the top repository
directory.
This could also be extended for automated tests. Here is an example how this
could look like (currently this does not test much of gitweb):
#!/bin/sh
die() {
echo "$0: $*" >&2
exit 1
}
cleanup() {
[ -e "$TMP" ] && rm "$TMP"
}
test() {
echo "test: $@"
"$gitweb" "$@" > /dev/null 2> "$TMP"
if [ ! -s "$TMP" ]; then
return
fi
echo "========== ERRORS =========="
cat "$TMP"
echo "============================"
}
gitweb="./`git rev-parse --show-cdup`/t/gitweb.sh"
TMP=""
trap cleanup EXIT
TMP="`mktemp`" || die mktemp failed
# repository overview
test
# summary
test p=.git
# commitdiff
# initial commit
test p=.git a=commitdiff \
h=e83c5163316f89bfbde7d9ab23ca2e25604af290
# some other commit
test p=.git a=commitdiff \
h=5a716826a6f7f209777f344143cdd9e4f2903097
# merge commit withouth specified parent
test p=.git a=commitdiff \
h=e190bc55431d906b8c70dc07f8b6d823721f12c9
# merge commit with specified parent
test p=.git a=commitdiff \
h=e190bc55431d906b8c70dc07f8b6d823721f12c9 \
hp=360204c324ca9178e2bcb4d75f3986201f8ac7e1
---
t/gitweb.sh | 29 +++++++++++++++++++++++++++++
t/gitweb_config.perl | 4 ++++
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/t/gitweb.sh b/t/gitweb.sh
new file mode 100755
index 0000000..b0dff26
--- /dev/null
+++ b/t/gitweb.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# this script runs gitweb.perl from the shell having .git as repository
+# command line parameters are used as query string
+
+TOPDIR="`pwd``git rev-parse --show-cdup`"
+if [ ! -e "$TOPDIR/git" ]; then
+ echo "$0: You haven't built things yet, have you?" >&2
+ exit 1
+fi
+
+export PATH="$TOPDIR:$PATH"
+export GIT_EXEC_PATH="$TOPDIR"
+
+# cgi environment
+export GATEWAY_INTERFACE=CGI/1.1
+export REQUEST_METHOD=GET
+QUERY_STRING=""
+if [ $# -gt 0 ]; then
+ QUERY_STRING="$1"
+ shift
+fi
+while [ $# -gt 0 ]; do
+ QUERY_STRING="$QUERY_STRING;$1"
+ shift
+done
+export QUERY_STRING
+
+export GITWEB_CONFIG="$TOPDIR/t/gitweb_config.perl"
+exec "$TOPDIR/gitweb/gitweb.perl"
diff --git a/t/gitweb_config.perl b/t/gitweb_config.perl
new file mode 100644
index 0000000..5c245ff
--- /dev/null
+++ b/t/gitweb_config.perl
@@ -0,0 +1,4 @@
+$projectroot = "./".qx(git rev-parse --show-cdup);
+chomp($projectroot);
+$projects_list = $projectroot;
+$GIT = $projectroot.'/git';
--
1.4.1.gfd699
next reply other threads:[~2006-08-06 16:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-06 16:51 Matthias Lederhofer [this message]
2006-08-06 21:38 ` [RFC] gitweb test script Junio C Hamano
2006-08-07 8:31 ` Matthias Lederhofer
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=20060806165151.GB9548@moooo.ath.cx \
--to=matled@gmx.net \
--cc=git@vger.kernel.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).