1#!/bin/sh 2 3# $Id$ 4 5 6if [ -z "$TCLSH" ] 7then 8 TCLVERSION=8.6 9 10 for tclsh in /usr/bin/tclsh${TCLVERSION} /usr/local/bin/tclsh${TCLVERSION} 11 do 12 if [ -f $tclsh ] 13 then 14 TCLSH=$tclsh 15 break 16 fi 17 done 18fi 19 20if [ -z "$TCLSH" ] 21then 22 echo "Can't find Tcl" 23 exit 1 24fi 25 26URL=sttp://localhost:1984/test 27 28case "$TCLSH" in 29 /usr/bin*) export TCLLIBPATH="$TCLLIBPATH /usr/local/lib";; 30esac 31 32# Don't care what the result is 33../sttp $URL shutdown -nowait > /dev/null 2>&1 34 35# Rebuild the ctable 36rm -rf build 37${TCLSH} test.ct 38 39echo "`date` $0 $*" > server.log 40 41fail=0 42success=0 43for test 44do 45 # Start the server 46 ${TCLSH} test_server.tcl 2>> server.log & 47 pid=$! 48 49 # Wait for it to start 50 sleep 1 51 echo "`date` sttp $URL methods" >> server.log 52 if ../sttp $URL methods > /dev/null 53 then : OK 54 else 55 echo "# server failed" 56 cat server.log 57 exit 255 58 fi 59 60 echo "`date` ${TCLSH} test_$test.tcl" >> server.log 61 if ${TCLSH} test_$test.tcl 62 then 63 echo "# $test OK" 64 success=`expr $success + 1` 65 else 66 echo "# $test failed" 67 fail=`expr $fail + 1` 68 fi 69 70 sleep 1 71 # Stop the server 72 echo "`date` sttp $URL shutdown -nowait" >> server.log 73 ../sttp $URL shutdown -nowait > /dev/null 2>&1 74 75 sleep 1 76 if kill -0 $pid 2>/dev/null 77 then 78 echo "# Server not shut down properly" 79 echo + kill $pid 80 kill $pid 81 fail=`expr $fail + 1` 82 cat server.log 83 fi 84done 85 86echo "# $success OK $fail failed" 87 88exit $failed 89