diff options
| author | Alan Conway <aconway@apache.org> | 2007-04-30 19:03:53 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-04-30 19:03:53 +0000 |
| commit | 311ac3b34c254109bc74ffa962850fba1d5b85e5 (patch) | |
| tree | dbd8acd183d8f21012a8640de74ba5a638175d59 /cpp/src/tests | |
| parent | 102644d52e4bf4add4a2cb7b8759e205399f7aaa (diff) | |
| download | qpid-python-311ac3b34c254109bc74ffa962850fba1d5b85e5.tar.gz | |
Resolves: QPID-298, QPID-304: qpidd flags to control broker daemon.
* 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.
* test_env: minor fix.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@533828 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
| -rw-r--r-- | cpp/src/tests/Makefile.am | 2 | ||||
| -rwxr-xr-x | cpp/src/tests/daemon_test | 24 | ||||
| -rwxr-xr-x | cpp/src/tests/test_env | 2 |
3 files changed, 26 insertions, 2 deletions
diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am index 5c4cb3e712..805f8d8e32 100644 --- a/cpp/src/tests/Makefile.am +++ b/cpp/src/tests/Makefile.am @@ -57,7 +57,7 @@ noinst_PROGRAMS = $(testprogs) TESTS_ENVIRONMENT = VALGRIND=$(VALGRIND) srcdir=$(srcdir) CLIENT_TESTS = client_test quick_topictest -TESTS = run-unit-tests start_broker $(CLIENT_TESTS) python_tests kill_broker +TESTS = run-unit-tests start_broker $(CLIENT_TESTS) python_tests kill_broker daemon_test EXTRA_DIST = \ test_env \ diff --git a/cpp/src/tests/daemon_test b/cpp/src/tests/daemon_test new file mode 100755 index 0000000000..ab87a2f848 --- /dev/null +++ b/cpp/src/tests/daemon_test @@ -0,0 +1,24 @@ +#!/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` +qpidd=../qpidd +client_tests=./client_test +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 diff --git a/cpp/src/tests/test_env b/cpp/src/tests/test_env index fdfc5f0369..c73cac43ea 100755 --- a/cpp/src/tests/test_env +++ b/cpp/src/tests/test_env @@ -6,7 +6,7 @@ # Use VALGRIND if set, else look on path. test -z "$VALGRIND" && VALGRIND=`which valgrind 2>/dev/null` # No valgrind, just run the command -test -z "$VALGRIND" && exec libtool --mode=execute "$@" +test -z "$VALGRIND" && { exec libtool --mode=execute "$@"; exit $?; } test "$VERBOSE" = yes && set -x test -z "$vg_log" && vg_log=valgrind.out |
