Merge build glue for libraries and tests done on github

I need to doublecheck my work vs the port, but I believe that this covers the
initial integration of all upstream tests.

Ref: https://github.com/ngie-eign/freebsd/tree/googletest-integration
This commit is contained in:
ngie 2019-02-13 04:58:15 +00:00
parent fe8ba72e74
commit 8cb6ba9426
16 changed files with 312 additions and 0 deletions

View File

@ -231,6 +231,18 @@
virstor
..
..
gmock
internal
custom
..
..
..
gtest
internal
custom
..
..
..
gnu
posix
..

View File

@ -200,6 +200,7 @@ SUBDIR.${MK_RADIUS_SUPPORT}+= libradius
SUBDIR.${MK_SENDMAIL}+= libmilter libsm libsmdb libsmutil
SUBDIR.${MK_TELNET}+= libtelnet
SUBDIR.${MK_TESTS_SUPPORT}+= atf
SUBDIR.${MK_TESTS_SUPPORT}+= googletest
SUBDIR.${MK_TESTS}+= tests
SUBDIR.${MK_UNBOUND}+= libunbound
SUBDIR.${MK_USB}+= libusbhid libusb

10
lib/googletest/Makefile Normal file
View File

@ -0,0 +1,10 @@
# $FreeBSD$
SUBDIR+= gtest
SUBDIR+= .WAIT
SUBDIR+= gmock
SUBDIR.${MK_TESTS}+= .WAIT
SUBDIR.${MK_TESTS}+= gmock_main
SUBDIR.${MK_TESTS}+= gtest_main
.include <bsd.subdir.mk>

View File

@ -0,0 +1,11 @@
# $FreeBSD$
CXXFLAGS+= -DGTEST_HAS_PTHREAD=1
GTEST_DIR= ${SRCTOP}/contrib/googletest
GOOGLEMOCK_SRCROOT= ${GTEST_DIR}/googlemock
GOOGLETEST_SRCROOT= ${GTEST_DIR}/googletest
NO_WTHREAD_SAFETY=
WARNS?= 6

View File

@ -0,0 +1,43 @@
# $FreeBSD$
.include <bsd.init.mk>
.PATH: ${GOOGLEMOCK_SRCROOT}/include ${GOOGLEMOCK_SRCROOT}/src
LIB_CXX= gmock
SHLIB_MAJOR= 0
PRIVATELIB= true
CXXFLAGS+= -I${GOOGLEMOCK_SRCROOT}/include
CXXFLAGS+= -I${GOOGLEMOCK_SRCROOT}
CXXFLAGS+= -I${GOOGLETEST_SRCROOT}/include
LIBADD+= gtest
LDFLAGS+= -L${.OBJDIR:H}/gtest
MAIN_INCSDIR= ${INCLUDEDIR}/gmock
MAIN_INCS+= gmock/gmock-matchers.h
MAIN_INCS+= gmock/gmock-more-actions.h
MAIN_INCS+= gmock/gmock-generated-actions.h
MAIN_INCS+= gmock/gmock-generated-matchers.h
MAIN_INCS+= gmock/gmock-generated-nice-strict.h
MAIN_INCS+= gmock/gmock-more-matchers.h
MAIN_INCS+= gmock/gmock-generated-function-mockers.h
MAIN_INCS+= gmock/gmock-cardinalities.h
MAIN_INCS+= gmock/gmock-spec-builders.h
MAIN_INCS+= gmock/gmock.h
MAIN_INCS+= gmock/gmock-actions.h
INTERNAL_INCSDIR= ${INCLUDEDIR}/gmock/internal
INTERNAL_INCS+= gmock/internal/gmock-port.h
INTERNAL_INCS+= gmock/internal/gmock-internal-utils.h
INTERNAL_INCS+= gmock/internal/gmock-generated-internal-utils.h
INTERNAL_CUSTOM_INCSDIR= ${INCLUDEDIR}/gmock/internal/custom
INTERNAL_CUSTOM_INCS+= gmock/internal/custom/gmock-port.h
INTERNAL_CUSTOM_INCS+= gmock/internal/custom/gmock-matchers.h
INTERNAL_CUSTOM_INCS+= gmock/internal/custom/gmock-generated-actions.h
SRCS+= gmock-all.cc
.include <bsd.lib.mk>

View File

@ -0,0 +1,7 @@
# $FreeBSD$
PLAIN_TESTS_CXX+= gmock_stress_test
LIBADD+= gmock
.include <bsd.test.mk>

View File

@ -0,0 +1,20 @@
# $FreeBSD$
.include <bsd.init.mk>
.PATH: ${GOOGLEMOCK_SRCROOT}/include ${GOOGLEMOCK_SRCROOT}/src
LIB_CXX= gmock_main
SHLIB_MAJOR= 0
PRIVATELIB= true
CXXFLAGS+= -I${GOOGLEMOCK_SRCROOT}/include
CXXFLAGS+= -I${GOOGLEMOCK_SRCROOT}
CXXFLAGS+= -I${GOOGLETEST_SRCROOT}/include
LIBADD= gmock
SRCS+= gmock_main.cc
SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>

View File

@ -0,0 +1,3 @@
# $FreeBSD$
include ../Makefile.inc

View File

@ -0,0 +1,34 @@
# $FreeBSD$
.include <bsd.init.mk>
.PATH: ${GOOGLEMOCK_SRCROOT}/src ${GOOGLEMOCK_SRCROOT}/test
PLAIN_TESTS_CXX+= gmock-actions_test
PLAIN_TESTS_CXX+= gmock-cardinalities_test
PLAIN_TESTS_CXX+= gmock-ex_test
PLAIN_TESTS_CXX+= gmock-generated-actions_test
PLAIN_TESTS_CXX+= gmock-generated-function-mockers_test
PLAIN_TESTS_CXX+= gmock-generated-internal-utils_test
PLAIN_TESTS_CXX+= gmock-generated-matchers_test
PLAIN_TESTS_CXX+= gmock-internal-utils_test
PLAIN_TESTS_CXX+= gmock-matchers_test
PLAIN_TESTS_CXX+= gmock-more-actions_test
PLAIN_TESTS_CXX+= gmock-nice-strict_test
PLAIN_TESTS_CXX+= gmock-port_test
PLAIN_TESTS_CXX+= gmock-spec-builders_test
PLAIN_TESTS_CXX+= gmock_link_test
PLAIN_TESTS_CXX+= gmock_test
CXXFLAGS+= -I${GOOGLEMOCK_SRCROOT}/include
CXXFLAGS+= -I${GOOGLEMOCK_SRCROOT}
.for test in ${PLAIN_TESTS_CXX}
SRCS.${test}= gmock_main.cc
.endfor
SRCS.gmock_link_test+= gmock_link2_test.cc
LIBADD= gmock
.include <bsd.test.mk>

View File

@ -0,0 +1,52 @@
# $FreeBSD$
.include <bsd.init.mk>
.PATH: ${GOOGLETEST_SRCROOT}/include ${GOOGLETEST_SRCROOT}/src
LIB_CXX= gtest
SHLIB_MAJOR= 0
PRIVATELIB= true
CXXFLAGS+= -I${GOOGLETEST_SRCROOT}/include
CXXFLAGS+= -I${GOOGLETEST_SRCROOT}
INCSGROUPS= MAIN_INCS INTERNAL_INCS INTERNAL_CUSTOM_INCS
MAIN_INCSDIR= ${INCLUDEDIR}/gtest
MAIN_INCS+= gtest/gtest-death-test.h
MAIN_INCS+= gtest/gtest-message.h
MAIN_INCS+= gtest/gtest-param-test.h
MAIN_INCS+= gtest/gtest-printers.h
MAIN_INCS+= gtest/gtest-spi.h
MAIN_INCS+= gtest/gtest-test-part.h
MAIN_INCS+= gtest/gtest-typed-test.h
MAIN_INCS+= gtest/gtest.h
MAIN_INCS+= gtest/gtest_pred_impl.h
MAIN_INCS+= gtest/gtest_prod.h
INTERNAL_INCSDIR= ${INCLUDEDIR}/gtest/internal
INTERNAL_INCS+= gtest/internal/gtest-death-test-internal.h
INTERNAL_INCS+= gtest/internal/gtest-filepath.h
INTERNAL_INCS+= gtest/internal/gtest-internal.h
INTERNAL_INCS+= gtest/internal/gtest-linked_ptr.h
INTERNAL_INCS+= gtest/internal/gtest-param-util-generated.h
INTERNAL_INCS+= gtest/internal/gtest-param-util.h
INTERNAL_INCS+= gtest/internal/gtest-port-arch.h
INTERNAL_INCS+= gtest/internal/gtest-port.h
INTERNAL_INCS+= gtest/internal/gtest-string.h
INTERNAL_INCS+= gtest/internal/gtest-tuple.h
INTERNAL_INCS+= gtest/internal/gtest-type-util.h
INTERNAL_CUSTOM_INCSDIR= ${INCLUDEDIR}/gtest/internal/custom
INTERNAL_CUSTOM_INCS+= gtest/internal/custom/gtest-port.h
INTERNAL_CUSTOM_INCS+= gtest/internal/custom/gtest-printers.h
INTERNAL_CUSTOM_INCS+= gtest/internal/custom/gtest.h
SRCS+= gtest-all.cc
LIBADD+= pthread
SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>

View File

@ -0,0 +1,3 @@
# $FreeBSD$
include ../Makefile.inc

View File

@ -0,0 +1,31 @@
# $FreeBSD$
.include <bsd.init.mk>
.PATH: ${GOOGLETEST_SRCROOT}/src ${GOOGLETEST_SRCROOT}/test
PLAIN_TESTS_CXX+= gtest_environment_test
PLAIN_TESTS_CXX+= gtest_no_test_unittest
PLAIN_TESTS_CXX+= googletest-param-test-test
PLAIN_TESTS_CXX+= gtest_premature_exit_test
PLAIN_TESTS_CXX+= gtest_repeat_test
PLAIN_TESTS_CXX+= gtest_stress_test
PLAIN_TESTS_CXX+= gtest_throw_on_failure_ex_test
PLAIN_TESTS_CXX+= gtest-unittest-api_test
SRCS.googletest-param-test-test+= googletest-param-test-test.cc
SRCS.googletest-param-test-test+= googletest-param-test2-test.cc
SRCS.gtest_premature_exit_test+= gtest_premature_exit_test.cc
.for test in ${PLAIN_TESTS_CXX}
# XXX: linker error; no main(..)
#SRCS.${test}= gtest-all.cc
SRCS.${test}?= gtest_main.cc
.endfor
CXXFLAGS+= -I${GOOGLETEST_SRCROOT}/include
CXXFLAGS+= -I${GOOGLETEST_SRCROOT}
LIBADD= gtest
.include <bsd.test.mk>

View File

@ -0,0 +1,18 @@
# $FreeBSD$
.include <bsd.init.mk>
.PATH: ${GOOGLETEST_SRCROOT}/include ${GOOGLETEST_SRCROOT}/src
LIB_CXX= gtest_main
SHLIB_MAJOR= 0
PRIVATELIB= true
CXXFLAGS+= -I${GOOGLETEST_SRCROOT}/include
CXXFLAGS+= -I${GOOGLETEST_SRCROOT}
SRCS+= gtest_main.cc
SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>

View File

@ -0,0 +1,3 @@
# $FreeBSD$
include ../Makefile.inc

View File

@ -0,0 +1,34 @@
# $FreeBSD$
.include <bsd.init.mk>
.PATH: ${GOOGLETEST_SRCROOT}/src ${GOOGLETEST_SRCROOT}/test
PLAIN_TESTS_CXX+= googletest-death-test-test
PLAIN_TESTS_CXX+= googletest-filepath-test
PLAIN_TESTS_CXX+= googletest-linked-ptr-test
PLAIN_TESTS_CXX+= googletest-listener-test
PLAIN_TESTS_CXX+= gtest_main_unittest
PLAIN_TESTS_CXX+= googletest-message-test
PLAIN_TESTS_CXX+= googletest-options-test
PLAIN_TESTS_CXX+= googletest-port-test
PLAIN_TESTS_CXX+= gtest_pred_impl_unittest
PLAIN_TESTS_CXX+= googletest-printers-test
PLAIN_TESTS_CXX+= gtest_prod_test
PLAIN_TESTS_CXX+= gtest_sole_header_test
PLAIN_TESTS_CXX+= googletest-test-part-test
PLAIN_TESTS_CXX+= gtest-typed-test_test
PLAIN_TESTS_CXX+= gtest_unittest
.for test in ${PLAIN_TESTS_CXX}
SRCS.${test}= gtest_main.cc
.endfor
CXXFLAGS+= -I${GOOGLETEST_SRCROOT}/include
CXXFLAGS+= -I${GOOGLETEST_SRCROOT}
SRCS.gtest-typed-test_test+= gtest-typed-test2_test.cc
LIBADD= gtest
.include <bsd.test.mk>

View File

@ -18,6 +18,10 @@ _PRIVATELIBS= \
bsdstat \
devdctl \
event \
gmock \
gtest \
gmock_main \
gtest_main \
heimipcc \
heimipcs \
ifconfig \
@ -287,6 +291,10 @@ _DP_dpv= dialog figpar util ncursesw
_DP_dialog= ncursesw m
_DP_cuse= pthread
_DP_atf_cxx= atf_c
_DP_gtest= pthread
_DP_gmock= gtest
_DP_gmock_main= gmock
_DP_gtest_main= gtest
_DP_devstat= kvm
_DP_pam= radius tacplus opie md util
.if ${MK_KERBEROS} != "no"
@ -364,6 +372,15 @@ LIBATF_CXX= ${LIBDESTDIR}${LIBDIR_BASE}/libprivateatf-c++.a
LDADD_atf_c= -lprivateatf-c
LDADD_atf_cxx= -lprivateatf-c++
LIBGMOCK= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategmock.a
LIBGTEST= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategtest.a
LIBGMOCKMAIN= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategmockmain.a
LIBGTESTMAIN= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategtestmain.a
LDADD_gmock= -lprivategmock
LDADD_gtest= -lprivategtest
LDADD_gmock_main= -lprivategmock_main
LDADD_gtest_main= -lprivategtest_main
.for _l in ${_PRIVATELIBS}
LIB${_l:tu}?= ${LIBDESTDIR}${LIBDIR_BASE}/libprivate${_l}.a
.endfor
@ -400,6 +417,15 @@ LDADD_${_l}+= ${LDADD_${_d}}
DPADD_atf_cxx+= ${DPADD_atf_c}
LDADD_atf_cxx+= ${LDADD_atf_c}
DPADD_gmock+= ${DPADD_gtest}
LDADD_gmock+= ${LDADD_gtest}
DPADD_gmock_main+= ${DPADD_gmock}
LDADD_gmock_main+= ${LDADD_gmock}
DPADD_gtest_main+= ${DPADD_gtest}
LDADD_gtest_main+= ${LDADD_gtest}
# Detect LDADD/DPADD that should be LIBADD, before modifying LDADD here.
_BADLDADD=
.for _l in ${LDADD:M-l*:N-l*/*:C,^-l,,}
@ -538,6 +564,10 @@ LIBROKENDIR= ${OBJTOP}/kerberos5/lib/libroken
LIBWINDDIR= ${OBJTOP}/kerberos5/lib/libwind
LIBATF_CDIR= ${OBJTOP}/lib/atf/libatf-c
LIBATF_CXXDIR= ${OBJTOP}/lib/atf/libatf-c++
LIBGMOCKDIR= ${OBJTOP}/lib/googletest/gmock
LIBGMOCK_MAINDIR= ${OBJTOP}/lib/googletest/gmock_main
LIBGTESTDIR= ${OBJTOP}/lib/googletest/gtest
LIBGTEST_MAINDIR= ${OBJTOP}/lib/googletest/gtest_main
LIBALIASDIR= ${OBJTOP}/lib/libalias/libalias
LIBBLACKLISTDIR= ${OBJTOP}/lib/libblacklist
LIBBLOCKSRUNTIMEDIR= ${OBJTOP}/lib/libblocksruntime