summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/Shlib.cpp
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2009-04-28 17:56:25 +0000
committerStephen D. Huston <shuston@apache.org>2009-04-28 17:56:25 +0000
commit9a9447d2c38e22ef4b7a3c280dcfae816003887b (patch)
tree38ef6f850b59d1b2975c5b3b2b249abaac0e8b98 /qpid/cpp/src/tests/Shlib.cpp
parent7b38772fe85b436624912a02a47f450fea98fcf1 (diff)
downloadqpid-python-9a9447d2c38e22ef4b7a3c280dcfae816003887b.tar.gz
Add tests; revise checks for C++ headers to uuse C++, not C
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@769480 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/Shlib.cpp')
-rw-r--r--qpid/cpp/src/tests/Shlib.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/qpid/cpp/src/tests/Shlib.cpp b/qpid/cpp/src/tests/Shlib.cpp
index 426a052c9f..b75d8d919a 100644
--- a/qpid/cpp/src/tests/Shlib.cpp
+++ b/qpid/cpp/src/tests/Shlib.cpp
@@ -24,13 +24,37 @@
#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(".libs/libshlibtest.so");
+ Shlib sh(assemble_name("shlibtest"));
// Double cast to avoid ISO warning.
CallMe callMe=sh.getSymbol<CallMe>("callMe");
BOOST_REQUIRE(callMe != 0);
@@ -48,7 +72,7 @@ QPID_AUTO_TEST_CASE(testShlib) {
QPID_AUTO_TEST_CASE(testAutoShlib) {
int unloaded = 0;
{
- AutoShlib sh(".libs/libshlibtest.so");
+ AutoShlib sh(assemble_name("shlibtest"));
CallMe callMe=sh.getSymbol<CallMe>("callMe");
BOOST_REQUIRE(callMe != 0);
callMe(&unloaded);