From 248f1fe188fe2307b9dcf2c87a83b653eaa1920c Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Sat, 26 Dec 2009 12:42:57 +0000 Subject: synchronized with trunk except for ruby dir git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid.rnr@893970 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/Shlib.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'cpp/src/tests/Shlib.cpp') diff --git a/cpp/src/tests/Shlib.cpp b/cpp/src/tests/Shlib.cpp index 426a052c9f..692cfcdff9 100644 --- a/cpp/src/tests/Shlib.cpp +++ b/cpp/src/tests/Shlib.cpp @@ -24,13 +24,23 @@ #include "unit_test.h" +namespace qpid { +namespace tests { + QPID_AUTO_TEST_SUITE(ShlibTestSuite) using namespace qpid::sys; typedef void (*CallMe)(int*); + QPID_AUTO_TEST_CASE(testShlib) { + // The CMake-based build passes in the module suffix; if it's not there, + // this is a Linux/UNIX libtool-based build. +#if defined (QPID_MODULE_PREFIX) && defined (QPID_MODULE_SUFFIX) + Shlib sh("./" QPID_MODULE_PREFIX "shlibtest" QPID_MODULE_SUFFIX); +#else Shlib sh(".libs/libshlibtest.so"); +#endif // Double cast to avoid ISO warning. CallMe callMe=sh.getSymbol("callMe"); BOOST_REQUIRE(callMe != 0); @@ -44,17 +54,23 @@ QPID_AUTO_TEST_CASE(testShlib) { } catch (const qpid::Exception&) {} } - + QPID_AUTO_TEST_CASE(testAutoShlib) { int unloaded = 0; { +#if defined (QPID_MODULE_PREFIX) && defined (QPID_MODULE_SUFFIX) + AutoShlib sh("./" QPID_MODULE_PREFIX "shlibtest" QPID_MODULE_SUFFIX); +#else AutoShlib sh(".libs/libshlibtest.so"); +#endif CallMe callMe=sh.getSymbol("callMe"); BOOST_REQUIRE(callMe != 0); callMe(&unloaded); } BOOST_CHECK_EQUAL(42, unloaded); } - + QPID_AUTO_TEST_SUITE_END() + +}} // namespace qpid::tests -- cgit v1.2.1