diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2007-04-02 11:40:48 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2007-04-02 11:40:48 +0000 |
| commit | 9ecd69ebc88fb5d82a693e51eef0475c1a6b282e (patch) | |
| tree | 841ab9ff2ebf92ad57bc9189eefc7448260577d1 /qpid/cpp/src/tests/setup | |
| parent | 4ee7e8cbd677bd2ddf3f49d535a547e99c0aa150 (diff) | |
| download | qpid-python-9ecd69ebc88fb5d82a693e51eef0475c1a6b282e.tar.gz | |
Fix for the most disruptive items in QPID-243.
* All #include lines now use '""' rather than '<>' where appropriate.
* #include lines within the qpid project use relative includes so that
the same path will work in /usr/include when installed as part of the
client libraries.
* All the source code has now been rearranged to be under src in a directory
analogous to the namespace of the classes in it.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@524769 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/setup')
| -rw-r--r-- | qpid/cpp/src/tests/setup | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/setup b/qpid/cpp/src/tests/setup new file mode 100644 index 0000000000..aaa3afd9b8 --- /dev/null +++ b/qpid/cpp/src/tests/setup @@ -0,0 +1,81 @@ +# -*- sh -*- + +test "$VERBOSE" = yes && set -x + +pwd=`pwd` +test -z "$abs_srcdir" && abs_srcdir=$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 +demangle=--demangle=yes + +vg_options=" + --suppressions=$abs_srcdir/.vg-supp + --num-callers=25 + --track-fds=yes + $demangle + $full_leak_check + $gen_supp + $vg_log + " +# 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 --mode=execute $VALGRIND `echo $vg_options` --" + # Suppress dlclose or valgrind traces wont have test library symbols. + vg="env LD_PRELOAD=$pwd/.libs/libdlclose_noop.so $vg" +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 +} |
