diff options
39 files changed, 460 insertions, 308 deletions
diff --git a/qpid/cpp/src/Makefile.am b/qpid/cpp/src/Makefile.am index 8b1c1d7246..40e094de5d 100644 --- a/qpid/cpp/src/Makefile.am +++ b/qpid/cpp/src/Makefile.am @@ -187,7 +187,7 @@ libqpidcommon_la_SOURCES = \ qpid/ISList.h \ qpid/pointer_to_other.h -libqpidbroker_la_LIBADD = libqpidcommon.la -lboost_iostreams +libqpidbroker_la_LIBADD = libqpidcommon.la libqpidbroker_la_SOURCES = \ $(mgen_broker_cpp) \ qpid/amqp_0_10/Connection.h \ diff --git a/qpid/cpp/src/qpid/IList.h b/qpid/cpp/src/qpid/IList.h index f5c78ced68..6a5299862c 100644 --- a/qpid/cpp/src/qpid/IList.h +++ b/qpid/cpp/src/qpid/IList.h @@ -38,6 +38,8 @@ template <class Pointer> class IListNode { typedef Pointer pointer; typedef typename Pointee<Pointer>::type NodeType; typedef typename pointer_to_other<Pointer, const NodeType>::type const_pointer; + + pointer prev, next; protected: IListNode() : prev() {} @@ -49,7 +51,6 @@ template <class Pointer> class IListNode { const_pointer getPrev() const { return prev; } private: - pointer prev, next; friend class IList<NodeType>; }; @@ -168,10 +169,14 @@ template<class Node> class IList { template <class U> Iterator( const Iterator<U>& i, typename boost::enable_if_convertible<U*, T*>::type* = 0 - ) : ptr(i.ptr) {} + ) : ptr(i.ptr) {} operator pointer() { return ptr; } operator const_pointer() const { return ptr; } + + + pointer ptr; + private: friend class boost::iterator_core_access; @@ -183,7 +188,6 @@ template<class Node> class IList { void decrement() { ptr = ptr->prev; } bool equal(const Iterator& x) const { return ptr == x.ptr; } - pointer ptr; friend class IList<Node>; }; diff --git a/qpid/cpp/src/qpid/ISList.h b/qpid/cpp/src/qpid/ISList.h index 96ba3ec726..b0004c9561 100644 --- a/qpid/cpp/src/qpid/ISList.h +++ b/qpid/cpp/src/qpid/ISList.h @@ -49,13 +49,15 @@ template <class Pointer> class ISListNode { typedef Pointer pointer; typedef typename Pointee<Pointer>::type NodeType; typedef typename pointer_to_other<Pointer, const NodeType>::type const_pointer; + + pointer getNext() { return next; } + pointer * getNextPtr() { return & next; } + const_pointer getNext() const { return next; } protected: ISListNode() : next() {} ISListNode(const ISListNode&) {} // Don't copy the next pointer. - pointer getNext() { return next; } - const_pointer getNext() const { return next; } private: pointer next; @@ -151,6 +153,7 @@ template <class Node> class ISList : private boost::noncopyable { operator pointer() { return *pptr; } operator const_pointer() const { return *pptr; } + pointer* pptr; private: friend class boost::iterator_core_access; @@ -158,10 +161,9 @@ template <class Node> class ISList : private boost::noncopyable { Iterator(const pointer* pp) : pptr(const_cast<pointer*>(pp)) {}; T& dereference() const { return **pptr; } - void increment() { pptr = &(**pptr).next; } + void increment() { pptr = (**pptr).getNextPtr(); } bool equal(const Iterator& x) const { return pptr == x.pptr; } - pointer* pptr; friend class ISList<Node>; }; diff --git a/qpid/cpp/src/qpid/Options.cpp b/qpid/cpp/src/qpid/Options.cpp index a5d3b54dd6..1628fea0df 100644 --- a/qpid/cpp/src/qpid/Options.cpp +++ b/qpid/cpp/src/qpid/Options.cpp @@ -50,11 +50,49 @@ struct EnvOptMapper { static const std::string prefix("QPID_"); if (envVar.substr(0, prefix.size()) == prefix) { string env = envVar.substr(prefix.size()); +#if (BOOST_VERSION >= 103300) typedef const std::vector< boost::shared_ptr<po::option_description> > OptDescs; OptDescs::const_iterator i = find_if(opts.options().begin(), opts.options().end(), boost::bind(matchStr, env, _1)); if (i != opts.options().end()) return (*i)->long_name(); +#else + /*=================================================================== + For Boost version 103200 and below. + + In Boost version 103200, the options_description::options member, + used above, is private. So what I will do here is use the + count() funtion, which returns a 1 or 0 indicating presence or + absence of the environment variable. + + If it is present, I will return its name. Env vars do not have + short and long forms, so the name is synonymous with the long + name. (This would not work for command line args.) + And if it's absent -- an empty string. + =====================================================================*/ + + + /*------------------------------------------------------------ + The env vars come in unaltered, i.e. QPID_FOO, but the + options are stored normalized as "qpid-foo". Change the + local variable "env" so it can be found by "opts". + ------------------------------------------------------------*/ + for (std::string::iterator i = env.begin(); i != env.end(); ++i) + { + *i = (*i == '_') + ? '-' + : ::tolower(*i); + } + + if ( opts.count(env.c_str()) > 0 ) + { + return env.c_str(); + } + else + { + return string(); + } +#endif } return string(); } @@ -64,11 +102,19 @@ struct EnvOptMapper { if (pos == string::npos) return string(); string key = line.substr (0, pos); +#if (BOOST_VERSION >= 103300) typedef const std::vector< boost::shared_ptr<po::option_description> > OptDescs; OptDescs::const_iterator i = find_if(opts.options().begin(), opts.options().end(), boost::bind(matchCase, key, _1)); if (i != opts.options().end()) return string (line) + "\n"; +#else + try { + po::option_description desc = opts.find(key.c_str()); + return string (line) + "\n"; + } + catch (const std::exception& e) {} +#endif return string (); } @@ -91,6 +137,7 @@ void Options::parse(int argc, char** argv, const std::string& configFile, bool a parsing="command line options"; if (argc > 0 && argv != 0) { if (allowUnknown) { +#if (BOOST_VERSION >= 103300) // This hideous workaround is required because boost 1.33 has a bug // that causes 'allow_unregistered' to not work. po::command_line_parser clp = po::command_line_parser(argc, const_cast<char**>(argv)). @@ -103,6 +150,7 @@ void Options::parse(int argc, char** argv, const std::string& configFile, bool a if (!i->unregistered) filtopts.options.push_back (*i); po::store(filtopts, vm); +#endif } else po::store(po::parse_command_line(argc, const_cast<char**>(argv), *this), vm); @@ -141,8 +189,10 @@ void Options::parse(int argc, char** argv, const std::string& configFile, bool a catch (const std::exception& e) { ostringstream msg; msg << "Error in " << parsing << ": " << e.what() << endl; +#if (BOOST_VERSION >= 103300) if (find_nothrow("help", false)) msg << "Use --help to see valid options" << endl; +#endif throw Exception(msg.str()); } } diff --git a/qpid/cpp/src/qpid/amqp_0_10/Holder.h b/qpid/cpp/src/qpid/amqp_0_10/Holder.h index 3c734d967f..8712db6c86 100644 --- a/qpid/cpp/src/qpid/amqp_0_10/Holder.h +++ b/qpid/cpp/src/qpid/amqp_0_10/Holder.h @@ -70,7 +70,7 @@ class Holder : public framing::Blob<Size, BaseHeld> { template <class S> void serialize(S& s) { s.split(*this); - apply(s, *this->get()); + qpid::amqp_0_10::apply(s, *this->get()); } template <class T> T* getIf() { @@ -92,7 +92,7 @@ class Holder : public framing::Blob<Size, BaseHeld> { template <class D, class B, size_t S> Holder<D,B,S>& Holder<D,B,S>::operator=(const B& rhs) { Assign assign(*this); - apply(assign, rhs); + qpid::amqp_0_10::apply(assign, rhs); return *this; } diff --git a/qpid/cpp/src/qpid/broker/Daemon.cpp b/qpid/cpp/src/qpid/broker/Daemon.cpp index 3fcc487324..6fd1c3a292 100644 --- a/qpid/cpp/src/qpid/broker/Daemon.cpp +++ b/qpid/cpp/src/qpid/broker/Daemon.cpp @@ -19,9 +19,6 @@ #include "qpid/log/Statement.h" #include "qpid/Exception.h" -#include <boost/iostreams/stream.hpp> -#include <boost/iostreams/device/file_descriptor.hpp> - #include <errno.h> #include <fcntl.h> #include <signal.h> @@ -33,7 +30,6 @@ namespace qpid { namespace broker { using namespace std; -typedef boost::iostreams::stream<boost::iostreams::file_descriptor> fdstream; namespace { /** Throw an exception containing msg and strerror if throwIf is true. @@ -45,7 +41,11 @@ void throwIf(bool condition, const string& msg, int errNo=errno) { } -struct LockFile : public fdstream { +/*-------------------------------------------------- + Rewritten using low-level IO, for compatibility + with earlier Boost versions, i.e. 103200. +--------------------------------------------------*/ +struct LockFile { LockFile(const std::string& path_, bool create) : path(path_), fd(-1), created(create) @@ -55,13 +55,12 @@ struct LockFile : public fdstream { fd = ::open(path.c_str(), flags, 0644); throwIf(fd < 0,"Cannot open "+path); throwIf(::lockf(fd, F_TLOCK, 0) < 0, "Cannot lock "+path); - open(boost::iostreams::file_descriptor(fd)); } ~LockFile() { if (fd >= 0) { ::lockf(fd, F_ULOCK, 0); - close(); + ::close(fd); } } @@ -87,9 +86,13 @@ string Daemon::pidFile(uint16_t port) { return path.str(); } +/*-------------------------------------------------- + Rewritten using low-level IO, for compatibility + with earlier Boost versions, i.e. 103200. +--------------------------------------------------*/ void Daemon::fork() { - throwIf(pipe(pipeFds) < 0, "Can't create pipe"); + throwIf(::pipe(pipeFds) < 0, "Can't create pipe"); throwIf((pid = ::fork()) < 0, "Daemon fork failed"); if (pid == 0) { // Child try { @@ -115,9 +118,12 @@ void Daemon::fork() } catch (const exception& e) { QPID_LOG(critical, "Daemon startup failed: " << e.what()); - fdstream pipe(pipeFds[1]); - assert(pipe.is_open()); - pipe << "0 " << e.what() << endl; + stringstream pipeFailureMessage; + pipeFailureMessage << "0 " << e.what() << endl; + write ( pipeFds[1], + pipeFailureMessage.str().c_str(), + strlen(pipeFailureMessage.str().c_str()) + ); } } else { // Parent @@ -137,50 +143,101 @@ uint16_t Daemon::wait(int timeout) { // parent waits for child. tv.tv_sec = timeout; tv.tv_usec = 0; + /*-------------------------------------------------- + Rewritten using low-level IO, for compatibility + with earlier Boost versions, i.e. 103200. + --------------------------------------------------*/ fd_set fds; FD_ZERO(&fds); FD_SET(pipeFds[0], &fds); int n=select(FD_SETSIZE, &fds, 0, 0, &tv); throwIf(n==0, "Timed out waiting for daemon"); throwIf(n<0, "Error waiting for daemon"); - fdstream pipe(pipeFds[0]); - pipe.exceptions(ios::failbit|ios::badbit|ios::eofbit); uint16_t port = 0; - try { - pipe >> port; - if (port == 0) { - string errmsg; - pipe >> skipws; - getline(pipe, errmsg); - throw Exception("Daemon startup failed"+ - (errmsg.empty() ? string(".") : ": " + errmsg)); - } - } - catch (const fdstream::failure& e) { - throw Exception(string("Failed to read daemon port: ")+e.what()); + /* + * Read the child's port number from the pipe. + */ + int desired_read = sizeof(uint16_t); + if ( desired_read > ::read(pipeFds[0], & port, desired_read) ) { + throw Exception("Cannot write lock file "+lockFile); } + + /* + * If the port number is 0, the child has put an error message + * on the pipe. Get it and throw it. + */ + if ( 0 == port ) { + // Skip whitespace + char c = ' '; + while ( isspace(c) ) { + if ( 1 > ::read(pipeFds[0], &c, 1) ) + throw Exception("Child port == 0, and no error message on pipe."); + } + + // Get Message + string errmsg; + while ( 1 ) { + if ( 1 > ::read(pipeFds[0], &c, 1) ) + throw Exception("Daemon startup failed"+ + (errmsg.empty() ? string(".") : ": " + errmsg)); + } + } + return port; } + +/* + * When the child is ready, it writes its pid to the + * lockfile and its port number on the pipe back to + * its parent process. This indicates that the + * child has successfully daemonized. When the parent + * hears the good news, it ill exit. + */ void Daemon::ready(uint16_t port) { // child lockFile = pidFile(port); LockFile lf(lockFile, true); - lf << getpid() << endl; - if (lf.fail()) - throw Exception("Cannot write lock file "+lockFile); - fdstream pipe(pipeFds[1]); - QPID_LOG(debug, "Daemon ready on port: " << port); - pipe << port << endl; - throwIf(!pipe.good(), "Error writing to parent"); + + /*--------------------------------------------------- + Rewritten using low-level IO, for compatibility + with earlier Boost versions, i.e. 103200. + ---------------------------------------------------*/ + /* + * Write the PID to the lockfile. + */ + pid_t pid = getpid(); + int desired_write = sizeof(pid_t); + if ( desired_write > ::write(lf.fd, & pid, desired_write) ) { + throw Exception("Cannot write lock file "+lockFile); + } + + /* + * Write the port number to the parent. + */ + desired_write = sizeof(uint16_t); + if ( desired_write > ::write(pipeFds[1], & port, desired_write) ) { + throw Exception("Error writing to parent." ); + } + + QPID_LOG(debug, "Daemon ready on port: " << port); } +/* + * The parent process reads the child's pid + * from the lockfile. + */ pid_t Daemon::getPid(uint16_t port) { string name = pidFile(port); - LockFile lockFile(name, false); + LockFile lf(name, false); pid_t pid; - lockFile >> pid; - if (lockFile.fail()) - throw Exception("Cannot read lock file "+name); + /*--------------------------------------------------- + Rewritten using low-level IO, for compatibility + with earlier Boost versions, i.e. 103200. + ---------------------------------------------------*/ + int desired_read = sizeof(pid_t); + if ( desired_read > ::read(lf.fd, & pid, desired_read) ) { + throw Exception("Cannot read lock file " + name); + } if (kill(pid, 0) < 0 && errno != EPERM) { unlink(name.c_str()); throw Exception("Removing stale lock file "+name); diff --git a/qpid/cpp/src/qpid/broker/Message.h b/qpid/cpp/src/qpid/broker/Message.h index 561cdede59..4fd2f1401d 100644 --- a/qpid/cpp/src/qpid/broker/Message.h +++ b/qpid/cpp/src/qpid/broker/Message.h @@ -75,11 +75,13 @@ public: const framing::FrameSet& getFrames() const { return frames; } template <class T> T* getProperties() { - return frames.getHeaders()->get<T>(true); + qpid::framing::AMQHeaderBody* p = frames.getHeaders(); + return p->get<T>(true); } template <class T> const T* getProperties() const { - return frames.getHeaders()->get<T>(); + qpid::framing::AMQHeaderBody* p = frames.getHeaders(); + return p->get<T>(true); } template <class T> const T* getMethod() const { diff --git a/qpid/cpp/src/qpid/framing/SessionState.cpp b/qpid/cpp/src/qpid/framing/SessionState.cpp index f9019b036c..b72bd15803 100644 --- a/qpid/cpp/src/qpid/framing/SessionState.cpp +++ b/qpid/cpp/src/qpid/framing/SessionState.cpp @@ -35,8 +35,8 @@ namespace framing { SessionState::SessionState(uint32_t ack, bool enableReplay, const Uuid& uuid) : state(ATTACHED), id(uuid), - lastReceived(-1), - lastSent(-1), + lastReceived(u_int32_t(-1)), + lastSent(u_int32_t(-1)), ackInterval(ack), sendAckAt(lastReceived+ackInterval), solicitAckAt(lastSent+ackInterval), @@ -47,8 +47,8 @@ SessionState::SessionState(uint32_t ack, bool enableReplay, const Uuid& uuid) : SessionState::SessionState(const Uuid& uuid) : state(ATTACHED), id(uuid), - lastReceived(-1), - lastSent(-1), + lastReceived(u_int32_t(-1)), + lastSent(u_int32_t(-1)), ackInterval(0), sendAckAt(0), solicitAckAt(0), diff --git a/qpid/cpp/src/qpid/log/Logger.cpp b/qpid/cpp/src/qpid/log/Logger.cpp index c0fc8ac959..f2f86e62fc 100644 --- a/qpid/cpp/src/qpid/log/Logger.cpp +++ b/qpid/cpp/src/qpid/log/Logger.cpp @@ -144,7 +144,7 @@ void Logger::log(const Statement& s, const std::string& msg) { os << " "; os << msg << endl; std::string formatted=os.str(); - + { ScopedLock l(lock); std::for_each(outputs.begin(), outputs.end(), diff --git a/qpid/cpp/src/tests/Array.cpp b/qpid/cpp/src/tests/Array.cpp index 336e57b485..c779cbe901 100644 --- a/qpid/cpp/src/tests/Array.cpp +++ b/qpid/cpp/src/tests/Array.cpp @@ -38,7 +38,7 @@ void populate(std::vector<std::string>& data, int count = 10) } } -BOOST_AUTO_TEST_CASE(testEncodeDecode) +QPID_AUTO_TEST_CASE(testEncodeDecode) { std::vector<std::string> data; populate(data); @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(testEncodeDecode) BOOST_CHECK(data == data2); } -BOOST_AUTO_TEST_CASE(testAssignment) +QPID_AUTO_TEST_CASE(testArrayAssignment) { std::vector<std::string> data; populate(data); diff --git a/qpid/cpp/src/tests/Blob.cpp b/qpid/cpp/src/tests/Blob.cpp index d27c0bbd85..c40e43b96e 100644 --- a/qpid/cpp/src/tests/Blob.cpp +++ b/qpid/cpp/src/tests/Blob.cpp @@ -54,7 +54,7 @@ struct Bar : public Count<Bar> { Bar(int n) : Count<Bar>(n) {}; }; typedef Blob<sizeof(Foo), Base> TestBlob ; -BOOST_AUTO_TEST_CASE(testCtor) { +QPID_AUTO_TEST_CASE(testBlobCtor) { { TestBlob empty; BOOST_CHECK(empty.empty()); @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(testCtor) { } -BOOST_AUTO_TEST_CASE(testAssign) { +QPID_AUTO_TEST_CASE(testAssign) { { TestBlob b; b = Foo(2); @@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE(testAssign) { } -BOOST_AUTO_TEST_CASE(testClear) { +QPID_AUTO_TEST_CASE(testClear) { TestBlob b(in_place<Foo>(5)); TestBlob c(b); BOOST_CHECK(!c.empty()); diff --git a/qpid/cpp/src/tests/ClientSessionTest.cpp b/qpid/cpp/src/tests/ClientSessionTest.cpp index 7a997db327..44d5ed4650 100644 --- a/qpid/cpp/src/tests/ClientSessionTest.cpp +++ b/qpid/cpp/src/tests/ClientSessionTest.cpp @@ -102,39 +102,42 @@ struct ClientSessionFixture : public ProxySessionFixture } }; -BOOST_FIXTURE_TEST_CASE(testQueueQuery, ClientSessionFixture) { - session =connection.newSession(ASYNC); - session.queueDeclare(queue="my-queue", alternateExchange="amq.fanout", exclusive=true, autoDelete=true); - TypedResult<QueueQueryResult> result = session.queueQuery(string("my-queue")); +QPID_AUTO_TEST_CASE(testQueueQuery) { + ClientSessionFixture fix; + fix.session = fix.connection.newSession(ASYNC); + fix.session.queueDeclare(queue="my-queue", alternateExchange="amq.fanout", exclusive=true, autoDelete=true); + TypedResult<QueueQueryResult> result = fix.session.queueQuery(string("my-queue")); BOOST_CHECK_EQUAL(false, result.get().getDurable()); BOOST_CHECK_EQUAL(true, result.get().getExclusive()); BOOST_CHECK_EQUAL(string("amq.fanout"), result.get().getAlternateExchange()); } -BOOST_FIXTURE_TEST_CASE(testTransfer, ClientSessionFixture) +QPID_AUTO_TEST_CASE(testTransfer) { - session=connection.newSession(ASYNC); - declareSubscribe(); - session.messageTransfer(content=TransferContent("my-message", "my-queue")); + ClientSessionFixture fix; + fix.session=fix.connection.newSession(ASYNC); + fix.declareSubscribe(); + fix.session.messageTransfer(content=TransferContent("my-message", "my-queue")); //get & test the message: - FrameSet::shared_ptr msg = session.get(); + FrameSet::shared_ptr msg = fix.session.get(); BOOST_CHECK(msg->isA<MessageTransferBody>()); BOOST_CHECK_EQUAL(string("my-message"), msg->getContent()); //confirm receipt: - session.getExecution().completed(msg->getId(), true, true); + fix.session.getExecution().completed(msg->getId(), true, true); } -BOOST_FIXTURE_TEST_CASE(testDispatcher, ClientSessionFixture) +QPID_AUTO_TEST_CASE(testDispatcher) { - session =connection.newSession(ASYNC); - declareSubscribe(); + ClientSessionFixture fix; + fix.session =fix.connection.newSession(ASYNC); + fix.declareSubscribe(); size_t count = 100; for (size_t i = 0; i < count; ++i) - session.messageTransfer(content=TransferContent(lexical_cast<string>(i), "my-queue")); - DummyListener listener(session, "my-dest", count); + fix.session.messageTransfer(content=TransferContent(lexical_cast<string>(i), "my-queue")); + DummyListener listener(fix.session, "my-dest", count); listener.run(); - BOOST_REQUIRE_EQUAL(count, listener.messages.size()); + BOOST_CHECK_EQUAL(count, listener.messages.size()); for (size_t i = 0; i < count; ++i) BOOST_CHECK_EQUAL(lexical_cast<string>(i), listener.messages[i].getData()); } @@ -158,35 +161,38 @@ BOOST_FIXTURE_TEST_CASE(testDispatcherThread, ClientSessionFixture) } */ -BOOST_FIXTURE_TEST_CASE(_FIXTURE, ClientSessionFixture) +QPID_AUTO_TEST_CASE(_FIXTURE) { - session =connection.newSession(ASYNC, 0); - session.suspend(); // session has 0 timeout. + ClientSessionFixture fix; + fix.session =fix.connection.newSession(ASYNC, 0); + fix.session.suspend(); // session has 0 timeout. try { - connection.resume(session); + fix.connection.resume(fix.session); BOOST_FAIL("Expected InvalidArgumentException."); } catch(const InternalErrorException&) {} } -BOOST_FIXTURE_TEST_CASE(testUseSuspendedError, ClientSessionFixture) +QPID_AUTO_TEST_CASE(testUseSuspendedError) { - session =connection.newSession(ASYNC, 60); - session.suspend(); + ClientSessionFixture fix; + fix.session =fix.connection.newSession(ASYNC, 60); + fix.session.suspend(); try { - session.exchangeQuery(name="amq.fanout"); + fix.session.exchangeQuery(name="amq.fanout"); BOOST_FAIL("Expected session suspended exception"); } catch(const CommandInvalidException&) {} } -BOOST_FIXTURE_TEST_CASE(testSuspendResume, ClientSessionFixture) +QPID_AUTO_TEST_CASE(testSuspendResume) { - session =connection.newSession(ASYNC, 60); - declareSubscribe(); - session.suspend(); + ClientSessionFixture fix; + fix.session =fix.connection.newSession(ASYNC, 60); + fix.declareSubscribe(); + fix.session.suspend(); // Make sure we are still subscribed after resume. - connection.resume(session); - session.messageTransfer(content=TransferContent("my-message", "my-queue")); - FrameSet::shared_ptr msg = session.get(); + fix.connection.resume(fix.session); + fix.session.messageTransfer(content=TransferContent("my-message", "my-queue")); + FrameSet::shared_ptr msg = fix.session.get(); BOOST_CHECK_EQUAL(string("my-message"), msg->getContent()); } diff --git a/qpid/cpp/src/tests/Cpg.cpp b/qpid/cpp/src/tests/Cpg.cpp index e8339bf773..db7debaa08 100644 --- a/qpid/cpp/src/tests/Cpg.cpp +++ b/qpid/cpp/src/tests/Cpg.cpp @@ -91,7 +91,7 @@ struct Callback : public Cpg::Handler { } }; -BOOST_AUTO_TEST_CASE(CpgBasic) { +QPID_AUTO_TEST_CASE(CpgBasic) { // Verify basic functionality of cpg. This will catch any // openais configuration or permission errors. // diff --git a/qpid/cpp/src/tests/FieldTable.cpp b/qpid/cpp/src/tests/FieldTable.cpp index db4c4906fa..716a5d3d39 100644 --- a/qpid/cpp/src/tests/FieldTable.cpp +++ b/qpid/cpp/src/tests/FieldTable.cpp @@ -28,7 +28,7 @@ using namespace qpid::framing; QPID_AUTO_TEST_SUITE(FieldTableTestSuite) -BOOST_AUTO_TEST_CASE(testMe) +QPID_AUTO_TEST_CASE(testMe) { FieldTable ft; ft.setString("A", "BCDE"); @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(testMe) } -BOOST_AUTO_TEST_CASE(testAssignment) +QPID_AUTO_TEST_CASE(testAssignment) { FieldTable a; FieldTable b; diff --git a/qpid/cpp/src/tests/FieldValue.cpp b/qpid/cpp/src/tests/FieldValue.cpp index a820ae57bd..eacf098034 100644 --- a/qpid/cpp/src/tests/FieldValue.cpp +++ b/qpid/cpp/src/tests/FieldValue.cpp @@ -30,7 +30,7 @@ IntegerValue i(42); //FieldTableValue ft; //EmptyValue e; -BOOST_AUTO_TEST_CASE(testStringValueEquals) +QPID_AUTO_TEST_CASE(testStringValueEquals) { BOOST_CHECK(StringValue("abc") == s); @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(testStringValueEquals) } -BOOST_AUTO_TEST_CASE(testIntegerValueEquals) +QPID_AUTO_TEST_CASE(testIntegerValueEquals) { BOOST_CHECK(IntegerValue(42) == i); BOOST_CHECK(IntegerValue(5) != i); @@ -57,7 +57,7 @@ BOOST_AUTO_TEST_CASE(testIntegerValueEquals) } #if 0 -BOOST_AUTO_TEST_CASE(testDecimalValueEquals) +QPID_AUTO_TEST_CASE(testDecimalValueEquals) { BOOST_CHECK(DecimalValue(1234, 2) == d); BOOST_CHECK(DecimalValue(12345, 2) != d); @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(testDecimalValueEquals) BOOST_CHECK(d != s); } -BOOST_AUTO_TEST_CASE(testFieldTableValueEquals) +QPID_AUTO_TEST_CASE(testFieldTableValueEquals) { ft.getValue().setString("foo", "FOO"); ft.getValue().setInt("magic", 7); diff --git a/qpid/cpp/src/tests/Frame.cpp b/qpid/cpp/src/tests/Frame.cpp index 0484dc4b2a..9ee3848b7b 100644 --- a/qpid/cpp/src/tests/Frame.cpp +++ b/qpid/cpp/src/tests/Frame.cpp @@ -29,7 +29,7 @@ using namespace std; using namespace qpid::framing; using namespace boost; -BOOST_AUTO_TEST_CASE(testContentBody) { +QPID_AUTO_TEST_CASE(testContentBody) { Frame f(42, AMQContentBody("foobar")); AMQBody* body=f.getBody(); BOOST_CHECK(dynamic_cast<AMQContentBody*>(body)); @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE(testContentBody) { BOOST_CHECK_EQUAL(content->getData(), "foobar"); } -BOOST_AUTO_TEST_CASE(testMethodBody) { +QPID_AUTO_TEST_CASE(testMethodBody) { FieldTable args; args.setString("foo", "bar"); Frame f( @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(testMethodBody) { BOOST_CHECK_EQUAL(lexical_cast<string>(*f.getBody()), lexical_cast<string>(*g.getBody())); } -BOOST_AUTO_TEST_CASE(testLoop) { +QPID_AUTO_TEST_CASE(testLoop) { // Run in a loop so heap profiler can spot any allocations. Buffer b(1024); for (int i = 0; i < 100; ++i) { diff --git a/qpid/cpp/src/tests/IList.cpp b/qpid/cpp/src/tests/IList.cpp index 2e872d0e05..a906e872e3 100644 --- a/qpid/cpp/src/tests/IList.cpp +++ b/qpid/cpp/src/tests/IList.cpp @@ -52,109 +52,117 @@ struct IListFixture { ostream& operator<<(ostream& o, const IListFixture::Node& n) { return o << n.value; } -BOOST_FIXTURE_TEST_CASE(IList_default_ctor, IListFixture) { - List l; +QPID_AUTO_TEST_CASE(IList_default_ctor) { + IListFixture fix; + IListFixture::List l; BOOST_CHECK(l.empty()); BOOST_CHECK(l.begin() == l.end()); BOOST_CHECK_EQUAL(0u, l.size()); } -BOOST_FIXTURE_TEST_CASE(IList_push_front, IListFixture) { - List l; - l.push_front(&a); +QPID_AUTO_TEST_CASE(IList_push_front) { + IListFixture fix; + IListFixture::List l; + l.push_front(&(fix.a)); BOOST_CHECK_EQUAL(1u, l.size()); - BOOST_CHECK_EQUAL(l, list_of(a)); - l.push_front(&b); + BOOST_CHECK_EQUAL(l, list_of(fix.a)); + l.push_front(&(fix.b)); BOOST_CHECK_EQUAL(2u, l.size()); - BOOST_CHECK_EQUAL(l, list_of(b)(a)); + BOOST_CHECK_EQUAL(l, list_of(fix.b)(fix.a)); } -BOOST_FIXTURE_TEST_CASE(IList_push_back, IListFixture) { - List l; - l.push_back(&a); +QPID_AUTO_TEST_CASE(IList_push_back) { + IListFixture fix; + IListFixture::List l; + l.push_back(&(fix.a)); BOOST_CHECK_EQUAL(1u, l.size()); - BOOST_CHECK_EQUAL(l, list_of(a)); - l.push_back(&b); + BOOST_CHECK_EQUAL(l, list_of(fix.a)); + l.push_back(&(fix.b)); BOOST_CHECK_EQUAL(2u, l.size()); - BOOST_CHECK_EQUAL(l, list_of(a)(b)); + BOOST_CHECK_EQUAL(l, list_of(fix.a)(fix.b)); } -BOOST_FIXTURE_TEST_CASE(IList_insert, IListFixture) { - List l; - List::iterator i(l.begin()); - i = l.insert(i, &a); - BOOST_CHECK_EQUAL(l, list_of(a)); +QPID_AUTO_TEST_CASE(IList_insert) { + IListFixture fix; + IListFixture::List l; + IListFixture::List::iterator i(l.begin()); + i = l.insert(i, &(fix.a)); + BOOST_CHECK_EQUAL(l, list_of(fix.a)); BOOST_CHECK(i == l.begin()); - i = l.insert(i, &b); - BOOST_CHECK_EQUAL(l, list_of(b)(a)); + i = l.insert(i, &(fix.b)); + BOOST_CHECK_EQUAL(l, list_of(fix.b)(fix.a)); BOOST_CHECK(i == l.begin()); i++; - BOOST_CHECK_EQUAL(*i, a); - i = l.insert(i, &c); - BOOST_CHECK_EQUAL(l, list_of(b)(c)(a)); - BOOST_CHECK_EQUAL(*i, c); - - i = l.insert(i, &d); - BOOST_CHECK_EQUAL(l, list_of(b)(d)(c)(a)); - BOOST_CHECK_EQUAL(*i, d); + BOOST_CHECK_EQUAL(*i, fix.a); + i = l.insert(i, &(fix.c)); + BOOST_CHECK_EQUAL(l, list_of(fix.b)(fix.c)(fix.a)); + BOOST_CHECK_EQUAL(*i, fix.c); + + i = l.insert(i, &(fix.d)); + BOOST_CHECK_EQUAL(l, list_of(fix.b)(fix.d)(fix.c)(fix.a)); + BOOST_CHECK_EQUAL(*i, fix.d); } -BOOST_FIXTURE_TEST_CASE(IList_iterator_test, IListFixture) { - List l; - l.push_back(&a); - l.push_back(&b); +QPID_AUTO_TEST_CASE(IList_iterator_test) { + IListFixture fix; + IListFixture::List l; + l.push_back(&(fix.a)); + l.push_back(&(fix.b)); - List::iterator i = l.begin(); - BOOST_CHECK_EQUAL(*i, a); - BOOST_CHECK_EQUAL(static_cast<Node*>(i), &a); - List::const_iterator ci = i; - BOOST_CHECK_EQUAL(static_cast<const Node*>(ci), &a); + IListFixture::List::iterator i = l.begin(); + BOOST_CHECK_EQUAL(*i, fix.a); + BOOST_CHECK_EQUAL(static_cast<IListFixture::Node*>(i), &(fix.a)); + IListFixture::List::const_iterator ci = i; + BOOST_CHECK_EQUAL(static_cast<const IListFixture::Node*>(ci), &(fix.a)); i++; - BOOST_CHECK_EQUAL(*i, b); - BOOST_CHECK_EQUAL(static_cast<Node*>(i), &b); + BOOST_CHECK_EQUAL(*i, fix.b); + BOOST_CHECK_EQUAL(static_cast<IListFixture::Node*>(i), &(fix.b)); i++; BOOST_CHECK(i == l.end()); } -BOOST_FIXTURE_TEST_CASE(IList_pop_front, IListFixture) { - List l; - l.push_back(&a); - l.push_back(&b); - BOOST_CHECK_EQUAL(l, list_of(a)(b)); +QPID_AUTO_TEST_CASE(IList_pop_front) { + IListFixture fix; + IListFixture::List l; + l.push_back(&(fix.a)); + l.push_back(&(fix.b)); + BOOST_CHECK_EQUAL(l, list_of(fix.a)(fix.b)); l.pop_front(); - BOOST_CHECK_EQUAL(l, list_of(b)); + BOOST_CHECK_EQUAL(l, list_of(fix.b)); l.pop_front(); BOOST_CHECK(l.empty()); } -BOOST_FIXTURE_TEST_CASE(IList_pop_back, IListFixture) { - List l; - l.push_back(&a); - l.push_back(&b); +QPID_AUTO_TEST_CASE(IList_pop_back) { + IListFixture fix; + IListFixture::List l; + l.push_back(&(fix.a)); + l.push_back(&(fix.b)); l.pop_back(); - BOOST_CHECK_EQUAL(l, list_of(a)); + BOOST_CHECK_EQUAL(l, list_of(fix.a)); l.pop_back(); BOOST_CHECK(l.empty()); } -BOOST_FIXTURE_TEST_CASE(IList_erase, IListFixture) { - List l; - l.push_back(&a); - l.push_back(&b); - l.push_back(&c); +QPID_AUTO_TEST_CASE(IList_erase) { + IListFixture fix; + IListFixture::List l; + l.push_back(&(fix.a)); + l.push_back(&(fix.b)); + l.push_back(&(fix.c)); - List::iterator i=l.begin(); + IListFixture::List::iterator i=l.begin(); i++; l.erase(i); - BOOST_CHECK_EQUAL(l, list_of(a)(c)); + BOOST_CHECK_EQUAL(l, list_of(fix.a)(fix.c)); i=l.begin(); i++; l.erase(i); - BOOST_CHECK_EQUAL(l, list_of(a)); + BOOST_CHECK_EQUAL(l, list_of(fix.a)); l.erase(l.begin()); BOOST_CHECK(l.empty()); diff --git a/qpid/cpp/src/tests/ISList.cpp b/qpid/cpp/src/tests/ISList.cpp index 81301e3732..ae16895803 100644 --- a/qpid/cpp/src/tests/ISList.cpp +++ b/qpid/cpp/src/tests/ISList.cpp @@ -67,94 +67,101 @@ struct Fixture { Fixture() :a('a'),b('b'),c('c'),d('d'),e('e') {} }; -BOOST_FIXTURE_TEST_CASE(default_ctor, Fixture) { - BOOST_CHECK(l.empty()); - BOOST_CHECK(l.begin() == l.end()); - BOOST_CHECK_EQUAL(0u, l.size()); +QPID_AUTO_TEST_CASE(default_ctor) { + Fixture fix; + BOOST_CHECK(fix.l.empty()); + BOOST_CHECK(fix.l.begin() == fix.l.end()); + BOOST_CHECK_EQUAL(0u, fix.l.size()); } -BOOST_FIXTURE_TEST_CASE(push_front, Fixture) { - l.push_front(&a); - BOOST_CHECK_EQUAL(1u, l.size()); - BOOST_CHECK_EQUAL(l, list_of(a)); - l.push_front(&b); - BOOST_CHECK_EQUAL(2u, l.size()); - BOOST_CHECK_EQUAL(l, list_of(b)(a)); +QPID_AUTO_TEST_CASE(push_front) { + Fixture fix; + fix.l.push_front(&(fix.a)); + BOOST_CHECK_EQUAL(1u, fix.l.size()); + BOOST_CHECK_EQUAL(fix.l, list_of(fix.a)); + fix.l.push_front(&(fix.b)); + BOOST_CHECK_EQUAL(2u, fix.l.size()); + BOOST_CHECK_EQUAL(fix.l, list_of(fix.b)(fix.a)); } -BOOST_FIXTURE_TEST_CASE(push_back, Fixture) { - l.push_back(&a); - BOOST_CHECK_EQUAL(1u, l.size()); - BOOST_CHECK_EQUAL(l, list_of(a)); - l.push_back(&b); - BOOST_CHECK_EQUAL(2u, l.size()); - BOOST_CHECK_EQUAL(l, list_of(a)(b)); +QPID_AUTO_TEST_CASE(push_back) { + Fixture fix; + fix.l.push_back(&(fix.a)); + BOOST_CHECK_EQUAL(1u, fix.l.size()); + BOOST_CHECK_EQUAL(fix.l, list_of(fix.a)); + fix.l.push_back(&(fix.b)); + BOOST_CHECK_EQUAL(2u, fix.l.size()); + BOOST_CHECK_EQUAL(fix.l, list_of(fix.a)(fix.b)); } -BOOST_FIXTURE_TEST_CASE(insert, Fixture) { - List::iterator i(l.begin()); - i = l.insert(i, &a); - BOOST_CHECK_EQUAL(l, list_of(a)); - BOOST_CHECK(i == l.begin()); +QPID_AUTO_TEST_CASE(insert) { + Fixture fix; + Fixture::List::iterator i(fix.l.begin()); + i = fix.l.insert(i, &(fix.a)); + BOOST_CHECK_EQUAL(fix.l, list_of(fix.a)); + BOOST_CHECK(i == fix.l.begin()); - i = l.insert(i, &b); - BOOST_CHECK_EQUAL(l, list_of(b)(a)); - BOOST_CHECK(i == l.begin()); + i = fix.l.insert(i, &(fix.b)); + BOOST_CHECK_EQUAL(fix.l, list_of(fix.b)(fix.a)); + BOOST_CHECK(i == fix.l.begin()); i++; - BOOST_CHECK_EQUAL(*i, a); - i = l.insert(i, &c); - BOOST_CHECK_EQUAL(l, list_of(b)(c)(a)); - BOOST_CHECK_EQUAL(*i, c); - - i = l.insert(i, &d); - BOOST_CHECK_EQUAL(l, list_of(b)(d)(c)(a)); - BOOST_CHECK_EQUAL(*i, d); + BOOST_CHECK_EQUAL(*i, fix.a); + i = fix.l.insert(i, &(fix.c)); + BOOST_CHECK_EQUAL(fix.l, list_of(fix.b)(fix.c)(fix.a)); + BOOST_CHECK_EQUAL(*i, fix.c); + + i = fix.l.insert(i, &(fix.d)); + BOOST_CHECK_EQUAL(fix.l, list_of(fix.b)(fix.d)(fix.c)(fix.a)); + BOOST_CHECK_EQUAL(*i, fix.d); } -BOOST_FIXTURE_TEST_CASE(iterator_test, Fixture) { - l.push_back(&a); - l.push_back(&b); +QPID_AUTO_TEST_CASE(iterator_test) { + Fixture fix; + fix.l.push_back(&(fix.a)); + fix.l.push_back(&(fix.b)); - List::iterator i = l.begin(); - BOOST_CHECK_EQUAL(*i, a); - BOOST_CHECK_EQUAL(static_cast<Node*>(i), &a); - List::const_iterator ci = i; - BOOST_CHECK_EQUAL(static_cast<const Node*>(ci), &a); + Fixture::List::iterator i = fix.l.begin(); + BOOST_CHECK_EQUAL(*i, fix.a); + BOOST_CHECK_EQUAL(static_cast<Fixture::Node*>(i), &(fix.a)); + Fixture::List::const_iterator ci = i; + BOOST_CHECK_EQUAL(static_cast<const Fixture::Node*>(ci), &(fix.a)); i++; - BOOST_CHECK_EQUAL(*i, b); - BOOST_CHECK_EQUAL(static_cast<Node*>(i), &b); + BOOST_CHECK_EQUAL(*i, fix.b); + BOOST_CHECK_EQUAL(static_cast<Fixture::Node*>(i), &(fix.b)); i++; - BOOST_CHECK(i == l.end()); + BOOST_CHECK(i == fix.l.end()); } -BOOST_FIXTURE_TEST_CASE(pop_front, Fixture) { - l.push_back(&a); - l.push_back(&b); - l.pop_front(); - BOOST_CHECK_EQUAL(l, list_of(b)); - l.pop_front(); - BOOST_CHECK(l.empty()); +QPID_AUTO_TEST_CASE(pop_front) { + Fixture fix; + fix.l.push_back(&(fix.a)); + fix.l.push_back(&(fix.b)); + fix.l.pop_front(); + BOOST_CHECK_EQUAL(fix.l, list_of(fix.b)); + fix.l.pop_front(); + BOOST_CHECK(fix.l.empty()); } -BOOST_FIXTURE_TEST_CASE(erase, Fixture) { - l.push_back(&a); - l.push_back(&b); - l.push_back(&c); +QPID_AUTO_TEST_CASE(erase) { + Fixture fix; + fix.l.push_back(&(fix.a)); + fix.l.push_back(&(fix.b)); + fix.l.push_back(&(fix.c)); - List::iterator i=l.begin(); + Fixture::List::iterator i=fix.l.begin(); i++; - l.erase(i); - BOOST_CHECK_EQUAL(l, list_of(a)(c)); + fix.l.erase(i); + BOOST_CHECK_EQUAL(fix.l, list_of(fix.a)(fix.c)); - i=l.begin(); + i=fix.l.begin(); i++; - l.erase(i); - BOOST_CHECK_EQUAL(l, list_of(a)); + fix.l.erase(i); + BOOST_CHECK_EQUAL(fix.l, list_of(fix.a)); - l.erase(l.begin()); - BOOST_CHECK(l.empty()); + fix.l.erase(fix.l.begin()); + BOOST_CHECK(fix.l.empty()); } @@ -193,7 +200,7 @@ struct IntrusiveNode : public NodeBase, public RefCounted, }; -BOOST_AUTO_TEST_CASE(intrusive_ptr_test) { +QPID_AUTO_TEST_CASE(intrusive_ptr_test) { smart_pointer_test<IntrusiveNode>(); } @@ -202,7 +209,7 @@ struct SharedNode : public NodeBase, public ISListNode<boost::shared_ptr<SharedN SharedNode() : NodeBase(0) {} }; -BOOST_AUTO_TEST_CASE(shared_ptr_test) { +QPID_AUTO_TEST_CASE(shared_ptr_test) { smart_pointer_test<SharedNode>(); } diff --git a/qpid/cpp/src/tests/IncompleteMessageList.cpp b/qpid/cpp/src/tests/IncompleteMessageList.cpp index 65cca4a628..925cdbf43e 100644 --- a/qpid/cpp/src/tests/IncompleteMessageList.cpp +++ b/qpid/cpp/src/tests/IncompleteMessageList.cpp @@ -56,7 +56,7 @@ struct Checker } }; -BOOST_AUTO_TEST_CASE(testProcessSimple) +QPID_AUTO_TEST_CASE(testProcessSimple) { IncompleteMessageList list; SequenceNumber counter(1); @@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE(testProcessSimple) list.process(Checker(), false); } -BOOST_AUTO_TEST_CASE(testProcessWithIncomplete) +QPID_AUTO_TEST_CASE(testProcessWithIncomplete) { IncompleteMessageList list; SequenceNumber counter(1); @@ -105,7 +105,7 @@ struct MockStore : public NullMessageStore } }; -BOOST_AUTO_TEST_CASE(testSyncProcessWithIncomplete) +QPID_AUTO_TEST_CASE(testSyncProcessWithIncomplete) { IncompleteMessageList list; SequenceNumber counter(1); diff --git a/qpid/cpp/src/tests/InlineVector.cpp b/qpid/cpp/src/tests/InlineVector.cpp index d1b3ebf7de..5f1a08759f 100644 --- a/qpid/cpp/src/tests/InlineVector.cpp +++ b/qpid/cpp/src/tests/InlineVector.cpp @@ -30,11 +30,11 @@ using namespace std; typedef InlineVector<int, 3> Vec; bool isInline(const Vec& v) { - return (char*)&v <= (char*)v.data() && - (char*)v.data() < (char*)&v+sizeof(v); + return (char*)&v <= (char*)(&v[0]) && + (char*)(&v[0]) < (char*)&v+sizeof(v); } -BOOST_AUTO_TEST_CASE(testCtor) { +QPID_AUTO_TEST_CASE(testCtor) { { Vec v; BOOST_CHECK(isInline(v)); @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(testCtor) { } } -BOOST_AUTO_TEST_CASE(testInsert) { +QPID_AUTO_TEST_CASE(testInsert) { Vec v; v.push_back(1); BOOST_CHECK_EQUAL(v.size(), 1u); diff --git a/qpid/cpp/src/tests/RefCounted.cpp b/qpid/cpp/src/tests/RefCounted.cpp index cd08a4491a..8c679a3d2e 100644 --- a/qpid/cpp/src/tests/RefCounted.cpp +++ b/qpid/cpp/src/tests/RefCounted.cpp @@ -35,7 +35,7 @@ struct CountMe : public RefCounted { int CountMe::instances=0; -BOOST_AUTO_TEST_CASE(testRefCounted) { +QPID_AUTO_TEST_CASE(testRefCounted) { BOOST_CHECK_EQUAL(0, CountMe::instances); intrusive_ptr<CountMe> p(new CountMe()); BOOST_CHECK_EQUAL(1, CountMe::instances); diff --git a/qpid/cpp/src/tests/SequenceSet.cpp b/qpid/cpp/src/tests/SequenceSet.cpp index c98b02b4b7..c204a8b5c5 100644 --- a/qpid/cpp/src/tests/SequenceSet.cpp +++ b/qpid/cpp/src/tests/SequenceSet.cpp @@ -50,7 +50,7 @@ struct RangeExpectations } }; -BOOST_AUTO_TEST_CASE(testAdd) { +QPID_AUTO_TEST_CASE(testAdd) { SequenceSet s; s.add(2); s.add(8,8); @@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE(testAdd) { RangeExpectations().expect(2, 10).check(t); } -BOOST_AUTO_TEST_CASE(testAdd2) { +QPID_AUTO_TEST_CASE(testAdd2) { SequenceSet s; s.add(7,6); s.add(4,4); @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(testAdd2) { RangeExpectations().expect(2, 10).check(s); } -BOOST_AUTO_TEST_CASE(testRemove) { +QPID_AUTO_TEST_CASE(testRemove) { SequenceSet s; SequenceSet t; s.add(0, 10); diff --git a/qpid/cpp/src/tests/Serializer.cpp b/qpid/cpp/src/tests/Serializer.cpp index 51b739218d..5caf2ea096 100644 --- a/qpid/cpp/src/tests/Serializer.cpp +++ b/qpid/cpp/src/tests/Serializer.cpp @@ -69,7 +69,7 @@ void execute(BoostFunctionSerializer& s, boost::function<void()> t) s.execute(t); } -BOOST_AUTO_TEST_CASE(testSingleThread) { +QPID_AUTO_TEST_CASE(testSingleThread) { // Verify that we call in the same thread by default. Tester tester; BoostFunctionSerializer s; @@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(testSingleThread) { } -BOOST_AUTO_TEST_CASE(testSingleThreadNoImmediate) { +QPID_AUTO_TEST_CASE(testSingleThreadNoImmediate) { // Verify that we call in different thread if immediate=false. Tester tester; BoostFunctionSerializer s(false); @@ -107,7 +107,7 @@ struct Caller : public Runnable, public Tester { BoostFunctionSerializer& serializer; }; -BOOST_AUTO_TEST_CASE(testDispatchThread) { +QPID_AUTO_TEST_CASE(testDispatchThread) { BoostFunctionSerializer s; Caller caller(s); Thread threads[100]; @@ -138,7 +138,7 @@ void notifyDispatch() { } // Use externally created threads. -BOOST_AUTO_TEST_CASE(testExternalDispatch) { +QPID_AUTO_TEST_CASE(testExternalDispatch) { serializer.reset(new BoostFunctionSerializer(false, ¬ifyDispatch)); Tester tester; for (int i = 0; i < 100; ++i) diff --git a/qpid/cpp/src/tests/SessionState.cpp b/qpid/cpp/src/tests/SessionState.cpp index 56d0055ed8..318bfbbddd 100644 --- a/qpid/cpp/src/tests/SessionState.cpp +++ b/qpid/cpp/src/tests/SessionState.cpp @@ -74,7 +74,7 @@ bool operator==(const AMQFrame& a, const AMQFrame& b) { }} // namespace qpid::framing -BOOST_AUTO_TEST_CASE(testSent) { +QPID_AUTO_TEST_CASE(testSent) { // Test that we send solicit-ack at the right interval. AMQContentBody f; SessionState s1(1); @@ -95,7 +95,7 @@ BOOST_AUTO_TEST_CASE(testSent) { BOOST_CHECK(s3.sent(f)); } -BOOST_AUTO_TEST_CASE(testReplay) { +QPID_AUTO_TEST_CASE(testReplay) { // Replay of all frames. SessionState session(100); sent(session, "abc"); @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(testReplay) { } -BOOST_AUTO_TEST_CASE(testReceived) { +QPID_AUTO_TEST_CASE(testReceived) { // Check that we request acks at the right interval. AMQContentBody f; SessionState s1(1); diff --git a/qpid/cpp/src/tests/Shlib.cpp b/qpid/cpp/src/tests/Shlib.cpp index 3adc33aac9..426a052c9f 100644 --- a/qpid/cpp/src/tests/Shlib.cpp +++ b/qpid/cpp/src/tests/Shlib.cpp @@ -29,7 +29,7 @@ QPID_AUTO_TEST_SUITE(ShlibTestSuite) using namespace qpid::sys; typedef void (*CallMe)(int*); -BOOST_AUTO_TEST_CASE(testShlib) { +QPID_AUTO_TEST_CASE(testShlib) { Shlib sh(".libs/libshlibtest.so"); // Double cast to avoid ISO warning. CallMe callMe=sh.getSymbol<CallMe>("callMe"); @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(testShlib) { catch (const qpid::Exception&) {} } -BOOST_AUTO_TEST_CASE(testAutoShlib) { +QPID_AUTO_TEST_CASE(testAutoShlib) { int unloaded = 0; { AutoShlib sh(".libs/libshlibtest.so"); diff --git a/qpid/cpp/src/tests/Url.cpp b/qpid/cpp/src/tests/Url.cpp index bc07737520..d2892d92bf 100644 --- a/qpid/cpp/src/tests/Url.cpp +++ b/qpid/cpp/src/tests/Url.cpp @@ -28,7 +28,7 @@ using namespace boost::assign; QPID_AUTO_TEST_SUITE(UrlTestSuite) -BOOST_AUTO_TEST_CASE(testUrl_str) { +QPID_AUTO_TEST_CASE(testUrl_str) { Url url; url.push_back(TcpAddress("foo.com")); url.push_back(TcpAddress("bar.com", 6789)); @@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE(testUrl_str) { } -BOOST_AUTO_TEST_CASE(testUrl_parse) { +QPID_AUTO_TEST_CASE(testUrl_parse) { Url url; url.parse("amqp:foo.com,tcp:bar.com:1234"); BOOST_CHECK_EQUAL(2u, url.size()); diff --git a/qpid/cpp/src/tests/Uuid.cpp b/qpid/cpp/src/tests/Uuid.cpp index c158cf53d2..ad26f796c0 100644 --- a/qpid/cpp/src/tests/Uuid.cpp +++ b/qpid/cpp/src/tests/Uuid.cpp @@ -35,7 +35,7 @@ struct UniqueSet : public std::set<Uuid> { } }; -BOOST_AUTO_TEST_CASE(testUuidCtor) { +QPID_AUTO_TEST_CASE(testUuidCtor) { // Uniqueness boost::array<Uuid,1000> uuids; for_each(uuids.begin(), uuids.end(), mem_fun_ref(&Uuid::generate)); @@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(testUuidCtor) { boost::array<uint8_t, 16> sample = {{'\x1b', '\x4e', '\x28', '\xba', '\x2f', '\xa1', '\x11', '\xd2', '\x88', '\x3f', '\xb9', '\xa7', '\x61', '\xbd', '\xe3', '\xfb'}}; const string sampleStr("1b4e28ba-2fa1-11d2-883f-b9a761bde3fb"); -BOOST_AUTO_TEST_CASE(testUuidIstream) { +QPID_AUTO_TEST_CASE(testUuidIstream) { Uuid uuid; istringstream in(sampleStr); in >> uuid; @@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(testUuidIstream) { BOOST_CHECK(uuid == sample); } -BOOST_AUTO_TEST_CASE(testUuidOstream) { +QPID_AUTO_TEST_CASE(testUuidOstream) { Uuid uuid(sample.c_array()); ostringstream out; out << uuid; @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(testUuidOstream) { BOOST_CHECK_EQUAL(out.str(), sampleStr); } -BOOST_AUTO_TEST_CASE(testUuidEncodeDecode) { +QPID_AUTO_TEST_CASE(testUuidEncodeDecode) { char* buff = static_cast<char*>(::alloca(Uuid::size())); Buffer wbuf(buff, Uuid::size()); Uuid uuid(sample.c_array()); diff --git a/qpid/cpp/src/tests/amqp_0_10/Map.cpp b/qpid/cpp/src/tests/amqp_0_10/Map.cpp index dcec1f49f7..efde967050 100644 --- a/qpid/cpp/src/tests/amqp_0_10/Map.cpp +++ b/qpid/cpp/src/tests/amqp_0_10/Map.cpp @@ -31,7 +31,7 @@ using namespace std; QPID_AUTO_TEST_SUITE(MapTestSuite) - BOOST_AUTO_TEST_CASE(testGetSet) { + QPID_AUTO_TEST_CASE(testGetSet) { MapValue v; v = Str8("foo"); BOOST_CHECK(v.get<Str8>()); @@ -53,7 +53,7 @@ template <class R> struct TestVisitor : public MapValue::Visitor<R> { R operator()(const R& r) const { return r; } }; -BOOST_AUTO_TEST_CASE(testVisit) { +QPID_AUTO_TEST_CASE(testVisit) { MapValue v; v = Str8("foo"); BOOST_CHECK_EQUAL(v.apply_visitor(TestVisitor<Str8>()), "foo"); @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(testVisit) { } -BOOST_AUTO_TEST_CASE(testEncodeMapValue) { +QPID_AUTO_TEST_CASE(testEncodeMapValue) { MapValue mv; std::string data; mv = Str8("hello"); @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(testEncodeMapValue) { BOOST_CHECK_EQUAL(*mv2.get<Str8>(), "hello"); } -BOOST_AUTO_TEST_CASE(testEncode) { +QPID_AUTO_TEST_CASE(testEncode) { Map map; std::string data; map["A"] = true; diff --git a/qpid/cpp/src/tests/amqp_0_10/ProxyTemplate.cpp b/qpid/cpp/src/tests/amqp_0_10/ProxyTemplate.cpp index cab87b6511..9d4fcb8935 100644 --- a/qpid/cpp/src/tests/amqp_0_10/ProxyTemplate.cpp +++ b/qpid/cpp/src/tests/amqp_0_10/ProxyTemplate.cpp @@ -34,7 +34,7 @@ struct ToAny { struct AnyProxy : public ProxyTemplate<ToAny, boost::any> {}; -BOOST_AUTO_TEST_CASE(testAnyProxy) { +QPID_AUTO_TEST_CASE(testAnyProxy) { AnyProxy p; boost::any a=p.connectionTune(1,2,3,4); BOOST_CHECK_EQUAL(a.type().name(), typeid(connection::Tune).name()); diff --git a/qpid/cpp/src/tests/amqp_0_10/apply.cpp b/qpid/cpp/src/tests/amqp_0_10/apply.cpp index 450aeac356..5a67c28c79 100644 --- a/qpid/cpp/src/tests/amqp_0_10/apply.cpp +++ b/qpid/cpp/src/tests/amqp_0_10/apply.cpp @@ -48,7 +48,7 @@ struct TestFunctor { bool operator()(const T&) { return false; } }; -BOOST_AUTO_TEST_CASE(testApply) { +QPID_AUTO_TEST_CASE(testApply) { connection::Tune tune(1,2,3,4); Control* p = &tune; @@ -83,7 +83,7 @@ struct VoidTestFunctor { void operator()(const T&) { code=0xFF; } }; -BOOST_AUTO_TEST_CASE(testApplyVoid) { +QPID_AUTO_TEST_CASE(testApplyVoid) { connection::Tune tune(1,2,3,4); Control* p = &tune; VoidTestFunctor tf; diff --git a/qpid/cpp/src/tests/amqp_0_10/handlers.cpp b/qpid/cpp/src/tests/amqp_0_10/handlers.cpp index 035429a15d..428643c802 100644 --- a/qpid/cpp/src/tests/amqp_0_10/handlers.cpp +++ b/qpid/cpp/src/tests/amqp_0_10/handlers.cpp @@ -92,7 +92,7 @@ struct TestUnitHandler : public boost::static_visitor<void> { void operator()(const CommandHolder& c) { c.invoke(handler); } }; -BOOST_AUTO_TEST_CASE(testHandlers) { +QPID_AUTO_TEST_CASE(testHandlers) { TestUnitHandler handler; Unit u; diff --git a/qpid/cpp/src/tests/amqp_0_10/serialize.cpp b/qpid/cpp/src/tests/amqp_0_10/serialize.cpp index f978609dd7..901779d8a3 100644 --- a/qpid/cpp/src/tests/amqp_0_10/serialize.cpp +++ b/qpid/cpp/src/tests/amqp_0_10/serialize.cpp @@ -83,7 +83,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // FIXME aconway 2008-04-15: // // TODO aconway 2008-02-20: should test 64 bit integrals for order also. -// BOOST_AUTO_TEST_CASE(testNetworkByteOrder) { +// QPID_AUTO_TEST_CASE(testNetworkByteOrder) { // string data; // uint32_t l = 0x11223344; @@ -99,7 +99,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // BOOST_CHECK_EQUAL(s, s2); // } -// BOOST_AUTO_TEST_CASE(testSetLimit) { +// QPID_AUTO_TEST_CASE(testSetLimit) { // typedef Codec::Encoder<back_insert_iterator<string> > Encoder; // string data; // Encoder encode(back_inserter(data), 3); @@ -111,7 +111,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // BOOST_CHECK_EQUAL(data, "123"); // } -// BOOST_AUTO_TEST_CASE(testScopedLimit) { +// QPID_AUTO_TEST_CASE(testScopedLimit) { // typedef Codec::Encoder<back_insert_iterator<string> > Encoder; // string data; // Encoder encode(back_inserter(data), 10); @@ -153,7 +153,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // void testValue(Map& m) { m["s"] = Str8("foobar"); m["b"] = true; m["c"] = uint16_t(42); } // //typedef mpl::vector<Str8, Str16>::type TestTypes; -// BOOST_AUTO_TEST_CASE_TEMPLATE(testEncodeDecode, T, AllTypes) +// QPID_AUTO_TEST_CASE_TEMPLATE(testEncodeDecode, T, AllTypes) // { // string data; // T t; @@ -178,7 +178,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // template <class S> void serialize(S& s) { s.split(*this); } // }; -// BOOST_AUTO_TEST_CASE(testSplit) { +// QPID_AUTO_TEST_CASE(testSplit) { // string data; // TestMe t1('x'); // Codec::encode(std::back_inserter(data))(t1); @@ -193,7 +193,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // BOOST_CHECK_EQUAL(t2.value, 'x'); // } -// BOOST_AUTO_TEST_CASE(testControlEncodeDecode) { +// QPID_AUTO_TEST_CASE(testControlEncodeDecode) { // string data; // Control::Holder h(in_place<connection::Tune>(1,2,3,4)); // Codec::encode(std::back_inserter(data))(h); @@ -214,7 +214,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // BOOST_CHECK_EQUAL(tune.heartbeatMax, 4u); // } -// BOOST_AUTO_TEST_CASE(testStruct32) { +// QPID_AUTO_TEST_CASE(testStruct32) { // message::DeliveryProperties dp; // dp.priority=message::MEDIUM; // dp.routingKey="foo"; @@ -236,7 +236,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // BOOST_CHECK_EQUAL(dp2->routingKey, "foo"); // } -// BOOST_AUTO_TEST_CASE(testStruct32Unknown) { +// QPID_AUTO_TEST_CASE(testStruct32Unknown) { // // Verify we can recode an unknown struct unchanged. // Struct32 s; // string data; @@ -260,7 +260,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // Packer<DummyPacked> serializable(DummyPacked& d) { return Packer<DummyPacked>(d); } -// BOOST_AUTO_TEST_CASE(testPackBits) { +// QPID_AUTO_TEST_CASE(testPackBits) { // DummyPacked d('a','b','c'); // BOOST_CHECK_EQUAL(packBits(d), 7u); // d.j = boost::none; @@ -270,7 +270,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // } -// BOOST_AUTO_TEST_CASE(testPacked) { +// QPID_AUTO_TEST_CASE(testPacked) { // string data; // Codec::encode(back_inserter(data))('a')(boost::optional<char>('b'))(boost::optional<char>())('c'); @@ -297,7 +297,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // BOOST_CHECK_EQUAL(dummy.k, 'y'); // } -// BOOST_AUTO_TEST_CASE(testUnitControl) { +// QPID_AUTO_TEST_CASE(testUnitControl) { // string data; // Control::Holder h(in_place<connection::Tune>(1,2,3,4)); // Codec::encode(std::back_inserter(data))(h); @@ -313,7 +313,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // BOOST_CHECK_EQUAL(data, data2); // } -// BOOST_AUTO_TEST_CASE(testArray) { +// QPID_AUTO_TEST_CASE(testArray) { // ArrayDomain<char> a; // a.resize(3, 'x'); // string data; @@ -338,7 +338,7 @@ typedef concat2<FixedSizeTypes, VariableSizeTypes>::type AllTypes; // BOOST_CHECK_EQUAL(data,data2); // } -// BOOST_AUTO_TEST_CASE(testStruct) { +// QPID_AUTO_TEST_CASE(testStruct) { // string data; // message::DeliveryProperties dp; @@ -420,7 +420,7 @@ struct RecodeUnit { } }; -BOOST_AUTO_TEST_CASE(testSerializeAllSegmentTypes) { +QPID_AUTO_TEST_CASE(testSerializeAllSegmentTypes) { RecodeUnit recode; allSegmentTypes(recode); } diff --git a/qpid/cpp/src/tests/cluster_client.cpp b/qpid/cpp/src/tests/cluster_client.cpp index cd048d1651..f6b3a80c97 100644 --- a/qpid/cpp/src/tests/cluster_client.cpp +++ b/qpid/cpp/src/tests/cluster_client.cpp @@ -57,7 +57,7 @@ struct ClusterConnections : public vector<shared_ptr<Connection> > { } }; -BOOST_AUTO_TEST_CASE(testWiringReplication) { +QPID_AUTO_TEST_CASE(testWiringReplication) { // Declare on one broker, use on others. ClusterConnections cluster; BOOST_REQUIRE(cluster.size() > 1); diff --git a/qpid/cpp/src/tests/exception_test.cpp b/qpid/cpp/src/tests/exception_test.cpp index 715cdaec2a..f7a91f662f 100644 --- a/qpid/cpp/src/tests/exception_test.cpp +++ b/qpid/cpp/src/tests/exception_test.cpp @@ -70,30 +70,33 @@ struct Catcher : public Runnable { } }; -BOOST_FIXTURE_TEST_CASE(DisconnectedPop, ProxySessionFixture) { - ProxyConnection c(broker->getPort()); - session.queueDeclare(arg::queue="q"); - subs.subscribe(lq, "q"); - Catcher<ClosedException> pop(bind(&LocalQueue::pop, boost::ref(lq))); - connection.proxy.close(); +QPID_AUTO_TEST_CASE(DisconnectedPop) { + ProxySessionFixture fix; + ProxyConnection c(fix.broker->getPort()); + fix.session.queueDeclare(arg::queue="q"); + fix.subs.subscribe(fix.lq, "q"); + Catcher<ClosedException> pop(bind(&LocalQueue::pop, boost::ref(fix.lq))); + fix.connection.proxy.close(); BOOST_CHECK(pop.join()); } -BOOST_FIXTURE_TEST_CASE(DisconnectedListen, ProxySessionFixture) { +QPID_AUTO_TEST_CASE(DisconnectedListen) { + ProxySessionFixture fix; struct NullListener : public MessageListener { void received(Message&) { BOOST_FAIL("Unexpected message"); } } l; - ProxyConnection c(broker->getPort()); - session.queueDeclare(arg::queue="q"); - subs.subscribe(l, "q"); - Thread t(subs); - connection.proxy.close(); + ProxyConnection c(fix.broker->getPort()); + fix.session.queueDeclare(arg::queue="q"); + fix.subs.subscribe(l, "q"); + Thread t(fix.subs); + fix.connection.proxy.close(); t.join(); - BOOST_CHECK_THROW(session.close(), InternalErrorException); + BOOST_CHECK_THROW(fix.session.close(), InternalErrorException); } -BOOST_FIXTURE_TEST_CASE(NoSuchQueueTest, ProxySessionFixture) { - BOOST_CHECK_THROW(subs.subscribe(lq, "no such queue").sync(), NotFoundException); +QPID_AUTO_TEST_CASE(NoSuchQueueTest) { + ProxySessionFixture fix; + BOOST_CHECK_THROW(fix.subs.subscribe(fix.lq, "no such queue").sync(), NotFoundException); } QPID_AUTO_TEST_SUITE_END() diff --git a/qpid/cpp/src/tests/logging.cpp b/qpid/cpp/src/tests/logging.cpp index 718ab01d9a..700586539f 100644 --- a/qpid/cpp/src/tests/logging.cpp +++ b/qpid/cpp/src/tests/logging.cpp @@ -37,7 +37,7 @@ using namespace std; using namespace boost; using namespace qpid::log; -BOOST_AUTO_TEST_CASE(testStatementInit) { +QPID_AUTO_TEST_CASE(testStatementInit) { Statement s=QPID_LOG_STATEMENT_INIT(debug); int line=__LINE__; BOOST_CHECK(!s.enabled); BOOST_CHECK_EQUAL(string(__FILE__), s.file); @@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(testStatementInit) { } -BOOST_AUTO_TEST_CASE(testSelector_enable) { +QPID_AUTO_TEST_CASE(testSelector_enable) { Selector s; // Simple enable s.enable(debug,"foo"); @@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(testSelector_enable) { BOOST_CHECK(s.isEnabled(critical, "oops")); } -BOOST_AUTO_TEST_CASE(testStatementEnabled) { +QPID_AUTO_TEST_CASE(testStatementEnabled) { // Verify that the singleton enables and disables static // log statements. Logger& l = Logger::instance(); @@ -109,7 +109,7 @@ struct TestOutput : public Logger::Output { using boost::assign::list_of; -BOOST_AUTO_TEST_CASE(testLoggerOutput) { +QPID_AUTO_TEST_CASE(testLoggerOutput) { Logger l; l.clear(); l.select(Selector(debug)); @@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(testLoggerOutput) { BOOST_CHECK_EQUAL(expect, out2->msg); } -BOOST_AUTO_TEST_CASE(testMacro) { +QPID_AUTO_TEST_CASE(testMacro) { Logger& l=Logger::instance(); l.clear(); l.select(Selector(info)); @@ -150,7 +150,7 @@ BOOST_AUTO_TEST_CASE(testMacro) { BOOST_CHECK_EQUAL(expect, out->msg); } -BOOST_AUTO_TEST_CASE(testLoggerFormat) { +QPID_AUTO_TEST_CASE(testLoggerFormat) { Logger& l = Logger::instance(); l.select(Selector(critical)); TestOutput* out=new TestOutput(l); @@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(testLoggerFormat) { BOOST_CHECK_REGEX(re, out->last()); } -BOOST_AUTO_TEST_CASE(testOstreamOutput) { +QPID_AUTO_TEST_CASE(testOstreamOutput) { Logger& l=Logger::instance(); l.clear(); l.select(Selector(error)); @@ -189,7 +189,7 @@ BOOST_AUTO_TEST_CASE(testOstreamOutput) { } #if 0 // This test requires manual intervention. Normally disabled. -BOOST_AUTO_TEST_CASE(testSyslogOutput) { +QPID_AUTO_TEST_CASE(testSyslogOutput) { Logger& l=Logger::instance(); l.clear(); l.select(Selector(info)); @@ -225,7 +225,7 @@ clock_t timeLoop(int times, int (*fp)()) { // forever under valgrind. Not friendly for regular test runs. // #if 0 -BOOST_AUTO_TEST_CASE(testOverhead) { +QPID_AUTO_TEST_CASE(testOverhead) { // Ensure that the ratio of CPU time for an incrementing loop // with and without disabled log statements is in acceptable limits. // @@ -252,7 +252,7 @@ Statement statement( #define ARGC(argv) (sizeof(argv)/sizeof(char*)) -BOOST_AUTO_TEST_CASE(testOptionsParse) { +QPID_AUTO_TEST_CASE(testOptionsParse) { const char* argv[]={ 0, "--log-enable", "error+:foo", @@ -277,7 +277,7 @@ BOOST_AUTO_TEST_CASE(testOptionsParse) { BOOST_CHECK(opts.thread); } -BOOST_AUTO_TEST_CASE(testOptionsDefault) { +QPID_AUTO_TEST_CASE(testOptionsDefault) { Options opts; vector<string> expect=list_of("stderr"); BOOST_CHECK_EQUAL(expect, opts.outputs); @@ -287,7 +287,7 @@ BOOST_AUTO_TEST_CASE(testOptionsDefault) { BOOST_CHECK(!(opts.source || opts.function || opts.thread)); } -BOOST_AUTO_TEST_CASE(testSelectorFromOptions) { +QPID_AUTO_TEST_CASE(testSelectorFromOptions) { const char* argv[]={ 0, "--log-enable", "error+:foo", @@ -306,7 +306,7 @@ BOOST_AUTO_TEST_CASE(testSelectorFromOptions) { BOOST_CHECK(s.isEnabled(critical, "foo")); } -BOOST_AUTO_TEST_CASE(testOptionsFormat) { +QPID_AUTO_TEST_CASE(testOptionsFormat) { Logger l; { Options opts; @@ -338,7 +338,7 @@ BOOST_AUTO_TEST_CASE(testOptionsFormat) { } } -BOOST_AUTO_TEST_CASE(testLoggerConfigure) { +QPID_AUTO_TEST_CASE(testLoggerConfigure) { Logger& l=Logger::instance(); l.clear(); Options opts; @@ -361,7 +361,7 @@ BOOST_AUTO_TEST_CASE(testLoggerConfigure) { unlink("logging.tmp"); } -BOOST_AUTO_TEST_CASE(testQuoteNonPrintable) { +QPID_AUTO_TEST_CASE(testQuoteNonPrintable) { Logger& l=Logger::instance(); l.clear(); Options opts; diff --git a/qpid/cpp/src/tests/perftest.cpp b/qpid/cpp/src/tests/perftest.cpp index b950e432f5..3dd4e876fc 100644 --- a/qpid/cpp/src/tests/perftest.cpp +++ b/qpid/cpp/src/tests/perftest.cpp @@ -39,6 +39,7 @@ #include <numeric> #include <algorithm> #include <unistd.h> +#include <math.h> using namespace std; @@ -367,7 +368,7 @@ struct Controller : public Client { double time=secs(start, end); double txrate=opts.transfers/time; double mbytes=(txrate*opts.size)/(1024*1024); - + if (!opts.summary) { cout << endl << "Total " << opts.transfers << " transfers of " << opts.size << " bytes in " diff --git a/qpid/cpp/src/tests/python_tests b/qpid/cpp/src/tests/python_tests index 4360992a2e..b7e389dbb2 100755 --- a/qpid/cpp/src/tests/python_tests +++ b/qpid/cpp/src/tests/python_tests @@ -3,7 +3,6 @@ QPID_PORT=${QPID_PORT:-5672} PYTHON_TESTS=${PYTHON_TESTS:-$*} - run() { SPEC=$1 FAILING=$2 @@ -17,4 +16,3 @@ if test -d ../../../python ; then else echo Warning: python tests not found. fi - diff --git a/qpid/cpp/src/tests/test_tools.h b/qpid/cpp/src/tests/test_tools.h index c5451643be..32127b0442 100644 --- a/qpid/cpp/src/tests/test_tools.h +++ b/qpid/cpp/src/tests/test_tools.h @@ -68,8 +68,12 @@ inline bool regexPredicate(const std::string& re, const std::string& text) { } /** Check for regular expression match. You must #include <boost/regex.hpp> */ -#define BOOST_CHECK_REGEX(re, text) \ +#if (BOOST_VERSION < 103300) + #define BOOST_CHECK_REGEX(re, text) +#else + #define BOOST_CHECK_REGEX(re, text) \ BOOST_CHECK_PREDICATE(regexPredicate, (re)(text)) +#endif /** Check if types of two objects (as given by typeinfo::name()) match. */ #define BOOST_CHECK_TYPEID_EQUAL(a,b) BOOST_CHECK_EQUAL(typeid(a).name(),typeid(b).name()) diff --git a/qpid/cpp/src/tests/unit_test.h b/qpid/cpp/src/tests/unit_test.h index 58ec20d26c..098545cbd8 100644 --- a/qpid/cpp/src/tests/unit_test.h +++ b/qpid/cpp/src/tests/unit_test.h @@ -28,16 +28,26 @@ #include <boost/version.hpp> #include <limits.h> // Must be inclued beofre boost/test headers. -#if (BOOST_VERSION < 103400) +#if (BOOST_VERSION < 103300) + +# include <boost/test/auto_unit_test.hpp> + +# define QPID_AUTO_TEST_SUITE(name) +# define QPID_AUTO_TEST_CASE(name) BOOST_AUTO_UNIT_TEST(name) +# define QPID_AUTO_TEST_SUITE_END() + +#elif (BOOST_VERSION < 103400) # include <boost/test/auto_unit_test.hpp> # define QPID_AUTO_TEST_SUITE(name) BOOST_AUTO_TEST_SUITE(name); +# define QPID_AUTO_TEST_CASE(name) BOOST_AUTO_TEST_CASE(name) # define QPID_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END(); #else # define QPID_AUTO_TEST_SUITE(name) BOOST_AUTO_TEST_SUITE(name) +# define QPID_AUTO_TEST_CASE(name) BOOST_AUTO_TEST_CASE(name) # define QPID_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END() # include <boost/test/unit_test.hpp> |