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
|
#!/bin/sh
set -e
tmpdir=$(mktemp -d)
logfile="$tmpdir/uwsgi.log"
pidfile="$tmpdir/uwsgi.pid"
outfile="$tmpdir/out.txt"
UWSGI_TMP_DIR="$tmpdir" uwsgi debian/tests/php.ini \
--safe-pidfile "$pidfile" --daemonize "$logfile" 2>&1
sleep 4
trap cleanup 0
cleanup() {
if [ -f "$logfile" ]; then
echo "----- uwsgi logfile"
cat "$logfile"
fi
[ -f "$pidfile" ] && uwsgi --stop "$pidfile"
rm -f "$logfile" "$pidfile" "$tmpdir/uwsgi.cache" "$outfile"
[ -d "$tmpdir" ] && rmdir "$tmpdir"
}
curl --fail -o "$outfile" http://localhost:9090 2>&1
output=$(cat "$outfile")
if [ "$output" = "Hello World!" ]; then
echo "Got \"$output\""
exit 0
else
echo "\"$output\" is different from \"Hello World!\"" >&2
exit 1
fi
|