You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by cl...@apache.org on 2010/11/04 19:51:43 UTC

svn commit: r1031148 - in /thrift/trunk: aclocal/ax_boost_base.m4 lib/cpp/test/Makefile.am lib/cpp/test/TransportTest.cpp lib/cpp/test/UnitTestMain.cpp

Author: clavoie
Date: Thu Nov  4 18:51:42 2010
New Revision: 1031148

URL: http://svn.apache.org/viewvc?rev=1031148&view=rev
Log:
THRIFT-953: Fix compilation of TransportTest.cpp on Mac (actual tests still fail) and fix boost m4 macros for Mac.

Modified:
    thrift/trunk/aclocal/ax_boost_base.m4
    thrift/trunk/lib/cpp/test/Makefile.am
    thrift/trunk/lib/cpp/test/TransportTest.cpp
    thrift/trunk/lib/cpp/test/UnitTestMain.cpp

Modified: thrift/trunk/aclocal/ax_boost_base.m4
URL: http://svn.apache.org/viewvc/thrift/trunk/aclocal/ax_boost_base.m4?rev=1031148&r1=1031147&r2=1031148&view=diff
==============================================================================
--- thrift/trunk/aclocal/ax_boost_base.m4 (original)
+++ thrift/trunk/aclocal/ax_boost_base.m4 Thu Nov  4 18:51:42 2010
@@ -70,11 +70,13 @@ if test "x$want_boost" = "xyes"; then
 	if test "$ac_boost_path" != ""; then
 		BOOST_LDFLAGS="-L$ac_boost_path/lib"
 		BOOST_CPPFLAGS="-I$ac_boost_path/include"
+		BOOST_ROOT_PATH="$ac_boost_path"
 	else
 		for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
 			if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
 				BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
 				BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
+				BOOST_ROOT_PATH="$ac_boost_path_tmp"
 				break;
 			fi
 		done
@@ -88,6 +90,8 @@ if test "x$want_boost" = "xyes"; then
 	LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
 	export LDFLAGS
 
+	export BOOST_ROOT_PATH
+
 	AC_LANG_PUSH(C++)
      	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 	@%:@include <boost/version.hpp>
@@ -141,6 +145,7 @@ if test "x$want_boost" = "xyes"; then
 			VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
 			BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
 			BOOST_LDFLAGS="-L$best_path/lib"
+			BOOST_ROOT_PATH="$best_path"
 
 	    		if test "x$BOOST_ROOT" != "x"; then
 				if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
@@ -152,6 +157,7 @@ if test "x$want_boost" = "xyes"; then
 						AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
 						BOOST_CPPFLAGS="-I$BOOST_ROOT"
 						BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
+						BOOST_ROOT_PATH="$BOOST_ROOT"
 					fi
 				fi
 	    		fi
@@ -161,6 +167,7 @@ if test "x$want_boost" = "xyes"; then
 		export CPPFLAGS
 		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
 		export LDFLAGS
+		export BOOST_ROOT_PATH
 
 		AC_LANG_PUSH(C++)
 	     	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@@ -189,6 +196,7 @@ if test "x$want_boost" = "xyes"; then
 	else
 		AC_SUBST(BOOST_CPPFLAGS)
 		AC_SUBST(BOOST_LDFLAGS)
+		AC_SUBST(BOOST_ROOT_PATH)
 		AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
 	fi
 

Modified: thrift/trunk/lib/cpp/test/Makefile.am
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/test/Makefile.am?rev=1031148&r1=1031147&r2=1031148&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/test/Makefile.am (original)
+++ thrift/trunk/lib/cpp/test/Makefile.am Thu Nov  4 18:51:42 2010
@@ -62,22 +62,35 @@ UnitTests_SOURCES = \
 	TMemoryBufferTest.cpp \
 	TBufferBaseTest.cpp
 
-UnitTests_LDADD = $(BOOST_LDFLAGS) libtestgencpp.la -lboost_unit_test_framework
+UnitTests_LDADD = \
+  $(BOOST_LDFLAGS) \
+  libtestgencpp.la \
+  $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a
 
 TransportTest_SOURCES = \
 	TransportTest.cpp
 
-TransportTest_LDADD = libtestgencpp.la $(top_builddir)/lib/cpp/libthriftz.la -l:libboost_unit_test_framework.a -lz
+TransportTest_LDADD = \
+  libtestgencpp.la \
+  $(top_builddir)/lib/cpp/libthriftz.la \
+  $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a \
+  -lz
 
 ZlibTest_SOURCES = \
 	ZlibTest.cpp
 
-ZlibTest_LDADD = libtestgencpp.la $(top_builddir)/lib/cpp/libthriftz.la -l:libboost_unit_test_framework.a -lz
+ZlibTest_LDADD = \
+  libtestgencpp.la \
+  $(top_builddir)/lib/cpp/libthriftz.la \
+  $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a \
+  -lz
 
 TFileTransportTest_SOURCES = \
 	TFileTransportTest.cpp
 
-TFileTransportTest_LDADD = libtestgencpp.la -l:libboost_unit_test_framework.a
+TFileTransportTest_LDADD = \
+  libtestgencpp.la \
+  $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a
 
 #
 # TFDTransportTest

Modified: thrift/trunk/lib/cpp/test/TransportTest.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/test/TransportTest.cpp?rev=1031148&r1=1031147&r2=1031148&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/test/TransportTest.cpp (original)
+++ thrift/trunk/lib/cpp/test/TransportTest.cpp Thu Nov  4 18:51:42 2010
@@ -379,7 +379,7 @@ void set_alarm() {
   struct sigaction action;
   memset(&action, 0, sizeof(action));
   action.sa_handler = alarm_handler;
-  action.sa_flags = SA_ONESHOT;
+  action.sa_flags = SA_RESETHAND;
   sigemptyset(&action.sa_mask);
   sigaction(SIGALRM, &action, NULL);
 
@@ -1025,9 +1025,10 @@ void parse_args(int argc, char* argv[], 
 
   if (!have_seed) {
     // choose a seed now if the user didn't specify one
-    struct timespec t;
-    clock_gettime(CLOCK_REALTIME, &t);
-    options->seed = t.tv_sec + t.tv_nsec;
+    struct timeval tv;
+    struct timezone tz;
+    gettimeofday(&tv, &tz);
+    options->seed = tv.tv_sec ^ tv.tv_usec;
   }
 }
 

Modified: thrift/trunk/lib/cpp/test/UnitTestMain.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/test/UnitTestMain.cpp?rev=1031148&r1=1031147&r2=1031148&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/test/UnitTestMain.cpp (original)
+++ thrift/trunk/lib/cpp/test/UnitTestMain.cpp Thu Nov  4 18:51:42 2010
@@ -18,6 +18,4 @@
  */
 
 #define BOOST_TEST_MODULE thrift
-#define BOOST_TEST_DYN_LINK
-#define BOOST_AUTO_TEST_MAIN
 #include <boost/test/auto_unit_test.hpp>