diff options
Diffstat (limited to 'cpp/tests')
-rw-r--r-- | cpp/tests/Makefile.am | 4 | ||||
-rwxr-xr-x | cpp/tests/broker | 45 | ||||
-rwxr-xr-x | cpp/tests/daemon_test | 22 |
3 files changed, 24 insertions, 47 deletions
diff --git a/cpp/tests/Makefile.am b/cpp/tests/Makefile.am index 7f6de0d28e..4a9eda4864 100644 --- a/cpp/tests/Makefile.am +++ b/cpp/tests/Makefile.am @@ -71,10 +71,10 @@ abs_srcdir = @abs_srcdir@ TESTS_ENVIRONMENT = \ VALGRIND=$(VALGRIND) \ abs_builddir='$(abs_builddir)' \ - PATH="$(abs_builddir)/../src$(PATH_SEPARATOR)$$PATH" \ + PATH="$(abs_srcdir)$(PATH_SEPARATOR)$(abs_builddir)/../src$(PATH_SEPARATOR)$$PATH" \ abs_srcdir='$(abs_srcdir)' -TESTS = run-unit-tests run-python-tests +TESTS = run-unit-tests run-python-tests daemon_test EXTRA_DIST += $(TESTS) CLEANFILES=qpidd.log diff --git a/cpp/tests/broker b/cpp/tests/broker deleted file mode 100755 index c49e967466..0000000000 --- a/cpp/tests/broker +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -. `dirname $0`/env - -brokerpid() { - netstat -tpl 2> /dev/null | awk '/amqp/ {print gensub("/.*$","","g",$7) }' -} - -killbroker () { - PID=`brokerpid` - if [ -n "$PID" ] ; then kill $PID ; fi - for ((i=5;i--;)) { - if [ -z "`brokerpid`" ] ; then exit 0 ; fi - sleep 1 - } - echo "Broker `brokerpid` refuses to die." -} - -waitbroker () { - while [ -z `brokerpid` ] ; do sleep 1 ; done -} - -startbroker() { - case $1 in - j) - export AMQJ_LOGGING_LEVEL=fatal - export JDPA_OPTS= - export QPID_OPTS=-Xmx1024M - export debug=1 - CMD="qpid-server" - qpid-run -run:print-command # Show the command line. - ;; - c) CMD=qpidd ;; - esac - nohup $CMD > /dev/null 2>&1 & - waitbroker - echo Broker started: $CMD -} - - -case $1 in - j|c) startbroker $1 ;; - stop|kill) killbroker ;; - wait) waitbroker ;; - pid) brokerpid ;; -esac 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 |