Author: fw Date: 2008-12-01 19:05:28 +0000 (Mon, 01 Dec 2008) New Revision: 10568 Added: bin/test-web-server Log: bin/test-web-server: New script for testing purposes Added: bin/test-web-server ==================================================================--- bin/test-web-server (rev 0) +++ bin/test-web-server 2008-12-01 19:05:28 UTC (rev 10568) @@ -0,0 +1,47 @@ +#!/bin/bash + +set -e + +server_port=10605 +service=tracker_service.py +thttpd=/usr/sbin/thttpd + +if ! command -v mktemp > /dev/null ; then + echo ''error: mktemp required'' + exit 1 +elif ! command -v servinvoke > /dev/null ; then + echo ''error: servinvoke required'' + exit 1 +elif ! test -x $thttpd ; then + echo ''error: thttpd required'' + exit 1 +fi + +bindir=`dirname $0` +if ! test -r "$bindir/$service" ; then + echo "error: failed to locate bin directory (tried $bindir)" + exit 1 +fi + +webroot=`mktemp -d` +if ! test -d $webroot ; then + echo "error: invalid TMPDIR setting" + rm -rf -- "$webroot" + exit 1 +fi +trap "rm -rf $webroot" 0 +cat > $webroot/tracker <<EOF +#!/usr/bin/servinvoke + +copy-env +target-unix $webroot/service-socket +EOF +chmod 755 $webroot/tracker +$thttpd -h localhost -p $server_port -c tracker \ + -d $webroot -l $webroot/log -i $webroot/pid +echo "URL: http://localhost:$server_port/tracker" + +cd "$bindir" +python $service $webroot/service-socket ../data/security.db || true +read pid < $webroot/pid +kill "$pid" Property changes on: bin/test-web-server ___________________________________________________________________ Name: svn:executable + *