diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index 6153ff94171a..15cec8575e37 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -231,6 +231,18 @@ virstor .. .. + gmock + internal + custom + .. + .. + .. + gtest + internal + custom + .. + .. + .. gnu posix .. diff --git a/lib/Makefile b/lib/Makefile index 9e3548774c9f..d95150306142 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -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 diff --git a/lib/googletest/Makefile b/lib/googletest/Makefile new file mode 100644 index 000000000000..fbf9bc85c961 --- /dev/null +++ b/lib/googletest/Makefile @@ -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 diff --git a/lib/googletest/Makefile.inc b/lib/googletest/Makefile.inc new file mode 100644 index 000000000000..f4179f967e96 --- /dev/null +++ b/lib/googletest/Makefile.inc @@ -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 diff --git a/lib/googletest/gmock/Makefile b/lib/googletest/gmock/Makefile new file mode 100644 index 000000000000..65dffa5f95cc --- /dev/null +++ b/lib/googletest/gmock/Makefile @@ -0,0 +1,43 @@ +# $FreeBSD$ + +.include + +.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 diff --git a/lib/googletest/gmock/tests/Makefile b/lib/googletest/gmock/tests/Makefile new file mode 100644 index 000000000000..de70266031ed --- /dev/null +++ b/lib/googletest/gmock/tests/Makefile @@ -0,0 +1,7 @@ +# $FreeBSD$ + +PLAIN_TESTS_CXX+= gmock_stress_test + +LIBADD+= gmock + +.include diff --git a/lib/googletest/gmock_main/Makefile b/lib/googletest/gmock_main/Makefile new file mode 100644 index 000000000000..ca6e85358f11 --- /dev/null +++ b/lib/googletest/gmock_main/Makefile @@ -0,0 +1,20 @@ +# $FreeBSD$ + +.include + +.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 diff --git a/lib/googletest/gmock_main/Makefile.inc b/lib/googletest/gmock_main/Makefile.inc new file mode 100644 index 000000000000..fa0e8d2b6bda --- /dev/null +++ b/lib/googletest/gmock_main/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +include ../Makefile.inc diff --git a/lib/googletest/gmock_main/tests/Makefile b/lib/googletest/gmock_main/tests/Makefile new file mode 100644 index 000000000000..63a847376a09 --- /dev/null +++ b/lib/googletest/gmock_main/tests/Makefile @@ -0,0 +1,34 @@ +# $FreeBSD$ + +.include + +.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 diff --git a/lib/googletest/gtest/Makefile b/lib/googletest/gtest/Makefile new file mode 100644 index 000000000000..25f600df40a3 --- /dev/null +++ b/lib/googletest/gtest/Makefile @@ -0,0 +1,52 @@ +# $FreeBSD$ + +.include + +.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 diff --git a/lib/googletest/gtest/Makefile.inc b/lib/googletest/gtest/Makefile.inc new file mode 100644 index 000000000000..fa0e8d2b6bda --- /dev/null +++ b/lib/googletest/gtest/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +include ../Makefile.inc diff --git a/lib/googletest/gtest/tests/Makefile b/lib/googletest/gtest/tests/Makefile new file mode 100644 index 000000000000..3c176b3ea42a --- /dev/null +++ b/lib/googletest/gtest/tests/Makefile @@ -0,0 +1,31 @@ +# $FreeBSD$ + +.include + +.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 diff --git a/lib/googletest/gtest_main/Makefile b/lib/googletest/gtest_main/Makefile new file mode 100644 index 000000000000..ade522a1ac53 --- /dev/null +++ b/lib/googletest/gtest_main/Makefile @@ -0,0 +1,18 @@ +# $FreeBSD$ + +.include + +.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 diff --git a/lib/googletest/gtest_main/Makefile.inc b/lib/googletest/gtest_main/Makefile.inc new file mode 100644 index 000000000000..fa0e8d2b6bda --- /dev/null +++ b/lib/googletest/gtest_main/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +include ../Makefile.inc diff --git a/lib/googletest/gtest_main/tests/Makefile b/lib/googletest/gtest_main/tests/Makefile new file mode 100644 index 000000000000..6d36f6137120 --- /dev/null +++ b/lib/googletest/gtest_main/tests/Makefile @@ -0,0 +1,34 @@ +# $FreeBSD$ + +.include + +.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 diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 886922b94e0b..294398b5679b 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -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