FreeBSD Bugzilla – Attachment 149790 Details for
Bug 192736
devel/googletest: improve bsd support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
work in progress for update
googletest.diff (text/plain), 10.15 KB, created by
John Marino
on 2014-11-24 20:59:45 UTC
(
hide
)
Description:
work in progress for update
Filename:
MIME Type:
Creator:
John Marino
Created:
2014-11-24 20:59:45 UTC
Size:
10.15 KB
patch
obsolete
>Index: devel/googletest/Makefile >=================================================================== >--- devel/googletest/Makefile (revision 373372) >+++ devel/googletest/Makefile (working copy) >@@ -2,18 +2,17 @@ > # $FreeBSD$ > > PORTNAME= googletest >-PORTVERSION= 1.5.0 >-PORTREVISION= 1 >+PORTVERSION= 1.7.0 > CATEGORIES= devel > MASTER_SITES= GOOGLE_CODE > DISTNAME= gtest-${PORTVERSION} > >-MAINTAINER= clsung@FreeBSD.org >+MAINTAINER= ports@FreeBSD.org > COMMENT= Framework for writing C++ tests on a variety of platforms > > LICENSE= BSD3CLAUSE > >-USES= libtool python:2,build shebangfix >+USES= libtool python:2,build shebangfix zip > GNU_CONFIGURE= yes > USE_LDCONFIG= yes > >@@ -22,7 +21,9 @@ > SHEBANG_FILES= scripts/fuse_gtest_files.py scripts/gen_gtest_pred_impl.py \ > scripts/pump.py > >-regression-test: >- cd ${WRKSRC}; ${MAKE} check >+# requires cmake >+#regression-test: >+# (cd ${WRKSRC} && ${MAKE_CMD} check) > >+ > .include <bsd.port.mk> >Index: devel/googletest/distinfo >=================================================================== >--- devel/googletest/distinfo (revision 373372) >+++ devel/googletest/distinfo (working copy) >@@ -1,2 +1,2 @@ >-SHA256 (gtest-1.5.0.tar.gz) = 24156a23cfa49a194c48d1b630fd8eaa63fffc403719b5ddb94cdbe8d9a96aff >-SIZE (gtest-1.5.0.tar.gz) = 896874 >+SHA256 (gtest-1.7.0.zip) = 247ca18dd83f53deb1328be17e4b1be31514cedfc1e3424f672bf11fd7e0d60d >+SIZE (gtest-1.7.0.zip) = 1164254 >Index: devel/googletest/files/patch-improve-bsd-support >=================================================================== >--- devel/googletest/files/patch-improve-bsd-support (revision 0) >+++ devel/googletest/files/patch-improve-bsd-support (working copy) >@@ -0,0 +1,215 @@ >+Index: include/gtest/internal/gtest-port.h >+=================================================================== >+--- include/gtest/internal/gtest-port.h (revision 692) >++++ include/gtest/internal/gtest-port.h (working copy) >+@@ -128,6 +128,10 @@ >+ // GTEST_OS_IOS - iOS >+ // GTEST_OS_IOS_SIMULATOR - iOS simulator >+ // GTEST_OS_NACL - Google Native Client (NaCl) >++// GTEST_OS_GNU_KFREEBSD - GNU/kFreeBSD >++// GTEST_OS_DRAGONFLY - DragonFly >++// GTEST_OS_FREEBSD - FreeBSD >++// GTEST_OS_NETBSD - NetBSD >+ // GTEST_OS_OPENBSD - OpenBSD >+ // GTEST_OS_QNX - QNX >+ // GTEST_OS_SOLARIS - Sun Solaris >+@@ -341,6 +345,14 @@ >+ # define GTEST_OS_HPUX 1 >+ #elif defined __native_client__ >+ # define GTEST_OS_NACL 1 >++#elif defined(__GLIBC__) && defined(__FreeBSD_kernel__) >++# define GTEST_OS_GNU_KFREEBSD 1 >++#elif defined __DragonFly__ >++# define GTEST_OS_DRAGONFLY 1 >++#elif defined __FreeBSD__ >++# define GTEST_OS_FREEBSD 1 >++#elif defined __NetBSD__ >++# define GTEST_OS_NETBSD 1 >+ #elif defined __OpenBSD__ >+ # define GTEST_OS_OPENBSD 1 >+ #elif defined __QNX__ >+@@ -611,6 +623,8 @@ struct _RTL_CRITICAL_SECTION; >+ // To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0 >+ // to your compiler flags. >+ # define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \ >++ || GTEST_OS_GNU_KFREEBSD || GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD \ >++ || GTEST_OS_NETBSD || GTEST_OS_OPENBSD \ >+ || GTEST_OS_QNX) >+ #endif // GTEST_HAS_PTHREAD >+ >+@@ -791,7 +805,8 @@ using ::std::tuple_size; >+ (GTEST_OS_MAC && !GTEST_OS_IOS) || GTEST_OS_IOS_SIMULATOR || \ >+ (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \ >+ GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \ >+- GTEST_OS_OPENBSD || GTEST_OS_QNX) >++ GTEST_OS_GNU_KFREEBSD || GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || \ >++ GTEST_OS_NETBSD || GTEST_OS_OPENBSD || GTEST_OS_QNX) >+ # define GTEST_HAS_DEATH_TEST 1 >+ # include <vector> // NOLINT >+ #endif >+@@ -824,7 +839,8 @@ 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 >++#if GTEST_OS_LINUX || GTEST_OS_GNU_KFREEBSD || GTEST_OS_DRAGONFLY || \ >++ GTEST_OS_FREEBSD || GTEST_OS_NETBSD || GTEST_OS_OPENBSD >+ # define GTEST_CAN_STREAM_RESULTS_ 1 >+ #endif >+ >+Index: src/gtest-port.cc >+=================================================================== >+--- src/gtest-port.cc (revision 692) >++++ src/gtest-port.cc (working copy) >+@@ -51,6 +51,14 @@ >+ # include <mach/vm_map.h> >+ #endif // GTEST_OS_MAC >+ >++#if GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD || \ >++ GTEST_OS_NETBSD || GTEST_OS_OPENBSD >++# include <sys/sysctl.h> >++# if GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD >++# include <sys/user.h> >++# endif >++#endif >++ >+ #if GTEST_OS_QNX >+ # include <devctl.h> >+ # include <fcntl.h> >+@@ -104,6 +112,80 @@ size_t GetThreadCount() { >+ } >+ } >+ >++#elif GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD || \ >++ GTEST_OS_NETBSD >++ >++#if GTEST_OS_NETBSD >++#undef KERN_PROC >++#define KERN_PROC KERN_PROC2 >++#define kinfo_proc kinfo_proc2 >++#endif >++ >++#if GTEST_OS_DRAGONFLY >++#define KP_NLWP(kp) (kp.kp_nthreads) >++#elif GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD >++#define KP_NLWP(kp) (kp.ki_numthreads) >++#elif GTEST_OS_NETBSD >++#define KP_NLWP(kp) (kp.p_nlwps) >++#endif >++ >++// Returns the number of threads running in the process, or 0 to indicate that >++// we cannot detect it. >++size_t GetThreadCount() { >++ int mib[] = { >++ CTL_KERN, >++ KERN_PROC, >++ KERN_PROC_PID, >++ getpid(), >++#if GTEST_OS_NETBSD >++ sizeof(struct kinfo_proc), >++ 1, >++#endif >++ }; >++ u_int miblen = sizeof(mib) / sizeof(mib[0]); >++ struct kinfo_proc info; >++ size_t size = sizeof(info); >++ if (sysctl(mib, miblen, &info, &size, NULL, 0)) { >++ return 0; >++ } >++ return KP_NLWP(info); >++} >++#elif GTEST_OS_OPENBSD >++ >++// Returns the number of threads running in the process, or 0 to indicate that >++// we cannot detect it. >++size_t GetThreadCount() { >++ int mib[] = { >++ CTL_KERN, >++ KERN_PROC, >++ KERN_PROC_PID | KERN_PROC_SHOW_THREADS, >++ getpid(), >++ sizeof(struct kinfo_proc), >++ 0, >++ }; >++ u_int miblen = sizeof(mib) / sizeof(mib[0]); >++ >++ // get number of structs >++ size_t size; >++ if (sysctl(mib, miblen, NULL, &size, NULL, 0)) { >++ return 0; >++ } >++ mib[5] = size / mib[4]; >++ >++ // populate array of structs >++ struct kinfo_proc info[mib[5]]; >++ if (sysctl(mib, miblen, &info, &size, NULL, 0)) { >++ return 0; >++ } >++ >++ // exclude empty members >++ int nthreads = 0; >++ for (int i = 0; i < size / mib[4]; i++) { >++ if (info[i].p_tid != -1) >++ nthreads++; >++ } >++ return nthreads; >++} >+ #elif GTEST_OS_QNX >+ >+ // Returns the number of threads running in the process, or 0 to indicate that >+Index: src/gtest.cc >+=================================================================== >+--- src/gtest.cc (revision 692) >++++ src/gtest.cc (working copy) >+@@ -126,7 +126,7 @@ >+ #endif >+ >+ #if GTEST_CAN_STREAM_RESULTS_ >+-# include <arpa/inet.h> // NOLINT >++# include <sys/socket.h> >+ # include <netdb.h> // NOLINT >+ #endif >+ >+Index: test/gtest-port_test.cc >+=================================================================== >+--- test/gtest-port_test.cc (revision 692) >++++ test/gtest-port_test.cc (working copy) >+@@ -304,7 +304,8 @@ TEST(FormatCompilerIndependentFileLocationTest, Fo >+ EXPECT_EQ("unknown file", FormatCompilerIndependentFileLocation(NULL, -1)); >+ } >+ >+-#if GTEST_OS_MAC || GTEST_OS_QNX >++#if GTEST_OS_MAC || GTEST_OS_QNX || GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || \ >++ GTEST_OS_GNU_KFREEBSD || GTEST_OS_NETBSD || GTEST_OS_OPENBSD >+ void* ThreadFunc(void* data) { >+ pthread_mutex_t* mutex = static_cast<pthread_mutex_t*>(data); >+ pthread_mutex_lock(mutex); >+@@ -355,7 +356,7 @@ TEST(GetThreadCountTest, ReturnsCorrectValue) { >+ TEST(GetThreadCountTest, ReturnsZeroWhenUnableToCountThreads) { >+ EXPECT_EQ(0U, GetThreadCount()); >+ } >+-#endif // GTEST_OS_MAC || GTEST_OS_QNX >++#endif // GTEST_OS_MAC || GTEST_OS_QNX || GTEST_OS_*BSD >+ >+ TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) { >+ const bool a_false_condition = false; >+Index: test/gtest_unittest.cc >+=================================================================== >+--- test/gtest_unittest.cc (revision 692) >++++ test/gtest_unittest.cc (working copy) >+@@ -117,6 +117,7 @@ TEST_F(StreamingListenerTest, OnTestIterationEnd) >+ EXPECT_EQ("event=TestIterationEnd&passed=1&elapsed_time=0ms\n", *output()); >+ } >+ >++#if GTEST_LANG_CXX11 // workaround breakage with GCC 4.2 >+ TEST_F(StreamingListenerTest, OnTestCaseStart) { >+ *output() = ""; >+ streamer_.OnTestCaseStart(TestCase("FooTest", "Bar", NULL, NULL)); >+@@ -128,6 +129,7 @@ TEST_F(StreamingListenerTest, OnTestCaseEnd) { >+ streamer_.OnTestCaseEnd(TestCase("FooTest", "Bar", NULL, NULL)); >+ EXPECT_EQ("event=TestCaseEnd&passed=1&elapsed_time=0ms\n", *output()); >+ } >++#endif >+ >+ TEST_F(StreamingListenerTest, OnTestStart) { >+ *output() = ""; > >Property changes on: devel/googletest/files/patch-improve-bsd-support >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: devel/googletest/files/patch-include_gtest_internal_gtest-port.h >=================================================================== >--- devel/googletest/files/patch-include_gtest_internal_gtest-port.h (revision 373372) >+++ devel/googletest/files/patch-include_gtest_internal_gtest-port.h (working copy) >@@ -1,19 +0,0 @@ >---- include/gtest/internal/gtest-port.h.orig 2010-04-16 06:02:02.000000000 +0800 >-+++ include/gtest/internal/gtest-port.h 2013-10-16 23:39:02.000000000 +0800 >-@@ -173,6 +173,7 @@ >- #include <stdlib.h> >- #include <stdio.h> >- #include <string.h> >-+#include <unistd.h> >- #ifndef _WIN32_WCE >- #include <sys/stat.h> >- #endif // !_WIN32_WCE >-@@ -399,7 +400,7 @@ >- // defining __GNUC__ and friends, but cannot compile GCC's tuple >- // implementation. MSVC 2008 (9.0) provides TR1 tuple in a 323 MB >- // Feature Pack download, which we cannot assume the user has. >--#if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \ >-+#if (defined(__GNUC__) && !defined(__CUDACC__) && !defined(_LIBCPP_VERSION) && (GTEST_GCC_VER_ >= 40000)) \ >- || _MSC_VER >= 1600 >- #define GTEST_USE_OWN_TR1_TUPLE 0 >- #else
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 192736
:
145907
|
145908
|
145910
| 149790