Index: etc/mtree/BSD.tests.dist =================================================================== --- etc/mtree/BSD.tests.dist +++ etc/mtree/BSD.tests.dist @@ -278,6 +278,16 @@ static .. .. + googletest + gmock + .. + gmock_main + .. + gtest + .. + gtest_main + .. + .. libarchive .. libc @@ -430,6 +440,8 @@ tests atf .. + googletest + .. plain .. tap Index: etc/mtree/BSD.usr.dist =================================================================== --- etc/mtree/BSD.usr.dist +++ etc/mtree/BSD.usr.dist @@ -13,6 +13,18 @@ .. event .. + gmock + internal + custom + .. + .. + .. + gtest + internal + custom + .. + .. + .. sqlite3 .. ucl Index: lib/Makefile =================================================================== --- lib/Makefile +++ lib/Makefile @@ -170,6 +170,7 @@ .endif SUBDIR.${MK_EFI}+= libefivar +SUBDIR.${MK_GOOGLETEST}+= googletest SUBDIR.${MK_LIBTHR}+= libthr SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_eh SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_s Index: share/examples/tests/tests/Makefile =================================================================== --- share/examples/tests/tests/Makefile +++ share/examples/tests/tests/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + # Directory into which the Kyuafile provided by this directory will be # installed. # @@ -21,6 +23,10 @@ TESTS_SUBDIRS+= plain TESTS_SUBDIRS+= tap +.if ${MK_GOOGLETEST} != no +TESTS_SUBDIRS+= googletest +.endif + # We leave KYUAFILE unset so that bsd.test.mk auto-generates a Kyuafile # for us based on the contents of the TESTS_SUBDIRS line above. The # generated file will tell the tests run-time engine to recurse into the Index: share/examples/tests/tests/googletest/Makefile =================================================================== --- share/examples/tests/tests/googletest/Makefile +++ share/examples/tests/tests/googletest/Makefile @@ -1,4 +1,24 @@ # $FreeBSD$ +# +# This Makefile differs from the other examples, in the sense that its purpose +# is to install the upstream provided googletest sample unit tests. + +# The release package to use for the tests contained within the directory +# +# This applies to components which rely on ^/projects/release-pkg support +# (see UPDATING XXXXXXXXX / svn revision r298107). +PACKAGE= tests + +# Directory into which the Kyuafile provided by this directory will be +# installed. +# +# This is always a subdirectory of ${TESTSBASE}/. The remainder of the +# path has to match the relative path within the source tree in which +# these files are found modulo the tests/ component at the end. +# +# For example: if this Makefile were in src/bin/cp/tests/, its TESTSDIR +# would point at ${TESTSBASE}/bin/cp/. +TESTSDIR= ${TESTSBASE}/share/examples/tests/googletest .PATH: ${SRCTOP}/contrib/googletest/googletest/samples @@ -16,18 +36,21 @@ #GTEST_REQ_TESTS+= sample9_unittest GTEST_REQ_TESTS+= sample10_unittest -.for t in ${GTEST_MAIN_REQ_TESTS} -GTESTS+= $t +# List of test programs to build. Note that we can build more than one +# test from a single directory, and this is expected. +GTESTS+= ${GTEST_MAIN_REQ_TESTS} ${GTEST_REQ_TESTS} + +# +.for t in ${GTESTS} +.if ${GTEST_MAIN_REQ_TESTS:M$t} LIBADD.$t+= gtest_main -SRCS.$t+= $t.cc -.endfor - -.for t in ${GTEST_REQ_TESTS} -GTESTS+= $t +.else LIBADD.$t+= gtest +.endif SRCS.$t+= $t.cc .endfor +# Additional sources for sample testcase 1, 2, 4, and 5. SRCS.sample1_unittest+= sample1.cc SRCS.sample2_unittest+= sample2.cc SRCS.sample4_unittest+= sample4.cc Index: share/mk/Makefile =================================================================== --- share/mk/Makefile +++ share/mk/Makefile @@ -73,6 +73,8 @@ .if ${MK_TESTS} != "no" FILES+= atf.test.mk +FILES+= googletest.test.inc.mk +FILES+= googletest.test.mk FILES+= plain.test.mk FILES+= suite.test.mk FILES+= tap.test.mk Index: share/mk/bsd.README =================================================================== --- share/mk/bsd.README +++ share/mk/bsd.README @@ -649,6 +649,8 @@ ATF_TESTS_SH The names of the ATF sh test programs to build. +GTESTS The names of the GoogleTest test programs to build. + KYUAFILE If 'auto' (the default), generate a Kyuafile out of the test programs defined in the Makefile. If 'yes', then a manually-crafted Kyuafile must be supplied with the Index: share/mk/bsd.test.mk =================================================================== --- share/mk/bsd.test.mk +++ share/mk/bsd.test.mk @@ -63,6 +63,7 @@ # Pull in the definitions of all supported test interfaces. .include +.include .include .include Index: share/mk/googletest.test.inc.mk =================================================================== --- /dev/null +++ share/mk/googletest.test.inc.mk @@ -1,10 +1,13 @@ -# $FreeBSD: projects/import-googletest-1.8.1/share/mk/googletest.test.inc.mk 344457 2019-02-22 04:52:12Z ngie $ +# $FreeBSD: head/share/mk/googletest.test.inc.mk 344457 2019-02-22 04:52:12Z ngie $ + +# XXX: this should be defined in bsd.sys.mk +CXXSTD?= c++11 GTESTS_CXXFLAGS+= -DGTEST_HAS_POSIX_RE=1 GTESTS_CXXFLAGS+= -DGTEST_HAS_PTHREAD=1 GTESTS_CXXFLAGS+= -DGTEST_HAS_STREAM_REDIRECTION=1 GTESTS_CXXFLAGS+= -frtti -GTESTS_CXXFLAGS+= -std=c++11 +GTESTS_CXXFLAGS+= -std=${CXXSTD} # XXX: src.libnames.mk should handle adding this directory. GTESTS_CXXFLAGS+= -I${DESTDIR}${INCLUDEDIR}/private Index: share/mk/googletest.test.mk =================================================================== --- /dev/null +++ share/mk/googletest.test.mk @@ -1,4 +1,4 @@ -# $FreeBSD: projects/import-googletest-1.8.1/share/mk/googletest.test.mk 344415 2019-02-21 03:36:09Z ngie $ +# $FreeBSD: head/share/mk/googletest.test.mk 344415 2019-02-21 03:36:09Z ngie $ # # You must include bsd.test.mk instead of this file from your Makefile. # Index: share/mk/src.libnames.mk =================================================================== --- share/mk/src.libnames.mk +++ share/mk/src.libnames.mk @@ -18,6 +18,10 @@ bsdstat \ devdctl \ event \ + gmock \ + gtest \ + gmock_main \ + gtest_main \ heimipcc \ heimipcs \ ldns \ @@ -302,6 +306,10 @@ _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" @@ -379,6 +387,15 @@ LDADD_atf_c= -lprivateatf-c LDADD_atf_cxx= -lprivateatf-c++ +LIBGMOCK= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategmock.a +LIBGMOCK_MAIN= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategmock_main.a +LIBGTEST= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategtest.a +LIBGTEST_MAIN= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategtest_main.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 @@ -421,6 +438,15 @@ 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,,} @@ -562,6 +588,10 @@ 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 Index: share/mk/src.opts.mk =================================================================== --- share/mk/src.opts.mk +++ share/mk/src.opts.mk @@ -108,6 +108,7 @@ GDB \ GNU_DIFF \ GNU_GREP \ + GOOGLETEST \ GPIO \ HAST \ HTML \ @@ -427,6 +428,7 @@ # Order is somewhat important. # .if !${COMPILER_FEATURES:Mc++11} +MK_GOOGLETEST:= no MK_LLVM_LIBUNWIND:= no .endif @@ -507,6 +509,10 @@ MK_DTRACE_TESTS:= no .endif +.if ${MK_TESTS_SUPPORT} == "no" +MK_GOOGLETEST:= no +.endif + .if ${MK_ZONEINFO} == "no" MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no MK_ZONEINFO_OLD_TIMEZONES_SUPPORT:= no Index: tools/build/mk/OptionalObsoleteFiles.inc =================================================================== --- tools/build/mk/OptionalObsoleteFiles.inc +++ tools/build/mk/OptionalObsoleteFiles.inc @@ -2776,6 +2776,135 @@ OLD_FILES+=usr/libexec/kgdb .endif +.if ${MK_GOOGLETEST} == no +OLD_FILES+=usr/include/gmock/gmock-actions.h +OLD_FILES+=usr/include/gmock/gmock-cardinalities.h +OLD_FILES+=usr/include/gmock/gmock-generated-actions.h +OLD_FILES+=usr/include/gmock/gmock-generated-function-mockers.h +OLD_FILES+=usr/include/gmock/gmock-generated-matchers.h +OLD_FILES+=usr/include/gmock/gmock-generated-nice-strict.h +OLD_FILES+=usr/include/gmock/gmock-matchers.h +OLD_FILES+=usr/include/gmock/gmock-more-actions.h +OLD_FILES+=usr/include/gmock/gmock-more-matchers.h +OLD_FILES+=usr/include/gmock/gmock-spec-builders.h +OLD_FILES+=usr/include/gmock/gmock.h +OLD_FILES+=usr/include/gmock/internal/custom/gmock-generated-actions.h +OLD_FILES+=usr/include/gmock/internal/custom/gmock-matchers.h +OLD_FILES+=usr/include/gmock/internal/custom/gmock-port.h +OLD_FILES+=usr/include/gmock/internal/gmock-generated-internal-utils.h +OLD_FILES+=usr/include/gmock/internal/gmock-internal-utils.h +OLD_FILES+=usr/include/gmock/internal/gmock-port.h +OLD_DIRS+=usr/include/gmock +OLD_FILES+=usr/include/gtest/gtest_pred_impl.h +OLD_FILES+=usr/include/gtest/gtest_prod.h +OLD_FILES+=usr/include/gtest/gtest-death-test.h +OLD_FILES+=usr/include/gtest/gtest-message.h +OLD_FILES+=usr/include/gtest/gtest-param-test.h +OLD_FILES+=usr/include/gtest/gtest-printers.h +OLD_FILES+=usr/include/gtest/gtest-spi.h +OLD_FILES+=usr/include/gtest/gtest-test-part.h +OLD_FILES+=usr/include/gtest/gtest-typed-test.h +OLD_FILES+=usr/include/gtest/gtest.h +OLD_FILES+=usr/include/gtest/internal/custom/gtest-port.h +OLD_FILES+=usr/include/gtest/internal/custom/gtest-printers.h +OLD_FILES+=usr/include/gtest/internal/custom/gtest.h +OLD_FILES+=usr/include/gtest/internal/gtest-death-test-internal.h +OLD_FILES+=usr/include/gtest/internal/gtest-filepath.h +OLD_FILES+=usr/include/gtest/internal/gtest-internal.h +OLD_FILES+=usr/include/gtest/internal/gtest-linked_ptr.h +OLD_FILES+=usr/include/gtest/internal/gtest-param-util-generated.h +OLD_FILES+=usr/include/gtest/internal/gtest-param-util.h +OLD_FILES+=usr/include/gtest/internal/gtest-port-arch.h +OLD_FILES+=usr/include/gtest/internal/gtest-port.h +OLD_FILES+=usr/include/gtest/internal/gtest-string.h +OLD_FILES+=usr/include/gtest/internal/gtest-tuple.h +OLD_FILES+=usr/include/gtest/internal/gtest-type-util.h +OLD_DIRS+=usr/include/gtest +OLD_FILES+=usr/lib/libprivategmock_main.a +OLD_FILES+=usr/lib/libprivategmock_main.so +OLD_LIBS+=usr/lib/libprivategmock_main.so.0 +OLD_FILES+=usr/lib/libprivategmock_main_p.a +OLD_FILES+=usr/lib/libprivategmock.a +OLD_FILES+=usr/lib/libprivategmock.so +OLD_LIBS+=usr/lib/libprivategmock.so.0 +OLD_FILES+=usr/lib/libprivategmock_p.a +OLD_FILES+=usr/lib/libprivategtest_main.a +OLD_FILES+=usr/lib/libprivategtest_main.so +OLD_LIBS+=usr/lib/libprivategtest_main.so.0 +OLD_FILES+=usr/lib/libprivategtest_main_p.a +OLD_FILES+=usr/lib/libprivategtest.a +OLD_FILES+=usr/lib/libprivategtest.so +OLD_LIBS+=usr/lib/libprivategtest.so.0 +OLD_FILES+=usr/lib/libprivategtest_p.a +OLD_FILES+=usr/tests/lib/googletest/gmock/gmock_stress_test +OLD_FILES+=usr/tests/lib/googletest/gmock/Kyuafile +OLD_DIRS+=usr/tests/lib/googletest/gmock +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock_ex_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock_link_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-actions_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-cardinalities_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-ex_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-actions_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-function-mockers_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-internal-utils_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-generated-matchers_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-internal-utils_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-matchers_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-more-actions_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-nice-strict_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-port_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/gmock-spec-builders_test +OLD_FILES+=usr/tests/lib/googletest/gmock_main/Kyuafile +OLD_DIRS+=usr/tests/lib/googletest/gmock_main +OLD_FILES+=usr/tests/lib/googletest/gtest/googletest-param-test-test +OLD_FILES+=usr/tests/lib/googletest/gtest/gtest_all_test +OLD_FILES+=usr/tests/lib/googletest/gtest/gtest_environment_test +OLD_FILES+=usr/tests/lib/googletest/gtest/gtest_no_test_unittest +OLD_FILES+=usr/tests/lib/googletest/gtest/gtest_premature_exit_test +OLD_FILES+=usr/tests/lib/googletest/gtest/gtest_repeat_test +OLD_FILES+=usr/tests/lib/googletest/gtest/gtest_stress_test +OLD_FILES+=usr/tests/lib/googletest/gtest/gtest_throw_on_failure_ex_test +OLD_FILES+=usr/tests/lib/googletest/gtest/gtest-death-test_ex_catch_test +OLD_FILES+=usr/tests/lib/googletest/gtest/gtest-death-test_ex_nocatch_test +OLD_FILES+=usr/tests/lib/googletest/gtest/gtest-unittest-api_test +OLD_FILES+=usr/tests/lib/googletest/gtest/Kyuafile +OLD_DIRS+=usr/tests/lib/googletest/gtest +OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-death-test-test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-filepath-test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-linked-ptr-test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-listener-test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-message-test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-options-test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-port-test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-printers-test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/googletest-test-part-test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_help_test_ +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_main_unittest +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_pred_impl_unittest +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_prod_test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_sole_header_test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_unittest +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_xml_outfile1_test_ +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest_xml_outfile2_test_ +OLD_FILES+=usr/tests/lib/googletest/gtest_main/gtest-typed-test_test +OLD_FILES+=usr/tests/lib/googletest/gtest_main/Kyuafile +OLD_DIRS+=usr/tests/lib/googletest/gtest_main +OLD_FILES+=usr/tests/lib/googletest/Kyuafile +OLD_DIRS+=usr/tests/lib/googletest/ +OLD_FILES+=usr/tests/share/examples/tests/googletest/Kyuafile +OLD_FILES+=usr/tests/share/examples/tests/googletest/sample1_unittest +OLD_FILES+=usr/tests/share/examples/tests/googletest/sample10_unittest +OLD_FILES+=usr/tests/share/examples/tests/googletest/sample2_unittest +OLD_FILES+=usr/tests/share/examples/tests/googletest/sample3_unittest +OLD_FILES+=usr/tests/share/examples/tests/googletest/sample4_unittest +OLD_FILES+=usr/tests/share/examples/tests/googletest/sample5_unittest +OLD_FILES+=usr/tests/share/examples/tests/googletest/sample6_unittest +OLD_FILES+=usr/tests/share/examples/tests/googletest/sample7_unittest +OLD_FILES+=usr/tests/share/examples/tests/googletest/sample8_unittest +OLD_DIRS+=usr/tests/share/examples/tests/googletest +.endif + .if ${MK_GPIO} == no OLD_FILES+=usr/include/libgpio.h OLD_FILES+=usr/lib/libgpio.a Index: tools/build/options/WITHOUT_GOOGLETEST =================================================================== --- /dev/null +++ tools/build/options/WITHOUT_GOOGLETEST @@ -1,5 +1,5 @@ -.\" $FreeBSD: projects/import-googletest-1.8.1/tools/build/options/WITHOUT_GOOGLETEST 344312 2019-02-19 22:40:32Z ngie $ -Set to not build nor install +.\" $FreeBSD: head/tools/build/options/WITHOUT_GOOGLETEST 344312 2019-02-19 22:40:32Z ngie $ +Set to neither build nor install .Lb libgmock , .Lb libgtest , and dependent tests.