changeset 87:e64a2e7f543c

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.
author mas01cr
date Tue, 02 Oct 2007 15:28:11 +0000
parents 53179ebec1f7
children 7e3483e53c3b
files tests/0013/run-test.sh tests/0013/short-description tests/test-utils.sh
diffstat 3 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /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
--- /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
--- 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
+}