Extend gmock to turn off socket listener
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 17 Oct 2014 15:50:12 +0000 (17:50 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 17 Oct 2014 15:53:30 +0000 (17:53 +0200)
On Linux, you'd generally expect this feature to work, but on Cray the
linker warns that the use of getaddrinfo() would require linking a
shared library at runtime. That never happens because we don't use the
socket listener feature, but we don't want people stressing over that
at build time.

Change-Id: I9c358a2923d7563809d471f2ea1767cf2e8bbe25

src/external/gmock-1.7.0/CMakeLists.txt
src/external/gmock-1.7.0/README.Gromacs
src/external/gmock-1.7.0/gtest/include/gtest/internal/gtest-port.h

index d0552fb3f968f8d0fcb39e45e6ac343d7d2eaf5a..c31ccf06877d249fa46135673594ef12ea30d952 100644 (file)
@@ -68,7 +68,7 @@ if (HAS_NO_UNUSED_VARIABLE)
 endif()
 
 add_library(gmock STATIC ${UNITTEST_TARGET_OPTIONS} ${GMOCK_SOURCES} ${GTEST_SOURCES})
-set_property(TARGET gmock APPEND PROPERTY COMPILE_DEFINITIONS "${GMOCK_COMPILE_DEFINITIONS}")
+set_property(TARGET gmock APPEND PROPERTY COMPILE_DEFINITIONS "${GMOCK_COMPILE_DEFINITIONS};GTEST_CAN_STREAM_RESULTS=0")
 
 set(GMOCK_LIBRARIES gmock ${PTHREADS_LIBRARIES} PARENT_SCOPE)
 set(GTEST_LIBRARIES ${GMOCK_LIBRARIES} PARENT_SCOPE)
index 7560c11d5157083df1a45ff465c42583ddd9c27f..fd2f2a772dd3a2f764713fad1d6938c84502bac8 100644 (file)
@@ -20,3 +20,12 @@ This is not the case on all platforms, so on line 1610 of gtest/src/gtest.cc
 we have added a define to only use this if GTEST_HAS_WCSCASECMP is set. Since
 we never set this define, we fall back on the alternative internal implementation
 which should be perfectly fine for now.
+
+gmock-1.7.0 also assumes that streaming results to a socket is
+something you can always do on Linux, but the implementation uses
+getaddrinfo(), about which the Cray linker warns because its use would
+require shared libraries at run time. Since Gromacs testing doesn't
+use this feature, we'd just want to turn it off, but there's no
+interface for that. So, GTEST_CAN_STREAM_RESULTS is added in
+gtest/include/gtest/internal/gtest-port.h to allow the default
+behaviour to be applied only if the user hasn't gotten involved.
\ No newline at end of file
index dc4fe0cb6b89413946629fae704827c60600425a..811078c80d6a6fe7923baf5979537447ac5d740b 100644 (file)
@@ -85,6 +85,8 @@
 //   GTEST_CREATE_SHARED_LIBRARY
 //                            - Define to 1 when compiling Google Test itself
 //                              as a shared library.
+//   GTEST_CAN_STREAM_RESULTS - Define to 1/0 to indicate that streaming
+//                              results to a socket is/isn't available
 
 // This header defines the following utilities:
 //
@@ -679,8 +681,12 @@ using ::std::tuple_size;
     (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)
 
 // Determines whether test results can be streamed to a socket.
-#if GTEST_OS_LINUX
-# define GTEST_CAN_STREAM_RESULTS_ 1
+#ifndef GTEST_CAN_STREAM_RESULTS
+# if GTEST_OS_LINUX
+#  define GTEST_CAN_STREAM_RESULTS_ 1
+# endif
+#else
+# define GTEST_CAN_STREAM_RESULTS_ GTEST_CAN_STREAM_RESULTS
 #endif
 
 // Defines some utility macros.