xref: /freebsd/share/mk/googletest.test.mk (revision 02e9120893770924227138ba49df1edb3896112a)
1#
2# You must include bsd.test.mk instead of this file from your Makefile.
3#
4# Logic to build and install GoogleTest based test programs.
5#
6# GoogleTest is a C++ test framework, thus, it does not describe/articulate how
7# to write tests in other languages, e.g., C or shell, unlike the ATF, plain,
8# and TAP raw test interfaces.
9#
10# For now this is a thin wrapper around the `plain` test interface, but in the
11# future this will rely on a newer version of kyua which will integrate in
12# GoogleTest support.
13
14.if !target(__<bsd.test.mk>__)
15.error googletest.test.mk cannot be included directly.
16.endif
17
18# List of GoogleTest test programs to build.
19#
20# Programs listed here are built according to the semantics of bsd.progs.mk for
21# PROGS_CXX.
22#
23# Test programs registered in this manner are set to be installed into TESTSDIR
24# (which should be overridden by the Makefile) and are not required to provide a
25# manpage.
26GTESTS?=
27
28.if !empty(GTESTS)
29.include <googletest.test.inc.mk>
30
31PROGS_CXX+= ${GTESTS}
32.for _T in ${GTESTS}
33BINDIR.${_T}= ${TESTSDIR}
34CXXFLAGS.${_T}+= ${GTESTS_CXXFLAGS}
35MAN.${_T}?= # empty
36SRCS.${_T}?= ${_T}.cc
37.if !empty(GTESTS_WRAPPER_SH.${_T})
38# A stopgap/workaround to let kyua execute test case one by one
39ATF_TESTS_SH+= ${GTESTS_WRAPPER_SH.${_T}}
40.else
41_TESTS+= ${_T}
42TEST_INTERFACE.${_T}= plain
43.endif
44
45.endfor
46.endif
47