summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Duxbury <bryanduxbury@apache.org>2010-05-02 23:04:03 +0000
committerBryan Duxbury <bryanduxbury@apache.org>2010-05-02 23:04:03 +0000
commitf7d9f8e4899ac9b126a4ed3cd11a949fd476a066 (patch)
treefa697d94823a2a2b0aa5a9e71880c9a8733dcf84
parent7173bd96bd7002d3b4ef86f02877b83d80b6c83b (diff)
downloadthrift-f7d9f8e4899ac9b126a4ed3cd11a949fd476a066.tar.gz
THRIFT-650. build: Make Check fails on Centos/OSX with 0.2.0 tarball
This patch fixes the make check target for OSX. Patch: Anthony Molinaro git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@940327 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--test/Makefile.am2
-rw-r--r--test/TBufferBaseTest.cpp31
-rw-r--r--test/TMemoryBufferTest.cpp6
-rw-r--r--test/UnitTestMain.cpp4
4 files changed, 25 insertions, 18 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 1226935de..1463a6f46 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -68,7 +68,7 @@ UnitTests_SOURCES = \
TMemoryBufferTest.cpp \
TBufferBaseTest.cpp
-UnitTests_LDADD = libtestgencpp.la
+UnitTests_LDADD = libtestgencpp.la -lboost_unit_test_framework
#
# TFDTransportTest
diff --git a/test/TBufferBaseTest.cpp b/test/TBufferBaseTest.cpp
index da3ce8567..21f474791 100644
--- a/test/TBufferBaseTest.cpp
+++ b/test/TBufferBaseTest.cpp
@@ -18,8 +18,7 @@
*/
#include <algorithm>
-#include <boost/foreach.hpp>
-#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
#include <transport/TBufferTransports.h>
#include <transport/TShortReadTransport.h>
@@ -30,8 +29,6 @@ using apache::thrift::transport::TBufferedTransport;
using apache::thrift::transport::TFramedTransport;
using apache::thrift::transport::test::TShortReadTransport;
-#define foreach BOOST_FOREACH
-
// Shamelessly copied from ZlibTransport. TODO: refactor.
unsigned int dist[][5000] = {
{ 1<<15 },
@@ -175,7 +172,7 @@ void init_data() {
}
-BOOST_AUTO_TEST_SUITE( TBufferBaseTest )
+BOOST_AUTO_TEST_SUITE( TBufferBaseTest );
BOOST_AUTO_TEST_CASE( test_MemoryBuffer_Write_GetBuffer ) {
init_data();
@@ -401,7 +398,8 @@ BOOST_AUTO_TEST_CASE( test_BufferedTransport_Write ) {
1<<14, 1<<17,
};
- foreach (int size, sizes) {
+ for (int i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
+ int size = sizes[i];
for (int d1 = 0; d1 < 3; d1++) {
shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(16));
TBufferedTransport trans(buffer, size);
@@ -431,7 +429,8 @@ BOOST_AUTO_TEST_CASE( test_BufferedTransport_Read_Full ) {
1<<14, 1<<17,
};
- foreach (int size, sizes) {
+ for (int i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
+ int size = sizes[i];
for (int d1 = 0; d1 < 3; d1++) {
shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(data, sizeof(data)));
TBufferedTransport trans(buffer, size);
@@ -463,7 +462,8 @@ BOOST_AUTO_TEST_CASE( test_BufferedTransport_Read_Short ) {
1<<14, 1<<17,
};
- foreach (int size, sizes) {
+ for (int i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
+ int size = sizes[i];
for (int d1 = 0; d1 < 3; d1++) {
shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(data, sizeof(data)));
shared_ptr<TShortReadTransport> tshort(new TShortReadTransport(buffer, 0.125));
@@ -496,7 +496,8 @@ BOOST_AUTO_TEST_CASE( test_FramedTransport_Write ) {
1<<14, 1<<17,
};
- foreach (int size, sizes) {
+ for (int i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
+ int size = sizes[i];
for (int d1 = 0; d1 < 3; d1++) {
shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(16));
TFramedTransport trans(buffer, size);
@@ -558,8 +559,10 @@ BOOST_AUTO_TEST_CASE( test_FramedTransport_Write_Read ) {
int probs[] = { 1, 2, 4, 8, 16, 32, };
- foreach (int size, sizes) {
- foreach (int prob, probs) {
+ for (int i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
+ int size = sizes[i];
+ for (int j = 0; j < sizeof (probs) / sizeof (probs[0]); j++) {
+ int prob = probs[j];
for (int d1 = 0; d1 < 3; d1++) {
shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(16));
TFramedTransport trans(buffer, size);
@@ -588,7 +591,9 @@ BOOST_AUTO_TEST_CASE( test_FramedTransport_Write_Read ) {
int read_offset = 0;
int read_index = 0;
- foreach (int fsize, flush_sizes) {
+
+ for (int k = 0; k < flush_sizes.size(); k++) {
+ int fsize = flush_sizes[k];
// We are exploiting an implementation detail of TFramedTransport.
// The read buffer starts empty and it will never do more than one
// readFrame per read, so we should always get exactly one frame.
@@ -636,4 +641,4 @@ BOOST_AUTO_TEST_CASE( test_FramedTransport_Empty_Flush ) {
BOOST_CHECK_EQUAL(buffer->getBufferAsString(), output2);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END();
diff --git a/test/TMemoryBufferTest.cpp b/test/TMemoryBufferTest.cpp
index 49bd10b5d..3dc19f88e 100644
--- a/test/TMemoryBufferTest.cpp
+++ b/test/TMemoryBufferTest.cpp
@@ -17,7 +17,7 @@
* under the License.
*/
-#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
#include <iostream>
#include <climits>
#include <cassert>
@@ -25,7 +25,7 @@
#include <protocol/TBinaryProtocol.h>
#include "gen-cpp/ThriftTest_types.h"
-BOOST_AUTO_TEST_SUITE( TMemoryBufferTest )
+BOOST_AUTO_TEST_SUITE( TMemoryBufferTest );
BOOST_AUTO_TEST_CASE( test_roundtrip ) {
using apache::thrift::transport::TMemoryBuffer;
@@ -104,4 +104,4 @@ BOOST_AUTO_TEST_CASE( test_exceptions )
}
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END();
diff --git a/test/UnitTestMain.cpp b/test/UnitTestMain.cpp
index d90c54f48..d4e1ece7a 100644
--- a/test/UnitTestMain.cpp
+++ b/test/UnitTestMain.cpp
@@ -18,4 +18,6 @@
*/
#define BOOST_TEST_MODULE thrift
-#include <boost/test/included/unit_test.hpp>
+#define BOOST_TEST_DYN_LINK
+#define BOOST_AUTO_TEST_MAIN
+#include <boost/test/auto_unit_test.hpp>