You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by sh...@apache.org on 2009/04/30 01:34:33 UTC

svn commit: r770001 - in /qpid/trunk/qpid/cpp/src/tests: CMakeLists.txt ReplicationTest.cpp Shlib.cpp

Author: shuston
Date: Wed Apr 29 23:34:33 2009
New Revision: 770001

URL: http://svn.apache.org/viewvc?rev=770001&view=rev
Log:
Pass platform's shared lib prefix, suffix to test progs that need it; use it to pick up proper file for libtool/cmake/Windows

Modified:
    qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt
    qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp
    qpid/trunk/qpid/cpp/src/tests/Shlib.cpp

Modified: qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt?rev=770001&r1=770000&r2=770001&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt (original)
+++ qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt Wed Apr 29 23:34:33 2009
@@ -118,6 +118,13 @@
 # 	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)

Modified: qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp?rev=770001&r1=770000&r2=770001&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp Wed Apr 29 23:34:33 2009
@@ -44,7 +44,13 @@
 
 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)
 {

Modified: qpid/trunk/qpid/cpp/src/tests/Shlib.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/Shlib.cpp?rev=770001&r1=770000&r2=770001&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/Shlib.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/Shlib.cpp Wed Apr 29 23:34:33 2009
@@ -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(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);



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org