aboutsummaryrefslogtreecommitdiff
path: root/share/examples/tests
diff options
context:
space:
mode:
Diffstat (limited to 'share/examples/tests')
-rw-r--r--share/examples/tests/tests/Makefile6
-rw-r--r--share/examples/tests/tests/googletest/Makefile59
2 files changed, 65 insertions, 0 deletions
diff --git a/share/examples/tests/tests/Makefile b/share/examples/tests/tests/Makefile
index 35106d686776..e5bbd7813352 100644
--- a/share/examples/tests/tests/Makefile
+++ b/share/examples/tests/tests/Makefile
@@ -1,5 +1,7 @@
# $FreeBSD$
+.include <src.opts.mk>
+
# Directory into which the Kyuafile provided by this directory will be
# installed.
#
@@ -21,6 +23,10 @@ TESTS_SUBDIRS+= atf
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
diff --git a/share/examples/tests/tests/googletest/Makefile b/share/examples/tests/tests/googletest/Makefile
new file mode 100644
index 000000000000..db1cbd322d4d
--- /dev/null
+++ b/share/examples/tests/tests/googletest/Makefile
@@ -0,0 +1,59 @@
+# $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
+
+GTEST_MAIN_REQ_TESTS+= sample1_unittest
+GTEST_MAIN_REQ_TESTS+= sample2_unittest
+GTEST_MAIN_REQ_TESTS+= sample3_unittest
+GTEST_MAIN_REQ_TESTS+= sample4_unittest
+GTEST_MAIN_REQ_TESTS+= sample5_unittest
+GTEST_MAIN_REQ_TESTS+= sample6_unittest
+GTEST_MAIN_REQ_TESTS+= sample7_unittest
+GTEST_MAIN_REQ_TESTS+= sample8_unittest
+
+# sample9_unittest's `CustomOutputTest.Fails` fails intentionally to illustrate
+# how output format can be adjusted with command-line parameters.
+#GTEST_REQ_TESTS+= sample9_unittest
+GTEST_REQ_TESTS+= sample10_unittest
+
+# 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
+.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
+SRCS.sample5_unittest+= sample1.cc
+
+.include <bsd.test.mk>