summaryrefslogtreecommitdiff
path: root/qpid/cpp/tests
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-03-27 19:57:00 +0000
committerAlan Conway <aconway@apache.org>2007-03-27 19:57:00 +0000
commit713e83841b5b21ead10ce69dbb96337fee0ee368 (patch)
tree12138fbf81d7716a60b2acd8b6ca59e95b586332 /qpid/cpp/tests
parent1d40f897b6850d6c91b807235c4105b815291a49 (diff)
downloadqpid-python-713e83841b5b21ead10ce69dbb96337fee0ee368.tar.gz
Fix valgrind on unit tests: missing symbols for dynamically unloaded libs.
Interposed library supresses dlclose so symbols are reported. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@523055 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/tests')
-rw-r--r--qpid/cpp/tests/Makefile.am6
-rw-r--r--qpid/cpp/tests/dlclose_noop.c30
-rwxr-xr-xqpid/cpp/tests/run-unit-tests4
3 files changed, 37 insertions, 3 deletions
diff --git a/qpid/cpp/tests/Makefile.am b/qpid/cpp/tests/Makefile.am
index edad0945f3..cc063cbea5 100644
--- a/qpid/cpp/tests/Makefile.am
+++ b/qpid/cpp/tests/Makefile.am
@@ -89,6 +89,11 @@ DISTCLEANFILES=gen.mk
include gen.mk
+check_LTLIBRARIES += libdlclose_noop.la
+libdlclose_noop_la_LDFLAGS = -module -rpath /home/aconway/svn/qpid/cpp/tests
+libdlclose_noop_la_SOURCES = dlclose_noop.c
+
+
abs_builddir = @abs_builddir@
extra_libs = $(CPPUNIT_LIBS)
lib_client = $(abs_builddir)/../lib/client/libqpidclient.la
@@ -114,5 +119,4 @@ gen.mk: Makefile.am
> $@-t
mv $@-t $@
-
check: $(check_LTLIBRARIES) $(lib_common) $(lib_client) $(lib_broker)
diff --git a/qpid/cpp/tests/dlclose_noop.c b/qpid/cpp/tests/dlclose_noop.c
new file mode 100644
index 0000000000..ba2fa75891
--- /dev/null
+++ b/qpid/cpp/tests/dlclose_noop.c
@@ -0,0 +1,30 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/*
+ * Loaded via LD_PRELOAD this will turn dlclose into a no-op.
+ *
+ * Allows valgrind to generate useful reports from programs that
+ * dynamically unload libraries before exit, such as CppUnit's
+ * DllPlugInTester.
+ *
+ */
+
+#include <stdio.h>
+void* dlclose(void* handle) {}
+
diff --git a/qpid/cpp/tests/run-unit-tests b/qpid/cpp/tests/run-unit-tests
index 0ab01f05c5..b0ef82e558 100755
--- a/qpid/cpp/tests/run-unit-tests
+++ b/qpid/cpp/tests/run-unit-tests
@@ -3,7 +3,7 @@
. $srcdir/setup
fail=0
-$vg DllPlugInTester -c -b $pwd/.libs/*.so 2> out || fail=1
-vg_check out || fail=1
+LD_PRELOAD=$pwd/.libs/libdlclose_noop.so $vg DllPlugInTester -c -b $pwd/.libs/*Test.so 2> valgrind.out || fail=1
+vg_check valgrind.out || fail=1
exit $fail