diff options
Diffstat (limited to 'cpp/tests')
-rw-r--r-- | cpp/tests/Makefile.am | 6 | ||||
-rw-r--r-- | cpp/tests/dlclose_noop.c | 30 | ||||
-rwxr-xr-x | cpp/tests/run-unit-tests | 4 |
3 files changed, 37 insertions, 3 deletions
diff --git a/cpp/tests/Makefile.am b/cpp/tests/Makefile.am index edad0945f3..cc063cbea5 100644 --- a/cpp/tests/Makefile.am +++ b/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/cpp/tests/dlclose_noop.c b/cpp/tests/dlclose_noop.c new file mode 100644 index 0000000000..ba2fa75891 --- /dev/null +++ b/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/cpp/tests/run-unit-tests b/cpp/tests/run-unit-tests index 0ab01f05c5..b0ef82e558 100755 --- a/cpp/tests/run-unit-tests +++ b/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 |