diff options
author | Alan Conway <aconway@apache.org> | 2007-07-19 17:09:09 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-07-19 17:09:09 +0000 |
commit | 0cd558081d98905c9bead280345a65613267bf4f (patch) | |
tree | 11c35f2b13f8a5e35dad707d7915f427961d2b67 /cpp/src | |
parent | db3d885edacb4508ec19f0d6380b6de618cc8643 (diff) | |
download | qpid-python-0cd558081d98905c9bead280345a65613267bf4f.tar.gz |
* src/tests/start_broker, stop_broker: Use valgrind on broker.
* src/tests/run_test, vg_check:
- factored valgrind check out of run_test for reuse in stop_broker.
* src/tests/Makefile.am, stop_broker, README:
- kill_broker renamed stop_broker.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@557692 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/tests/Makefile.am | 4 | ||||
-rw-r--r-- | cpp/src/tests/README | 2 | ||||
-rwxr-xr-x | cpp/src/tests/kill_broker | 2 | ||||
-rwxr-xr-x | cpp/src/tests/run_test | 20 | ||||
-rwxr-xr-x | cpp/src/tests/start_broker | 3 | ||||
-rwxr-xr-x | cpp/src/tests/stop_broker | 21 | ||||
-rw-r--r-- | cpp/src/tests/vg_check | 23 |
7 files changed, 50 insertions, 25 deletions
diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am index 255f6348b9..6903787d79 100644 --- a/cpp/src/tests/Makefile.am +++ b/cpp/src/tests/Makefile.am @@ -114,11 +114,11 @@ check_PROGRAMS += $(testprogs) interop_runner TESTS_ENVIRONMENT = VALGRIND=$(VALGRIND) srcdir=$(srcdir) $(srcdir)/run_test system_tests = client_test exception_test quick_topictest -TESTS += run-unit-tests start_broker $(system_tests) python_tests kill_broker +TESTS += run-unit-tests start_broker $(system_tests) python_tests stop_broker EXTRA_DIST += \ test_env run_test \ - run-unit-tests start_broker python_tests kill_broker \ + run-unit-tests start_broker python_tests stop_broker \ quick_topictest \ topictest \ .valgrind.supp-default \ diff --git a/cpp/src/tests/README b/cpp/src/tests/README index 2501ba1f21..3cf6fab2ad 100644 --- a/cpp/src/tests/README +++ b/cpp/src/tests/README @@ -54,7 +54,7 @@ case it just tries to open the filename. System tests are self contained AMQP client executables or scripts. They are listed in the TESTS make variable, which can be over-ridden. -The ./start_broker "test" launches the broker, ./kill_broker" kills it. +The ./start_broker "test" launches the broker, ./stop_broker" stops it. Tests in between assume the broker is running. ./python_tests: runs ../python/run_tests. This is the main set of diff --git a/cpp/src/tests/kill_broker b/cpp/src/tests/kill_broker deleted file mode 100755 index 1887eee50d..0000000000 --- a/cpp/src/tests/kill_broker +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -QPID_PORT=`cat qpidd.port` ../qpidd --quit && rm -f qpidd.port diff --git a/cpp/src/tests/run_test b/cpp/src/tests/run_test index ec724fe727..d717cd2ace 100755 --- a/cpp/src/tests/run_test +++ b/cpp/src/tests/run_test @@ -12,26 +12,8 @@ # examination. # -vg_failed() { - cat $VG_LOG 1>&2 - echo $1 1>&2 - exit 1 -} +source `dirname $0`/vg_check -vg_check() -{ - test -f $VG_LOG || vg_failed Valgrind log file $VG_LOG missing. - # Ensure there is an ERROR SUMMARY line. - grep -E '^==[0-9]+== ERROR SUMMARY:' $VG_LOG > /dev/null || \ - vg_failed "No valgrind ERROR SUMMARY line in $$vg_failed." - # Ensure that the number of errors is 0. - grep -E '^==[0-9]+== ERROR SUMMARY: [^0]' $VG_LOG > /dev/null && \ - vg_failed "Valgrind reported errors in $vg_out; see above." - # Check for leaks. - grep -E '^==[0-9]+== +.* lost: [^0]' $VG_LOG && \ - vg_failed "Found memory leaks (see log file, $VG_LOG); see above." - true -} # Export variables from makefile. export VALGRIND srcdir diff --git a/cpp/src/tests/start_broker b/cpp/src/tests/start_broker index b8a83fd5e3..cd1ee07901 100755 --- a/cpp/src/tests/start_broker +++ b/cpp/src/tests/start_broker @@ -1,2 +1,3 @@ #!/bin/sh -../qpidd --daemon --port 0 --log.output qpidd.log > qpidd.port +test -n "$VALGRIND" && VALGRIND="$VALGRIND --log-file-exactly=qpidd.vglog --" +exec libtool --mode=execute $VALGRIND ../qpidd --daemon --port 0 --log.output qpidd.log > qpidd.port diff --git a/cpp/src/tests/stop_broker b/cpp/src/tests/stop_broker new file mode 100755 index 0000000000..bc26657d18 --- /dev/null +++ b/cpp/src/tests/stop_broker @@ -0,0 +1,21 @@ +#!/bin/sh +# Stop the broker, check for errors. +# +source `dirname $0`/vg_check +export QPID_PORT=`cat qpidd.port` +rm -f qpidd.port + +# Wait for daemon to quit +../qpidd --quit || ERROR=$? +while ../qpidd --check >/dev/null 2>&1; do true; done + +# Check qpidd.log. +egrep 'warn|error|critical' qpidd.log && { + echo "Suspicious broker log entries in qpidd.log." + ERROR=1 +} + +# Check valgrind log. +vg_check qpidd.vglog + +exit $ERROR diff --git a/cpp/src/tests/vg_check b/cpp/src/tests/vg_check new file mode 100644 index 0000000000..e9a691abe6 --- /dev/null +++ b/cpp/src/tests/vg_check @@ -0,0 +1,23 @@ +# Check for valgrind errors. Sourced by test scripts. + +vg_failed() { + cat $VG_LOG 1>&2 + echo $1 1>&2 + exit 1 +} + +vg_check() +{ + test -z "$1" || VG_LOG=$1 + test -f $VG_LOG || vg_failed Valgrind log file $VG_LOG missing. + # Ensure there is an ERROR SUMMARY line. + grep -E '^==[0-9]+== ERROR SUMMARY:' $VG_LOG > /dev/null || \ + vg_failed "No valgrind ERROR SUMMARY line in $$vg_failed." + # Ensure that the number of errors is 0. + grep -E '^==[0-9]+== ERROR SUMMARY: [^0]' $VG_LOG > /dev/null && \ + vg_failed "Valgrind reported errors in $vg_out; see above." + # Check for leaks. + grep -E '^==[0-9]+== +.* lost: [^0]' $VG_LOG && \ + vg_failed "Found memory leaks (see log file, $VG_LOG); see above." + true +} |