summaryrefslogtreecommitdiff
path: root/cpp/tests/daemon_test
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-04-30 18:08:17 +0000
committerAlan Conway <aconway@apache.org>2007-04-30 18:08:17 +0000
commitb16914a34d89e4b99eceb0a3f5b277d454c4e39f (patch)
tree669e6c913361f3fb1ce27e5159534f1290238720 /cpp/tests/daemon_test
parent80b492223507dbb4a64a3e1c5e6e3f65ac53afa1 (diff)
downloadqpid-python-b16914a34d89e4b99eceb0a3f5b277d454c4e39f.tar.gz
* README: added new dependency, libdaemon.
* qpidc.spec.in: libdaemon dependencies. * broker/Daemon.h|cpp: Daemon and pid file management, wrapper for libdaemon. * qpidd.cpp modifid flags -d [ --daemon ] - waits till deamon is listening before returning. * qpidd.cpp: new flags -q [ --quit ] Stop the running daemon politely. -k [ --kill ] Kill the running daemon harshly. -c [ --check ] If daemon is running return 0. --wait SECONDS (=10) Maximum wait for daemon response. --ppid Print daemon pid to stdout * tests/dameon_test: Test daemon startup, shutdown. * deleted tests/broker: obsolete script. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@533819 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/tests/daemon_test')
-rwxr-xr-xcpp/tests/daemon_test22
1 files changed, 22 insertions, 0 deletions
diff --git a/cpp/tests/daemon_test b/cpp/tests/daemon_test
new file mode 100755
index 0000000000..23f7f7d687
--- /dev/null
+++ b/cpp/tests/daemon_test
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Without arguments run all daemon tests, exit status is number of failures.
+# With arguments run just the test named by $1.
+#
+
+TEMP=`mktemp`
+trap 'rm -f $TEMP' 0
+
+fail() { echo FAIL: $0:$* 1>&2; exit 1; }
+
+# Start and stop daemon.
+PID=`qpidd --check --ppid` && fail $LINENO: qpidd already running $PID
+qpidd -d || $LINENO: qpidd -d failed
+qpidd --check || fail $LINENO: qpidd --check says qpidd didnt start
+client_test > $TEMP || fail $LINENO: client_test: `cat $TEMP`
+qpidd -q || fail $LINENO: qpidd -q failed
+qpidd -d || fail $LINENO: restart after quit failed.
+qpidd -k || fail $LINENO: qpidd -k failed
+# Supress expected message re. cleanup of old PID file.
+PID=`qpidd --check --ppid 2>/dev/null` && fail $LINENO: $PID still running after kill.
+
+true