1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

devel/googlemock, devel/googletest: Upgrade version 1.5 => 1.7

As part of the upgrade process:
  - copy shebangfix and regression-test from googletest to googlemock
  - convert regression-test to TEST option for better integration with
    poudriere and visibility for users
  - make sure configure detects python2 to follow shebangfix
  - add LICENSE=BSD3CLAUSE (idea from comment 0)
  - strip libs per stage-qa
  - enable pthreads by default in devel/googletest
  - enable death tests in devel/googletest
  - enable socket streaming in devel/googletest
  - implement GetThreadCount for death tests in devel/googletest
  - disable streaming tests that fail with old gcc on 9.x in googletest
  - depend on googletest in googlemock as -lgmock fails otherwise [1]
  - pass maintainership to the persistent submitter [2]

PR:		187562
PR:		192736 [2]
PR:		192042 [1]
Approved by:	maintainer timeout (~8 months)
Submitted by:	rakuco [1]
Submitted by:	Jan Beich <jbeich@vfemail.net> [2]
This commit is contained in:
John Marino 2014-11-25 17:38:09 +00:00
parent 1eeacf5240
commit 5e6acdaa65
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=373421
8 changed files with 275 additions and 36 deletions

View File

@ -2,19 +2,48 @@
# $FreeBSD$
PORTNAME= googlemock
PORTVERSION= 1.5.0
PORTREVISION= 1
PORTVERSION= 1.7.0
CATEGORIES= devel
MASTER_SITES= GOOGLE_CODE
MASTER_SITES= GOOGLE_CODE \
https://googlemock.googlecode.com/svn-history/r407/trunk/scripts/:svn
DISTNAME= gmock-${PORTVERSION}
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} gmock_doctor.py:svn
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
MAINTAINER= clsung@FreeBSD.org
MAINTAINER= jbeich@vfemail.net
COMMENT= Library for writing and using C++ mock classes
BUILD_DEPENDS= googletest>=1.5.0:${PORTSDIR}/devel/googletest
LICENSE= BSD3CLAUSE
USES= libtool
BUILD_DEPENDS= googletest>=1.7.0:${PORTSDIR}/devel/googletest
LIB_DEPENDS= libgtest.so:${PORTSDIR}/devel/googletest
USES= libtool shebangfix zip
GNU_CONFIGURE= yes
USE_LDCONFIG= yes
INSTALL_TARGET= install-strip
CONFIGURE_ENV= ac_cv_path_PYTHON=python2
python_OLD_CMD= /usr/bin/env python
python_CMD= /usr/bin/env python2
SHEBANG_FILES= scripts/fuse_gmock_files.py scripts/gmock_doctor.py
OPTIONS_DEFINE= TEST
TEST_USES= python:2,build
TEST_ALL_TARGET=check
post-extract:
# XXX gmock_doctor.py is missing from distfile before r455 or 1.8.0
${CP} ${DISTDIR}/gmock_doctor.py ${WRKSRC}/scripts
post-patch:
# enable vendor make install again (revert r562)
${REINPLACE_CMD} -E 's/ install-(exec|data)-local//' \
${WRKSRC}/Makefile.in
post-install:
${INSTALL_SCRIPT} ${WRKSRC}/scripts/gmock-config ${STAGEDIR}${PREFIX}/bin
${INSTALL_SCRIPT} ${WRKSRC}/scripts/gmock_doctor.py ${STAGEDIR}${PREFIX}/bin
.include <bsd.port.mk>

View File

@ -1,2 +1,4 @@
SHA256 (gmock-1.5.0.tar.gz) = 21fe9db0de2ae36af1c3bf97dab2b24c38f2392d7b4e376f1c22e71b48c95a39
SIZE (gmock-1.5.0.tar.gz) = 1759469
SHA256 (gmock-1.7.0.zip) = 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b
SIZE (gmock-1.7.0.zip) = 2167746
SHA256 (gmock_doctor.py) = 92a8eaf7f4c0716ecd9622b97d907e68d5eb63d6c89acbc1fc72d573d00fc47d
SIZE (gmock_doctor.py) = 23590

View File

@ -8,7 +8,7 @@ include/gmock/gmock-generated-matchers.h
include/gmock/gmock-generated-nice-strict.h
include/gmock/gmock-matchers.h
include/gmock/gmock-more-actions.h
include/gmock/gmock-printers.h
include/gmock/gmock-more-matchers.h
include/gmock/gmock-spec-builders.h
include/gmock/gmock.h
include/gmock/internal/gmock-generated-internal-utils.h

View File

@ -2,27 +2,38 @@
# $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= jbeich@vfemail.net
COMMENT= Framework for writing C++ tests on a variety of platforms
LICENSE= BSD3CLAUSE
USES= libtool python:2,build shebangfix
USES= libtool shebangfix zip
GNU_CONFIGURE= yes
USE_LDCONFIG= yes
INSTALL_TARGET= install-strip
CONFIGURE_ENV= ac_cv_path_PYTHON=python2
python_OLD_CMD= /usr/bin/env python
python_CMD= /usr/bin/env python2
SHEBANG_FILES= scripts/fuse_gtest_files.py scripts/gen_gtest_pred_impl.py \
scripts/pump.py
regression-test:
cd ${WRKSRC}; ${MAKE} check
OPTIONS_DEFINE= TEST
TEST_USES= python:2,build
TEST_ALL_TARGET=check
post-patch:
# enable vendor make install again (revert r562)
${REINPLACE_CMD} -E 's/ install-(exec|data)-local//' \
${WRKSRC}/Makefile.in
post-install:
${INSTALL_SCRIPT} ${WRKSRC}/scripts/gtest-config ${STAGEDIR}${PREFIX}/bin
.include <bsd.port.mk>

View File

@ -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

View File

@ -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() = "";

View File

@ -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

View File

@ -2,6 +2,7 @@ bin/gtest-config
include/gtest/gtest-death-test.h
include/gtest/gtest-message.h
include/gtest/gtest-param-test.h
include/gtest/gtest-printers.h
include/gtest/gtest-spi.h
include/gtest/gtest-test-part.h
include/gtest/gtest-typed-test.h