t/gitweb-lib.sh: Add support for GITWEB_TEST_INSTALLED
You can set the GITWEB_TEST_INSTALLED environment variable to the gitwebdir (the directory where gitweb is installed / deployed to) of an existing gitweb instalation, or to the pathname of installed gitweb script, to test that installation. This change is intended to make it possible to test that process of installing gitweb and the modules it depends on works correctly (after splitting gitweb). If GITWEB_TEST_INSTALLED is used, print what script are we testing to make it easy to spot that we test installed gitweb. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jakub Narebski committed
Sep 26, 2010 at 15:02 UTC
929909375034eb609f855fe51b2ffc57123e6dd4
1 file changed
+19
-2
t/gitweb-lib.sh
+19
-2
@@ -32,17 +32,34 @@ EOF
32
cat >.git/description <<EOF
33
$0 test repository
34
EOF
35
+
36
+ # You can set the GITWEB_TEST_INSTALLED environment variable to
37
+ # the gitwebdir (the directory where gitweb is installed / deployed to)
38
+ # of an existing gitweb instalation to test that installation,
39
+ # or simply to pathname of installed gitweb script.
40
+ if test -n "$GITWEB_TEST_INSTALLED" ; then
41
+ if test -d $GITWEB_TEST_INSTALLED; then
42
+ SCRIPT_NAME="$GITWEB_TEST_INSTALLED/gitweb.cgi"
43
+ else
44
+ SCRIPT_NAME="$GITWEB_TEST_INSTALLED"
45
+ fi
46
+ test -f "$SCRIPT_NAME" ||
47
+ error "Cannot find gitweb at $GITWEB_TEST_INSTALLED."
48
+ say "# Testing $SCRIPT_NAME"
49
+ else # normal case, use source version of gitweb
50
+ SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.perl"
51
+ fi
52
+ export SCRIPT_NAME
53
}
54
55
gitweb_run () {
56
GATEWAY_INTERFACE='CGI/1.1'
57
HTTP_ACCEPT='*/*'
58
REQUEST_METHOD='GET'
41
- SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.perl"
59
QUERY_STRING=""$1""
60
PATH_INFO=""$2""
61
export GATEWAY_INTERFACE HTTP_ACCEPT REQUEST_METHOD \
45
- SCRIPT_NAME QUERY_STRING PATH_INFO
62
+ QUERY_STRING PATH_INFO
63
64
GITWEB_CONFIG=$(pwd)/gitweb_config.perl
65
export GITWEB_CONFIG