atf.test.mk (38c0ca1481ac10422d20aa985735e44aa87fc0b5) atf.test.mk (8eb2bee6c0f4957c6c1cea826e59cda4d18a2a64)
1# $FreeBSD$
2#
3# You must include bsd.test.mk instead of this file from your Makefile.
4#
5# Logic to build and install ATF test programs; i.e. test programs linked
6# against the ATF libraries.
7
8.if !target(__<bsd.test.mk>__)

--- 8 unchanged lines hidden (view full) ---

17#
18# Test programs registered in this manner are set to be installed into TESTSDIR
19# (which should be overridden by the Makefile) and are not required to provide a
20# manpage.
21ATF_TESTS_C?=
22ATF_TESTS_CXX?=
23ATF_TESTS_SH?=
24ATF_TESTS_KSH93?=
1# $FreeBSD$
2#
3# You must include bsd.test.mk instead of this file from your Makefile.
4#
5# Logic to build and install ATF test programs; i.e. test programs linked
6# against the ATF libraries.
7
8.if !target(__<bsd.test.mk>__)

--- 8 unchanged lines hidden (view full) ---

17#
18# Test programs registered in this manner are set to be installed into TESTSDIR
19# (which should be overridden by the Makefile) and are not required to provide a
20# manpage.
21ATF_TESTS_C?=
22ATF_TESTS_CXX?=
23ATF_TESTS_SH?=
24ATF_TESTS_KSH93?=
25ATF_TESTS_PYTEST?=
25
26.if !empty(ATF_TESTS_C)
27PROGS+= ${ATF_TESTS_C}
28_TESTS+= ${ATF_TESTS_C}
29.for _T in ${ATF_TESTS_C}
30BINDIR.${_T}= ${TESTSDIR}
31MAN.${_T}?= # empty
32SRCS.${_T}?= ${_T}.c

--- 71 unchanged lines hidden (view full) ---

104.else
105 cat ${.ALLSRC:N*Makefile*} \
106 | sed ${ATF_TESTS_KSH93_SED_${_T}} >>${.TARGET}.tmp
107.endif
108 chmod +x ${.TARGET}.tmp
109 mv ${.TARGET}.tmp ${.TARGET}
110.endfor
111.endif
26
27.if !empty(ATF_TESTS_C)
28PROGS+= ${ATF_TESTS_C}
29_TESTS+= ${ATF_TESTS_C}
30.for _T in ${ATF_TESTS_C}
31BINDIR.${_T}= ${TESTSDIR}
32MAN.${_T}?= # empty
33SRCS.${_T}?= ${_T}.c

--- 71 unchanged lines hidden (view full) ---

105.else
106 cat ${.ALLSRC:N*Makefile*} \
107 | sed ${ATF_TESTS_KSH93_SED_${_T}} >>${.TARGET}.tmp
108.endif
109 chmod +x ${.TARGET}.tmp
110 mv ${.TARGET}.tmp ${.TARGET}
111.endfor
112.endif
113
114.if !empty(ATF_TESTS_PYTEST)
115# bsd.prog.mk SCRIPTS interface removes file extension unless
116# SCRIPTSNAME is set, which is not possible to do here.
117# Workaround this by appending another extension (.xtmp) to the
118# file name. Use separate loop to avoid dealing with explicitly
119# stating expansion for each and every variable.
120#
121# ATF_TESTS_PYTEST -> contains list of files as is (test_something.py ..)
122# _ATF_TESTS_PYTEST -> (test_something.py.xtmp ..)
123#
124# Former array is iterated to construct Kyuafile, where original file
125# names need to be written.
126# Latter array is iterated to enable bsd.prog.mk scripts framework -
127# namely, installing scripts without .xtmp prefix. Note: this allows to
128# not bother about the fact that make target needs to be different from
129# the source file.
130_TESTS+= ${ATF_TESTS_PYTEST}
131_ATF_TESTS_PYTEST=
132.for _T in ${ATF_TESTS_PYTEST}
133_ATF_TESTS_PYTEST += ${_T}.xtmp
134TEST_INTERFACE.${_T}= atf
135TEST_METADATA.${_T}+= required_programs="pytest"
136.endfor
137
138SCRIPTS+= ${_ATF_TESTS_PYTEST}
139.for _T in ${_ATF_TESTS_PYTEST}
140SCRIPTSDIR_${_T}= ${TESTSDIR}
141CLEANFILES+= ${_T} ${_T}.tmp
142# TODO(jmmv): It seems to me that this SED and SRC functionality should
143# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
144# this proves to be useful within the tests.
145ATF_TESTS_PYTEST_SED_${_T}?= # empty
146ATF_TESTS_PYTEST_SRC_${_T}?= ${.CURDIR}/${_T:S,.xtmp$,,}
147${_T}:
148 echo "#!${TESTSBASE}/atf_pytest_wrapper -P ${TESTSBASE}" > ${.TARGET}.tmp
149.if empty(ATF_TESTS_PYTEST_SED_${_T})
150 cat ${ATF_TESTS_PYTEST_SRC_${_T}} >>${.TARGET}.tmp
151.else
152 cat ${ATF_TESTS_PYTEST_SRC_${_T}} \
153 | sed ${ATF_TESTS_PYTEST_SED_${_T}} >>${.TARGET}.tmp
154.endif
155 chmod +x ${.TARGET}.tmp
156 mv ${.TARGET}.tmp ${.TARGET}
157.endfor
158.endif