summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-11-17 22:59:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-11-17 22:59:22 (GMT)
commit430fac9e5bdf24a2969f854ff0ff376140f88090 (patch)
tree97af5770aa6afef8fc1739ca5496b1c3ca6ce869
parent8cf666c9eea7d6c40784efde545c9d00edea1959 (diff)
parent9b93aeb29cea16880926bc150ac31cfb31475a44 (diff)
downloadgit-430fac9e5bdf24a2969f854ff0ff376140f88090.zip
git-430fac9e5bdf24a2969f854ff0ff376140f88090.tar.gz
git-430fac9e5bdf24a2969f854ff0ff376140f88090.tar.bz2
Merge branch 'jn/gitweb-test'
* jn/gitweb-test: gitweb/Makefile: Include gitweb/config.mak gitweb/Makefile: Add 'test' and 'test-installed' targets t/gitweb-lib.sh: Add support for GITWEB_TEST_INSTALLED gitweb: Move call to evaluate_git_version after evaluate_gitweb_config
-rw-r--r--gitweb/Makefile12
-rwxr-xr-xgitweb/gitweb.perl2
-rw-r--r--t/Makefile4
-rw-r--r--t/gitweb-lib.sh21
4 files changed, 35 insertions, 4 deletions
diff --git a/gitweb/Makefile b/gitweb/Makefile
index e32ee76..0a6ac00 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -40,6 +40,7 @@ HIGHLIGHT_BIN = highlight
# include user config
-include ../config.mak.autogen
-include ../config.mak
+-include config.mak
# determine version
../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
@@ -145,6 +146,15 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
chmod +x $@+ && \
mv $@+ $@
+### Testing rules
+
+test:
+ $(MAKE) -C ../t gitweb-test
+
+test-installed:
+ GITWEB_TEST_INSTALLED='$(DESTDIR_SQ)$(gitwebdir_SQ)' \
+ $(MAKE) -C ../t gitweb-test
+
### Installation rules
install: all
@@ -158,5 +168,5 @@ install: all
clean:
$(RM) gitweb.cgi static/gitweb.min.js static/gitweb.min.css GITWEB-BUILD-OPTIONS
-.PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE
+.PHONY: all clean install test test-installed .FORCE-GIT-VERSION-FILE FORCE
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 253f41a..679f2da 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1075,6 +1075,7 @@ sub run_request {
evaluate_uri();
evaluate_gitweb_config();
+ evaluate_git_version();
check_loadavg();
# $projectroot and $projects_list might be set in gitweb config file
@@ -1127,7 +1128,6 @@ sub evaluate_argv {
sub run {
evaluate_argv();
- evaluate_git_version();
$pre_listen_hook->()
if $pre_listen_hook;
diff --git a/t/Makefile b/t/Makefile
index c7baefb..7aa409a 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -17,6 +17,7 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
TSVN = $(wildcard t91[0-9][0-9]-*.sh)
+TGITWEB = $(wildcard t95[0-9][0-9]-*.sh)
all: pre-clean
$(MAKE) aggregate-results-and-cleanup
@@ -46,6 +47,9 @@ full-svn-test:
$(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
$(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
+gitweb-test:
+ $(MAKE) $(TGITWEB)
+
valgrind:
GIT_TEST_OPTS=--valgrind $(MAKE)
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index 8c490c8..8b5b987 100644
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -32,17 +32,34 @@ EOF
cat >.git/description <<EOF
$0 test repository
EOF
+
+ # 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 to test that installation,
+ # or simply to pathname of installed gitweb script.
+ if test -n "$GITWEB_TEST_INSTALLED" ; then
+ if test -d $GITWEB_TEST_INSTALLED; then
+ SCRIPT_NAME="$GITWEB_TEST_INSTALLED/gitweb.cgi"
+ else
+ SCRIPT_NAME="$GITWEB_TEST_INSTALLED"
+ fi
+ test -f "$SCRIPT_NAME" ||
+ error "Cannot find gitweb at $GITWEB_TEST_INSTALLED."
+ say "# Testing $SCRIPT_NAME"
+ else # normal case, use source version of gitweb
+ SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.perl"
+ fi
+ export SCRIPT_NAME
}
gitweb_run () {
GATEWAY_INTERFACE='CGI/1.1'
HTTP_ACCEPT='*/*'
REQUEST_METHOD='GET'
- SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.perl"
QUERY_STRING=""$1""
PATH_INFO=""$2""
export GATEWAY_INTERFACE HTTP_ACCEPT REQUEST_METHOD \
- SCRIPT_NAME QUERY_STRING PATH_INFO
+ QUERY_STRING PATH_INFO
GITWEB_CONFIG=$(pwd)/gitweb_config.perl
export GITWEB_CONFIG