3 # Logic to build and install plain test programs. A plain test programs it not
4 # supposed to use any specific testing framework: all it does is run some code
5 # and report the test's pass or fail status via a 0 or 1 exit code.
9 # List of C, C++ and shell test programs to build.
11 # Programs listed here are built according to the semantics of bsd.prog.mk for
12 # PROGS, PROGS_CXX and SCRIPTS, respectively.
14 # Test programs registered in this manner are set to be installed into TESTSDIR
15 # (which should be overriden by the Makefile) and are not required to provide a
21 .if !empty(PLAIN_TESTS_C)
22 PROGS+= ${PLAIN_TESTS_C}
23 _TESTS+= ${PLAIN_TESTS_C}
24 .for _T in ${PLAIN_TESTS_C}
25 BINDIR.${_T}= ${TESTSDIR}
28 TEST_INTERFACE.${_T}= plain
32 .if !empty(PLAIN_TESTS_CXX)
33 PROGS_CXX+= ${PLAIN_TESTS_CXX}
34 _TESTS+= ${PLAIN_TESTS_CXX}
35 .for _T in ${PLAIN_TESTS_CXX}
36 BINDIR.${_T}= ${TESTSDIR}
39 TEST_INTERFACE.${_T}= plain
43 .if !empty(PLAIN_TESTS_SH)
44 SCRIPTS+= ${PLAIN_TESTS_SH}
45 _TESTS+= ${PLAIN_TESTS_SH}
46 .for _T in ${PLAIN_TESTS_SH}
47 SCRIPTSDIR_${_T}= ${TESTSDIR}
48 TEST_INTERFACE.${_T}= plain
49 CLEANFILES+= ${_T} ${_T}.tmp
50 # TODO(jmmv): It seems to me that this SED and SRC functionality should
51 # exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
52 # this proves to be useful within the tests.
53 PLAIN_TESTS_SH_SED_${_T}?= # empty
54 PLAIN_TESTS_SH_SRC_${_T}?= ${_T}.sh
55 ${_T}: ${PLAIN_TESTS_SH_SRC_${_T}}
56 cat ${.ALLSRC} | sed ${PLAIN_TESTS_SH_SED_${_T}} >${.TARGET}.tmp
57 chmod +x ${.TARGET}.tmp
58 mv ${.TARGET}.tmp ${.TARGET}
62 .include <bsd.test.mk>