3 # Copyright (c) 2007 Jakub Narebski
7 safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
8 cat >gitweb_config.perl <<EOF
11 # gitweb configuration for tests
13 our \$version = 'current';
15 our \$projectroot = "$safe_pwd";
16 our \$project_maxdepth = 8;
17 our \$home_link_str = 'projects';
18 our \$site_name = '[localhost]';
19 our \$site_header = '';
20 our \$site_footer = '';
21 our \$home_text = 'indextext.html';
22 our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/gitweb.css');
23 our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/git-logo.png';
24 our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/git-favicon.png';
25 our \$projects_list = '';
27 our \$strict_export = '';
28 our \$maxload = undef;
32 cat >.git/description <<EOF
38 GATEWAY_INTERFACE='CGI/1.1'
41 SCRIPT_NAME="$TEST_DIRECTORY/../gitweb/gitweb.perl"
44 export GATEWAY_INTERFACE HTTP_ACCEPT REQUEST_METHOD \
45 SCRIPT_NAME QUERY_STRING PATH_INFO
47 GITWEB_CONFIG=$(pwd)/gitweb_config.perl
50 # some of git commands write to STDERR on error, but this is not
51 # written to web server logs, so we are not interested in that:
52 # we are interested only in properly formatted errors/warnings
54 perl -- "$SCRIPT_NAME" \
55 >gitweb.output 2>gitweb.log &&
57 open O, ">gitweb.headers";
60 last if (/^\r$/ || /^$/);
62 open O, ">gitweb.body";
68 if grep '^[[]' gitweb.log >/dev/null 2>&1; then false; else true; fi
70 # gitweb.log is left for debugging
71 # gitweb.output is used to parse HTTP output
72 # gitweb.headers contains only HTTP headers
73 # gitweb.body contains body of message, without headers
78 if ! test_have_prereq PERL; then
79 say 'skipping gitweb tests, perl not available'
83 perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
84 say 'skipping gitweb tests, perl version is too old'