]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/tap.test.mk
MFV r260154 + 260182:
[FreeBSD/FreeBSD.git] / share / mk / tap.test.mk
1 # $FreeBSD$
2 #
3 # Logic to build and install TAP-compliant test programs.
4 #
5 # This is provided to support existing tests in the FreeBSD source tree
6 # (particularly those coming from tools/regression/) that comply with the
7 # Test Anything Protocol.  It should not be used for new tests.
8
9 .include <bsd.init.mk>
10
11 # List of C, C++ and shell test programs to build.
12 #
13 # Programs listed here are built according to the semantics of bsd.prog.mk for
14 # PROGS, PROGS_CXX and SCRIPTS, respectively.
15 #
16 # Test programs registered in this manner are set to be installed into TESTSDIR
17 # (which should be overriden by the Makefile) and are not required to provide a
18 # manpage.
19 TAP_TESTS_C?=
20 TAP_TESTS_CXX?=
21 TAP_TESTS_SH?=
22
23 .if !empty(TAP_TESTS_C)
24 PROGS+= ${TAP_TESTS_C}
25 _TESTS+= ${TAP_TESTS_C}
26 .for _T in ${TAP_TESTS_C}
27 BINDIR.${_T}= ${TESTSDIR}
28 MAN.${_T}?= # empty
29 SRCS.${_T}?= ${_T}.c
30 TEST_INTERFACE.${_T}= tap
31 .endfor
32 .endif
33
34 .if !empty(TAP_TESTS_CXX)
35 PROGS_CXX+= ${TAP_TESTS_CXX}
36 _TESTS+= ${TAP_TESTS_CXX}
37 .for _T in ${TAP_TESTS_CXX}
38 BINDIR.${_T}= ${TESTSDIR}
39 MAN.${_T}?= # empty
40 SRCS.${_T}?= ${_T}.cc
41 TEST_INTERFACE.${_T}= tap
42 .endfor
43 .endif
44
45 .if !empty(TAP_TESTS_SH)
46 SCRIPTS+= ${TAP_TESTS_SH}
47 _TESTS+= ${TAP_TESTS_SH}
48 .for _T in ${TAP_TESTS_SH}
49 SCRIPTSDIR_${_T}= ${TESTSDIR}
50 TEST_INTERFACE.${_T}= tap
51 CLEANFILES+= ${_T} ${_T}.tmp
52 # TODO(jmmv): It seems to me that this SED and SRC functionality should
53 # exist in bsd.prog.mk along the support for SCRIPTS.  Move it there if
54 # this proves to be useful within the tests.
55 TAP_TESTS_SH_SED_${_T}?= # empty
56 TAP_TESTS_SH_SRC_${_T}?= ${_T}.sh
57 ${_T}: ${TAP_TESTS_SH_SRC_${_T}}
58         cat ${.ALLSRC} | sed ${TAP_TESTS_SH_SED_${_T}} >${.TARGET}.tmp
59         chmod +x ${.TARGET}.tmp
60         mv ${.TARGET}.tmp ${.TARGET}
61 .endfor
62 .endif
63
64 .include <bsd.test.mk>