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
This commit is contained in:
Junio C Hamano 2010-11-17 14:59:22 -08:00
commit 430fac9e5b
4 changed files with 35 additions and 4 deletions

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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