thrift-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bryanduxb...@apache.org
Subject svn commit: r940327 - in /incubator/thrift/trunk/test: Makefile.am TBufferBaseTest.cpp TMemoryBufferTest.cpp UnitTestMain.cpp
Date Sun, 02 May 2010 23:04:04 GMT
Author: bryanduxbury
Date: Sun May  2 23:04:03 2010
New Revision: 940327

URL: http://svn.apache.org/viewvc?rev=940327&view=rev
Log:
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

Modified:
    incubator/thrift/trunk/test/Makefile.am
    incubator/thrift/trunk/test/TBufferBaseTest.cpp
    incubator/thrift/trunk/test/TMemoryBufferTest.cpp
    incubator/thrift/trunk/test/UnitTestMain.cpp

Modified: incubator/thrift/trunk/test/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/Makefile.am?rev=940327&r1=940326&r2=940327&view=diff
==============================================================================
--- incubator/thrift/trunk/test/Makefile.am (original)
+++ incubator/thrift/trunk/test/Makefile.am Sun May  2 23:04:03 2010
@@ -68,7 +68,7 @@ UnitTests_SOURCES = \
 	TMemoryBufferTest.cpp \
 	TBufferBaseTest.cpp
 
-UnitTests_LDADD = libtestgencpp.la
+UnitTests_LDADD = libtestgencpp.la -lboost_unit_test_framework
 
 #
 # TFDTransportTest

Modified: incubator/thrift/trunk/test/TBufferBaseTest.cpp
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/TBufferBaseTest.cpp?rev=940327&r1=940326&r2=940327&view=diff
==============================================================================
--- incubator/thrift/trunk/test/TBufferBaseTest.cpp (original)
+++ incubator/thrift/trunk/test/TBufferBaseTest.cpp Sun May  2 23:04:03 2010
@@ -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::TBuffer
 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_BufferedTrans
     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_BufferedTrans
     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_BufferedTrans
     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_FramedTranspo
     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_FramedTranspo
 
   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_FramedTranspo
 
         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_FramedTranspo
   BOOST_CHECK_EQUAL(buffer->getBufferAsString(), output2);
 }
 
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END();

Modified: incubator/thrift/trunk/test/TMemoryBufferTest.cpp
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/TMemoryBufferTest.cpp?rev=940327&r1=940326&r2=940327&view=diff
==============================================================================
--- incubator/thrift/trunk/test/TMemoryBufferTest.cpp (original)
+++ incubator/thrift/trunk/test/TMemoryBufferTest.cpp Sun May  2 23:04:03 2010
@@ -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();

Modified: incubator/thrift/trunk/test/UnitTestMain.cpp
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/UnitTestMain.cpp?rev=940327&r1=940326&r2=940327&view=diff
==============================================================================
--- incubator/thrift/trunk/test/UnitTestMain.cpp (original)
+++ incubator/thrift/trunk/test/UnitTestMain.cpp Sun May  2 23:04:03 2010
@@ -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>



Mime
View raw message