1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#!/bin/sh
set -eu
# Needed to find lighttpd binary and the chromedriver binary
export PATH="/sbin:/usr/sbin:/usr/bin:$PATH"
chromedriver --version
PORT=8888
DOCROOT="$AUTOPKGTEST_TMP/docroot"
CONF="$AUTOPKGTEST_TMP/lighttpd.conf"
mkdir -p "$DOCROOT"
cat >"$CONF" <<EOF
server.document-root = "$DOCROOT"
server.port = $PORT
server.modules = ( "mod_access", "mod_auth", "mod_fastcgi", "mod_alias" )
fastcgi.server += ( ".php" =>
((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "$AUTOPKGTEST_TMP/php.socket",
"max-procs" => 1,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "10000"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
))
)
include "/etc/phpsysinfo/lighttpd.conf"
mimetype.assign += ( ".html" => "text/html", ".css" => "text/css", ".php" => "application/php" )
index-file.names = ( "index.php", "index.html" )
static-file.exclude-extensions = ( ".php" )
EOF
# validate test configuration
lighttpd -tt -f "$CONF"
lighttpd -D -f "$CONF" 2>/dev/stdout &
LIGHTTPD_PID=$!
# Allow commands to fail
set +e
# Wait a bit for things to stale
sleep 5
# Do tests
# Send to stdout (https://bugs.python.org/issue16164)
python3 ./debian/tests/test_phpsysinfo_web.py 2>/dev/stdout
EXIT_CODE=$?
if [ "$EXIT_CODE" -ne "0" ]; then
echo "Tests failed !"
fi
trap 'kill "$LIGHTTPD_PID"' EXIT
exit $EXIT_CODE
|