# HG changeset patch # User mas01cr # Date 1191338891 0 # Node ID e64a2e7f543c5a8bdc35f92fc5fcbc3453f7b0e5 # Parent 53179ebec1f7fce0ced3166f5e86d1072e208786 Initial web services startup / shutdown test. The test framework could definitely do with work here; the server process must run in the background, so there are race conditions both on startup and shutdown. The current workaround is "sleep 1", which is both inelegant and slow. diff -r 53179ebec1f7 -r e64a2e7f543c tests/0013/run-test.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0013/run-test.sh Tue Oct 02 15:28:11 2007 +0000 @@ -0,0 +1,11 @@ +#! /bin/bash + +. ../test-utils.sh + +start_server ${AUDIODB} 10013 + +check_server $! + +stop_server $! + +exit 104 diff -r 53179ebec1f7 -r e64a2e7f543c tests/0013/short-description --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/0013/short-description Tue Oct 02 15:28:11 2007 +0000 @@ -0,0 +1,1 @@ +WS server startup / shutdown diff -r 53179ebec1f7 -r e64a2e7f543c tests/test-utils.sh --- a/tests/test-utils.sh Tue Oct 02 14:32:23 2007 +0000 +++ b/tests/test-utils.sh Tue Oct 02 15:28:11 2007 +0000 @@ -47,3 +47,22 @@ if [ $1 -ge 10 ]; then echo "intstring() arg too large: ${1}"; exit 1; fi printf "%b\x00\x00\x00" "\\x${1}" } + +# Web services utilities +start_server() { + $1 -s $2 & + # HACK: deal with race on process creation + sleep 1 +} + +stop_server() { + grep ${AUDIODB} /proc/$1/cmdline > /dev/null + kill $1 + # HACK: deal with race on process exit + sleep 1 + expect_clean_error_exit grep ${AUDIODB} /proc/$1/cmdline +} + +check_server() { + grep ${AUDIODB} /proc/$1/cmdline > /dev/null +}