summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorManuel Teira Paz <mteira@apache.org>2009-03-10 08:19:28 +0000
committerManuel Teira Paz <mteira@apache.org>2009-03-10 08:19:28 +0000
commitc2aa2f3a3c4141dce6232679227861b083a18c1f (patch)
tree494eeb91864babf0ac7592012410e556f1762410 /cpp
parent9b60ec677047daf836c2679294bc1f87c9c76141 (diff)
downloadqpid-python-c2aa2f3a3c4141dce6232679227861b083a18c1f.tar.gz
configure.ac:
- Add a SOCKLIBS definition, to define needed network libraries in Solaris src/tests/failover_soak.cpp - Replace usage of timersub with direct code, since timersub appears to be non-posix. src/tests/Makefile.am - Link against $(SOCKLIBS) when needed src/tests/* - Some qualifying needed for the Sun compiler git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@752019 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/configure.ac7
-rw-r--r--cpp/src/tests/ClientSessionTest.cpp4
-rw-r--r--cpp/src/tests/DispatcherTest.cpp2
-rw-r--r--cpp/src/tests/ForkedBroker.cpp3
-rw-r--r--cpp/src/tests/Makefile.am6
-rw-r--r--cpp/src/tests/MessageUtils.h2
-rw-r--r--cpp/src/tests/PollerTest.cpp2
-rw-r--r--cpp/src/tests/failover_soak.cpp11
-rw-r--r--cpp/src/tests/txshift.cpp4
9 files changed, 30 insertions, 11 deletions
diff --git a/cpp/configure.ac b/cpp/configure.ac
index 81d4f20b30..71528b76f1 100644
--- a/cpp/configure.ac
+++ b/cpp/configure.ac
@@ -393,6 +393,13 @@ gl_saved_libs=$LIBS
LIB_ACL=$ac_cv_search_acl])
AC_SUBST([LIB_ACL])
LIBS=$gl_saved_libs
+
+SOCKLIBS=""
+AC_CHECK_LIB([socket],[socket],[SOCKET_LIB="-lsocket"],[SOCKET_LIB=""],[])
+AC_CHECK_LIB([nsl],[getipnodebyname],[NSL_LIB="-lnsl"],[NSL_LIB=""],[])
+SOCKLIBS="$SOCKET_LIB $NSL_LIB"
+AC_SUBST([SOCKLIBS])
+
AM_PATH_PYTHON()
# Files to generate
diff --git a/cpp/src/tests/ClientSessionTest.cpp b/cpp/src/tests/ClientSessionTest.cpp
index b164ed0166..589e1154e1 100644
--- a/cpp/src/tests/ClientSessionTest.cpp
+++ b/cpp/src/tests/ClientSessionTest.cpp
@@ -428,8 +428,8 @@ QPID_AUTO_TEST_CASE(testConcurrentSenders)
for (size_t i = 0; i < 5; i++) {
publishers.push_back(new Publisher(connection, message, 100));
}
- for_each(publishers.begin(), publishers.end(), boost::bind(&Publisher::start, _1));
- for_each(publishers.begin(), publishers.end(), boost::bind(&Publisher::join, _1));
+ std::for_each(publishers.begin(), publishers.end(), boost::bind(&Publisher::start, _1));
+ std::for_each(publishers.begin(), publishers.end(), boost::bind(&Publisher::join, _1));
connection.close();
}
diff --git a/cpp/src/tests/DispatcherTest.cpp b/cpp/src/tests/DispatcherTest.cpp
index ff4806094b..c619a36438 100644
--- a/cpp/src/tests/DispatcherTest.cpp
+++ b/cpp/src/tests/DispatcherTest.cpp
@@ -129,7 +129,7 @@ int main(int /*argc*/, char** /*argv*/)
// Setup sender and receiver
int sv[2];
- int rc = ::socketpair(AF_LOCAL, SOCK_STREAM, 0, sv);
+ int rc = ::socketpair(AF_UNIX, SOCK_STREAM, 0, sv);
assert(rc >= 0);
// Set non-blocking
diff --git a/cpp/src/tests/ForkedBroker.cpp b/cpp/src/tests/ForkedBroker.cpp
index f970c384f7..f90f76aeb2 100644
--- a/cpp/src/tests/ForkedBroker.cpp
+++ b/cpp/src/tests/ForkedBroker.cpp
@@ -22,6 +22,9 @@
#include "ForkedBroker.h"
#include <boost/bind.hpp>
#include <algorithm>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <signal.h>
ForkedBroker::ForkedBroker(const Args& args) { init(args); }
diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am
index dc2c2e4400..7a33a7257b 100644
--- a/cpp/src/tests/Makefile.am
+++ b/cpp/src/tests/Makefile.am
@@ -164,7 +164,7 @@ header_test_LDADD=$(lib_client)
check_PROGRAMS+=failover_soak
failover_soak_SOURCES=failover_soak.cpp ForkedBroker.h ForkedBroker.cpp
-failover_soak_LDADD=$(lib_client)
+failover_soak_LDADD=$(lib_client) $(lib_broker)
check_PROGRAMS+=declare_queues
declare_queues_SOURCES=declare_queues.cpp
@@ -196,11 +196,11 @@ sender_LDADD=$(lib_client)
check_PROGRAMS+=PollerTest
PollerTest_SOURCES=PollerTest.cpp
-PollerTest_LDADD=$(lib_common)
+PollerTest_LDADD=$(lib_common) $(SOCKLIBS)
check_PROGRAMS+=DispatcherTest
DispatcherTest_SOURCES=DispatcherTest.cpp
-DispatcherTest_LDADD=$(lib_common)
+DispatcherTest_LDADD=$(lib_common) $(SOCKLIBS)
TESTS_ENVIRONMENT = VALGRIND=$(VALGRIND) srcdir=$(srcdir) QPID_DATA_DIR= BOOST_TEST_SHOW_PROGRESS=yes $(srcdir)/run_test
diff --git a/cpp/src/tests/MessageUtils.h b/cpp/src/tests/MessageUtils.h
index 67a852aa10..6a12c72007 100644
--- a/cpp/src/tests/MessageUtils.h
+++ b/cpp/src/tests/MessageUtils.h
@@ -33,7 +33,7 @@ struct MessageUtils
static boost::intrusive_ptr<Message> createMessage(const string& exchange="", const string& routingKey="",
const Uuid& messageId=Uuid(true), uint64_t contentSize = 0)
{
- boost::intrusive_ptr<Message> msg(new Message());
+ boost::intrusive_ptr<broker::Message> msg(new broker::Message());
AMQFrame method(( MessageTransferBody(ProtocolVersion(), exchange, 0, 0)));
AMQFrame header((AMQHeaderBody()));
diff --git a/cpp/src/tests/PollerTest.cpp b/cpp/src/tests/PollerTest.cpp
index 4f11dc5901..5b6b09ef65 100644
--- a/cpp/src/tests/PollerTest.cpp
+++ b/cpp/src/tests/PollerTest.cpp
@@ -74,7 +74,7 @@ int main(int /*argc*/, char** /*argv*/)
try
{
int sv[2];
- int rc = ::socketpair(AF_LOCAL, SOCK_STREAM, 0, sv);
+ int rc = ::socketpair(AF_UNIX, SOCK_STREAM, 0, sv);
assert(rc >= 0);
// Set non-blocking
diff --git a/cpp/src/tests/failover_soak.cpp b/cpp/src/tests/failover_soak.cpp
index d84b6d58f7..4f16e469b8 100644
--- a/cpp/src/tests/failover_soak.cpp
+++ b/cpp/src/tests/failover_soak.cpp
@@ -26,6 +26,8 @@
#include <sys/wait.h>
#include <sys/time.h>
#include <string.h>
+#include <sys/types.h>
+#include <signal.h>
#include <string>
#include <iostream>
@@ -237,7 +239,14 @@ struct children : public vector<child *>
vector<child *>::iterator i;
for ( i = begin(); i != end(); ++ i )
{
- timersub ( & now, &((*i)->startTime), & duration );
+ //Not in POSIX
+ //timersub ( & now, &((*i)->startTime), & duration );
+ duration.tv_sec = now.tv_sec - (*i)->startTime.tv_sec;
+ duration.tv_usec = now.tv_usec - (*i)->startTime.tv_usec;
+ if (duration.tv_usec < 0) {
+ --duration.tv_sec;
+ duration.tv_usec += 1000000;
+ }
if ( (COMPLETED != (*i)->status) // child isn't done running
&&
diff --git a/cpp/src/tests/txshift.cpp b/cpp/src/tests/txshift.cpp
index 5f9c4f17fa..dd67710526 100644
--- a/cpp/src/tests/txshift.cpp
+++ b/cpp/src/tests/txshift.cpp
@@ -174,8 +174,8 @@ int main(int argc, char** argv)
for (size_t i = 0; i < opts.workers; i++) {
workers.push_back(new Worker(connection, opts.workQueue));
}
- for_each(workers.begin(), workers.end(), boost::bind(&Worker::start, _1));
- for_each(workers.begin(), workers.end(), boost::bind(&Worker::join, _1));
+ std::for_each(workers.begin(), workers.end(), boost::bind(&Worker::start, _1));
+ std::for_each(workers.begin(), workers.end(), boost::bind(&Worker::join, _1));
}
return 0;