You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2007/01/23 16:12:28 UTC
svn commit: r499049 [3/3] - in /incubator/qpid/trunk/qpid/cpp: README-dev
configure.ac docs/api/Makefile.am qpid-autotools-install tests/.vg-supp
tests/Makefile.am tests/run-python-tests tests/run-unit-tests tests/setup
Modified: incubator/qpid/trunk/qpid/cpp/tests/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/tests/Makefile.am?view=diff&rev=499049&r1=499048&r2=499049
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/tests/Makefile.am (original)
+++ incubator/qpid/trunk/qpid/cpp/tests/Makefile.am Tue Jan 23 07:12:27 2007
@@ -11,6 +11,8 @@
# FIXME: have e.g., topicall, run as part of "make check"?
EXTRA_DIST = \
+ .vg-supp \
+ setup \
env \
broker \
topicall \
@@ -63,6 +65,12 @@
noinst_PROGRAMS = $(client_tests)
+
+TESTS_ENVIRONMENT = \
+ VALGRIND=$(VALGRIND) \
+ abs_builddir='$(abs_builddir)' \
+ PATH="$(abs_builddir)/../src$(PATH_SEPARATOR)$$PATH" \
+ abs_srcdir='$(abs_srcdir)'
TESTS = run-unit-tests run-python-tests
EXTRA_DIST += $(TESTS)
Modified: incubator/qpid/trunk/qpid/cpp/tests/run-python-tests
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/tests/run-python-tests?view=diff&rev=499049&r1=499048&r2=499049
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/tests/run-python-tests (original)
+++ incubator/qpid/trunk/qpid/cpp/tests/run-python-tests Tue Jan 23 07:12:27 2007
@@ -1,15 +1,35 @@
-#!/bin/sh
+#!/bin/bash
+
+if test "$VERBOSE" = yes; then
+ set -x
+ qpidd --version
+fi
+
+. $srcdir/setup
+
+fail=0
+pid=0
-set -e
-log=`pwd`/qpidd.log
# Start the daemon, recording its PID.
-../src/qpidd > $log 2>&1 & pid=$!
+$vg $abs_builddir/../src/qpidd > log 2>&1 & pid=$!
-# Arrange to kill the daemon upon any type of termination.
-trap 'status=$?; kill $pid; exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+# FIXME: remove this sleep kludge once qpidd provides a way
+sleep 4
# Run the tests.
-cd ../../python && ./run-tests -v -I cpp_failing.txt
+( cd $abs_srcdir/../../python \
+ && python ./run-tests -v -I cpp_failing.txt || fail=1 )
+
+kill $pid || { echo FAIL: process already died; cat log; fail=1; }
+
+wait $pid
+# FIXME: when we have a way to make qpidd shutdown gracefully
+# (i.e. with expected exit status of 0), replace the above with this:
+# wait $pid || fail=1
+
+vg_check log || fail=1
+
+# Tell the exit trap not to kill any process.
+pid=0
-rm -f $log
+(exit $fail); exit $fail
Modified: incubator/qpid/trunk/qpid/cpp/tests/run-unit-tests
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/tests/run-unit-tests?view=diff&rev=499049&r1=499048&r2=499049
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/tests/run-unit-tests (original)
+++ incubator/qpid/trunk/qpid/cpp/tests/run-unit-tests Tue Jan 23 07:12:27 2007
@@ -1,3 +1,9 @@
#!/bin/sh
-DllPlugInTester -c -b .libs/*.so
+. $srcdir/setup
+
+fail=0
+$vg DllPlugInTester -c -b $pwd/.libs/*.so 2> out || fail=1
+vg_check out || fail=1
+
+exit $fail
Added: incubator/qpid/trunk/qpid/cpp/tests/setup
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/tests/setup?view=auto&rev=499049
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/tests/setup (added)
+++ incubator/qpid/trunk/qpid/cpp/tests/setup Tue Jan 23 07:12:27 2007
@@ -0,0 +1,74 @@
+# -*- sh -*-
+
+test "$VERBOSE" = yes && set -x
+
+pwd=`pwd`
+t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
+pid=0
+test -z "$TEST_DEBUG" &&
+trap 's=$?;test $pid = 0||kill -2 $pid;cd "$pwd" && rm -rf $t0 && exit $s' 0
+test -z "$TEST_DEBUG" && trap '(exit $?); exit $?' 1 2 13 15
+
+framework_failure=0
+mkdir -p $tmp || framework_failure=1
+cd $tmp || framework_failure=1
+
+gen_supp=--gen-suppressions=all
+# This option makes valgrind significantly slower.
+full_leak_check=--leak-check=full
+
+vg_options="
+ --suppressions=$abs_srcdir/.vg-supp
+ --num-callers=25
+ --demangle=no
+ --track-fds=yes
+ $full_leak_check
+ $gen_supp
+ "
+# configure tests for the existence of valgrind.
+# If it's not available, then make $vg and vg_check no-ops.
+if test x$VALGRIND = x; then
+ vg=
+else
+ vg="libtool --debug --mode=execute valgrind `echo $vg_options` --"
+fi
+
+vg_leak_check()
+{
+ local file=$1
+ local fail
+ # If we detect a leak, dump all output to stderr.
+ grep -E '^==[0-9]+== +definitely lost: [^0]' $file \
+ && { fail=1; cat $file 1>&2;
+ echo "found memory leaks (see log file, $file); see above" 1>&2; }
+ test "$fail" = ''
+}
+
+
+# Ensure 1) that there is an ERROR SUMMARY line, and
+# 2) that the number of errors is 0.
+# An offending line looks like this:
+# ==29302== ERROR SUMMARY: 4 errors from 2 contexts (suppressed: 16 from 5)
+vg_error_check()
+{
+ local file=$1
+ local fail
+ # If we detect a leak, dump all output to stderr.
+ grep -E '^==[0-9]+== ERROR SUMMARY:' $file > /dev/null \
+ || { fail=1; cat $file 1>&2;
+ echo "no valgrind ERROR SUMMARY line in $file" 1>&2; }
+ if test "$fail" = ''; then
+ grep -E '^==[0-9]+== ERROR SUMMARY: [^0] ' $file \
+ && { fail=1; cat $file 1>&2;
+ echo "valgrind reported errors in $file; see above" 1>&2; }
+ fi
+ test "$fail" = ''
+}
+
+vg_check()
+{
+ local file=$1
+ if test x$VALGRIND != x; then
+ vg_error_check $file && vg_leak_check $file
+ fi
+}