diff options
| author | Stephen D. Huston <shuston@apache.org> | 2009-04-29 23:34:33 +0000 |
|---|---|---|
| committer | Stephen D. Huston <shuston@apache.org> | 2009-04-29 23:34:33 +0000 |
| commit | 14816555f98f5e70dd8f8102c553c500ae9219ce (patch) | |
| tree | 9d90782d6c9c3cabc2e1b0632dc5ddd24d24e5f1 /qpid/cpp/src | |
| parent | ffad7500891f3fe0e1121fcd3d37038023331cf1 (diff) | |
| download | qpid-python-14816555f98f5e70dd8f8102c553c500ae9219ce.tar.gz | |
Pass platform's shared lib prefix, suffix to test progs that need it; use it to pick up proper file for libtool/cmake/Windows
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@770001 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/tests/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | qpid/cpp/src/tests/ReplicationTest.cpp | 6 | ||||
| -rw-r--r-- | qpid/cpp/src/tests/Shlib.cpp | 37 |
3 files changed, 25 insertions, 25 deletions
diff --git a/qpid/cpp/src/tests/CMakeLists.txt b/qpid/cpp/src/tests/CMakeLists.txt index 798242f18e..dfd63fa7be 100644 --- a/qpid/cpp/src/tests/CMakeLists.txt +++ b/qpid/cpp/src/tests/CMakeLists.txt @@ -118,6 +118,13 @@ mark_as_advanced(unit_tests_to_build) # amqp_0_10/handlers.cpp add_executable (unit_test ${unit_tests_to_build}) +# The generally recommended way to add macro settings is to use +# COMPILE_DEFINITIONS, but it's a rough go to add more than one definition +# with a value; in this case, assuming that -D works everywhere is easier. +set_source_files_properties (ReplicationTest.cpp Shlib.cpp + PROPERTIES + COMPILE_FLAGS + "-DQPID_MODULE_SUFFIX=\\\"${CMAKE_SHARED_MODULE_SUFFIX}\\\" -DQPID_MODULE_PREFIX=\\\"${CMAKE_SHARED_MODULE_PREFIX}\\\"") target_link_libraries (unit_test ${qpid_test_boost_libs} qpidclient qpidbroker qmfconsole) diff --git a/qpid/cpp/src/tests/ReplicationTest.cpp b/qpid/cpp/src/tests/ReplicationTest.cpp index 7bd585639d..08f662142f 100644 --- a/qpid/cpp/src/tests/ReplicationTest.cpp +++ b/qpid/cpp/src/tests/ReplicationTest.cpp @@ -44,7 +44,13 @@ using boost::assign::list_of; QPID_AUTO_TEST_SUITE(ReplicationTestSuite) +// 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_SUFFIX) +qpid::sys::Shlib plugin("../replicating_listener" QPID_MODULE_SUFFIX); +#else qpid::sys::Shlib plugin("../.libs/replicating_listener.so"); +#endif qpid::broker::Broker::Options getBrokerOpts(const std::vector<std::string>& args) { diff --git a/qpid/cpp/src/tests/Shlib.cpp b/qpid/cpp/src/tests/Shlib.cpp index b75d8d919a..e5aa672477 100644 --- a/qpid/cpp/src/tests/Shlib.cpp +++ b/qpid/cpp/src/tests/Shlib.cpp @@ -24,37 +24,20 @@ #include "unit_test.h" -#ifndef WIN32 -# include <sys/stat.h> -#endif - QPID_AUTO_TEST_SUITE(ShlibTestSuite) using namespace qpid::sys; typedef void (*CallMe)(int*); -// Figure out the correct combination of tokens to use for a loadable -// library. -namespace { - const char *assemble_name (const char *base) - { - static char full_name[1024]; -# if defined (WIN32) - sprintf (full_name, "%s.dll", base); -# else - // If we're in a libtool environment, use that; else look here. - struct stat s; - if (stat(".libs", &s) == 0) - sprintf (full_name, ".libs/lib%s.so", base); - else - sprintf (full_name, "./lib%s.so", base); -# endif /* WIN32 */ - return full_name; - } -} QPID_AUTO_TEST_CASE(testShlib) { - Shlib sh(assemble_name("shlibtest")); + // 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(".lib/libshlibtest.so"); +#endif // Double cast to avoid ISO warning. CallMe callMe=sh.getSymbol<CallMe>("callMe"); BOOST_REQUIRE(callMe != 0); @@ -72,7 +55,11 @@ QPID_AUTO_TEST_CASE(testShlib) { QPID_AUTO_TEST_CASE(testAutoShlib) { int unloaded = 0; { - AutoShlib sh(assemble_name("shlibtest")); +#if defined (QPID_MODULE_PREFIX) && defined (QPID_MODULE_SUFFIX) + AutoShlib sh("./" QPID_MODULE_PREFIX "shlibtest" QPID_MODULE_SUFFIX); +#else + AutoShlib sh(".lib/libshlibtest.so"); +#endif CallMe callMe=sh.getSymbol<CallMe>("callMe"); BOOST_REQUIRE(callMe != 0); callMe(&unloaded); |
