Deleted Added
full compact
tap.test.mk (260633) tap.test.mk (263161)
1# $FreeBSD: head/share/mk/tap.test.mk 260633 2014-01-14 18:35:56Z jmmv $
1# $FreeBSD: head/share/mk/tap.test.mk 263161 2014-03-14 08:56:19Z jmmv $
2#
2#
3# You must include bsd.test.mk instead of this file from your Makefile.
4#
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
5# Logic to build and install TAP-compliant test programs.
6#
7# This is provided to support existing tests in the FreeBSD source tree
8# (particularly those coming from tools/regression/) that comply with the
9# Test Anything Protocol. It should not be used for new tests.
10
9.include <bsd.init.mk>
11.if !target(__<bsd.test.mk>__)
12.error tap.test.mk cannot be included directly.
13.endif
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.
19TAP_TESTS_C?=
20TAP_TESTS_CXX?=
21TAP_TESTS_PERL?=
22TAP_TESTS_SH?=
23
24# Perl interpreter to use for test programs written in this language.
25TAP_PERL_INTERPRETER?= /usr/local/bin/perl
26
27.if !empty(TAP_TESTS_C)
28PROGS+= ${TAP_TESTS_C}
29_TESTS+= ${TAP_TESTS_C}
30.for _T in ${TAP_TESTS_C}
31BINDIR.${_T}= ${TESTSDIR}
32MAN.${_T}?= # empty
33SRCS.${_T}?= ${_T}.c
34TEST_INTERFACE.${_T}= tap
35.endfor
36.endif
37
38.if !empty(TAP_TESTS_CXX)
39PROGS_CXX+= ${TAP_TESTS_CXX}
40_TESTS+= ${TAP_TESTS_CXX}
41.for _T in ${TAP_TESTS_CXX}
42BINDIR.${_T}= ${TESTSDIR}
43MAN.${_T}?= # empty
44SRCS.${_T}?= ${_T}.cc
45TEST_INTERFACE.${_T}= tap
46.endfor
47.endif
48
49.if !empty(TAP_TESTS_PERL)
50SCRIPTS+= ${TAP_TESTS_PERL}
51_TESTS+= ${TAP_TESTS_PERL}
52.for _T in ${TAP_TESTS_PERL}
53SCRIPTSDIR_${_T}= ${TESTSDIR}
54TEST_INTERFACE.${_T}= tap
55TEST_METADATA.${_T}+= required_programs="${TAP_PERL_INTERPRETER}"
56CLEANFILES+= ${_T} ${_T}.tmp
57# TODO(jmmv): It seems to me that this SED and SRC functionality should
58# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
59# this proves to be useful within the tests.
60TAP_TESTS_PERL_SED_${_T}?= # empty
61TAP_TESTS_PERL_SRC_${_T}?= ${_T}.pl
62${_T}: ${TAP_TESTS_PERL_SRC_${_T}}
63 { \
64 echo '#! ${TAP_PERL_INTERPRETER}'; \
65 cat ${.ALLSRC} | sed ${TAP_TESTS_PERL_SED_${_T}}; \
66 } >${.TARGET}.tmp
67 chmod +x ${.TARGET}.tmp
68 mv ${.TARGET}.tmp ${.TARGET}
69.endfor
70.endif
71
72.if !empty(TAP_TESTS_SH)
73SCRIPTS+= ${TAP_TESTS_SH}
74_TESTS+= ${TAP_TESTS_SH}
75.for _T in ${TAP_TESTS_SH}
76SCRIPTSDIR_${_T}= ${TESTSDIR}
77TEST_INTERFACE.${_T}= tap
78CLEANFILES+= ${_T} ${_T}.tmp
79# TODO(jmmv): It seems to me that this SED and SRC functionality should
80# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
81# this proves to be useful within the tests.
82TAP_TESTS_SH_SED_${_T}?= # empty
83TAP_TESTS_SH_SRC_${_T}?= ${_T}.sh
84${_T}: ${TAP_TESTS_SH_SRC_${_T}}
85 cat ${.ALLSRC} | sed ${TAP_TESTS_SH_SED_${_T}} >${.TARGET}.tmp
86 chmod +x ${.TARGET}.tmp
87 mv ${.TARGET}.tmp ${.TARGET}
88.endfor
89.endif
14
15# List of C, C++ and shell test programs to build.
16#
17# Programs listed here are built according to the semantics of bsd.prog.mk for
18# PROGS, PROGS_CXX and SCRIPTS, respectively.
19#
20# Test programs registered in this manner are set to be installed into TESTSDIR
21# (which should be overriden by the Makefile) and are not required to provide a
22# manpage.
23TAP_TESTS_C?=
24TAP_TESTS_CXX?=
25TAP_TESTS_PERL?=
26TAP_TESTS_SH?=
27
28# Perl interpreter to use for test programs written in this language.
29TAP_PERL_INTERPRETER?= /usr/local/bin/perl
30
31.if !empty(TAP_TESTS_C)
32PROGS+= ${TAP_TESTS_C}
33_TESTS+= ${TAP_TESTS_C}
34.for _T in ${TAP_TESTS_C}
35BINDIR.${_T}= ${TESTSDIR}
36MAN.${_T}?= # empty
37SRCS.${_T}?= ${_T}.c
38TEST_INTERFACE.${_T}= tap
39.endfor
40.endif
41
42.if !empty(TAP_TESTS_CXX)
43PROGS_CXX+= ${TAP_TESTS_CXX}
44_TESTS+= ${TAP_TESTS_CXX}
45.for _T in ${TAP_TESTS_CXX}
46BINDIR.${_T}= ${TESTSDIR}
47MAN.${_T}?= # empty
48SRCS.${_T}?= ${_T}.cc
49TEST_INTERFACE.${_T}= tap
50.endfor
51.endif
52
53.if !empty(TAP_TESTS_PERL)
54SCRIPTS+= ${TAP_TESTS_PERL}
55_TESTS+= ${TAP_TESTS_PERL}
56.for _T in ${TAP_TESTS_PERL}
57SCRIPTSDIR_${_T}= ${TESTSDIR}
58TEST_INTERFACE.${_T}= tap
59TEST_METADATA.${_T}+= required_programs="${TAP_PERL_INTERPRETER}"
60CLEANFILES+= ${_T} ${_T}.tmp
61# TODO(jmmv): It seems to me that this SED and SRC functionality should
62# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
63# this proves to be useful within the tests.
64TAP_TESTS_PERL_SED_${_T}?= # empty
65TAP_TESTS_PERL_SRC_${_T}?= ${_T}.pl
66${_T}: ${TAP_TESTS_PERL_SRC_${_T}}
67 { \
68 echo '#! ${TAP_PERL_INTERPRETER}'; \
69 cat ${.ALLSRC} | sed ${TAP_TESTS_PERL_SED_${_T}}; \
70 } >${.TARGET}.tmp
71 chmod +x ${.TARGET}.tmp
72 mv ${.TARGET}.tmp ${.TARGET}
73.endfor
74.endif
75
76.if !empty(TAP_TESTS_SH)
77SCRIPTS+= ${TAP_TESTS_SH}
78_TESTS+= ${TAP_TESTS_SH}
79.for _T in ${TAP_TESTS_SH}
80SCRIPTSDIR_${_T}= ${TESTSDIR}
81TEST_INTERFACE.${_T}= tap
82CLEANFILES+= ${_T} ${_T}.tmp
83# TODO(jmmv): It seems to me that this SED and SRC functionality should
84# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
85# this proves to be useful within the tests.
86TAP_TESTS_SH_SED_${_T}?= # empty
87TAP_TESTS_SH_SRC_${_T}?= ${_T}.sh
88${_T}: ${TAP_TESTS_SH_SRC_${_T}}
89 cat ${.ALLSRC} | sed ${TAP_TESTS_SH_SED_${_T}} >${.TARGET}.tmp
90 chmod +x ${.TARGET}.tmp
91 mv ${.TARGET}.tmp ${.TARGET}
92.endfor
93.endif
90
91.include <bsd.test.mk>