16532e7bfSRui Paulo# $FreeBSD$ 26532e7bfSRui Paulo# 3f5fd950eSJulio Merino# You must include bsd.test.mk instead of this file from your Makefile. 4f5fd950eSJulio Merino# 56532e7bfSRui Paulo# Logic to build and install plain test programs. A plain test programs it not 66532e7bfSRui Paulo# supposed to use any specific testing framework: all it does is run some code 76532e7bfSRui Paulo# and report the test's pass or fail status via a 0 or 1 exit code. 86532e7bfSRui Paulo 9f5fd950eSJulio Merino.if !target(__<bsd.test.mk>__) 10f5fd950eSJulio Merino.error plain.test.mk cannot be included directly. 11f5fd950eSJulio Merino.endif 126532e7bfSRui Paulo 136532e7bfSRui Paulo# List of C, C++ and shell test programs to build. 146532e7bfSRui Paulo# 156532e7bfSRui Paulo# Programs listed here are built according to the semantics of bsd.prog.mk for 166532e7bfSRui Paulo# PROGS, PROGS_CXX and SCRIPTS, respectively. 176532e7bfSRui Paulo# 186532e7bfSRui Paulo# Test programs registered in this manner are set to be installed into TESTSDIR 19*f324fafcSEitan Adler# (which should be overridden by the Makefile) and are not required to provide a 206532e7bfSRui Paulo# manpage. 216532e7bfSRui PauloPLAIN_TESTS_C?= 226532e7bfSRui PauloPLAIN_TESTS_CXX?= 236532e7bfSRui PauloPLAIN_TESTS_SH?= 246532e7bfSRui Paulo 256532e7bfSRui Paulo.if !empty(PLAIN_TESTS_C) 266532e7bfSRui PauloPROGS+= ${PLAIN_TESTS_C} 276532e7bfSRui Paulo_TESTS+= ${PLAIN_TESTS_C} 286532e7bfSRui Paulo.for _T in ${PLAIN_TESTS_C} 296532e7bfSRui PauloBINDIR.${_T}= ${TESTSDIR} 306532e7bfSRui PauloMAN.${_T}?= # empty 31a2b5b37cSJulio MerinoSRCS.${_T}?= ${_T}.c 326532e7bfSRui PauloTEST_INTERFACE.${_T}= plain 336532e7bfSRui Paulo.endfor 346532e7bfSRui Paulo.endif 356532e7bfSRui Paulo 366532e7bfSRui Paulo.if !empty(PLAIN_TESTS_CXX) 376532e7bfSRui PauloPROGS_CXX+= ${PLAIN_TESTS_CXX} 386532e7bfSRui Paulo_TESTS+= ${PLAIN_TESTS_CXX} 396532e7bfSRui Paulo.for _T in ${PLAIN_TESTS_CXX} 406532e7bfSRui PauloBINDIR.${_T}= ${TESTSDIR} 416532e7bfSRui PauloMAN.${_T}?= # empty 42a2b5b37cSJulio MerinoSRCS.${_T}?= ${_T}.cc 436532e7bfSRui PauloTEST_INTERFACE.${_T}= plain 446532e7bfSRui Paulo.endfor 456532e7bfSRui Paulo.endif 466532e7bfSRui Paulo 476532e7bfSRui Paulo.if !empty(PLAIN_TESTS_SH) 486532e7bfSRui PauloSCRIPTS+= ${PLAIN_TESTS_SH} 496532e7bfSRui Paulo_TESTS+= ${PLAIN_TESTS_SH} 506532e7bfSRui Paulo.for _T in ${PLAIN_TESTS_SH} 516532e7bfSRui PauloSCRIPTSDIR_${_T}= ${TESTSDIR} 526532e7bfSRui PauloTEST_INTERFACE.${_T}= plain 539e684a3aSJulio MerinoCLEANFILES+= ${_T} ${_T}.tmp 549e684a3aSJulio Merino# TODO(jmmv): It seems to me that this SED and SRC functionality should 559e684a3aSJulio Merino# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if 569e684a3aSJulio Merino# this proves to be useful within the tests. 579e684a3aSJulio MerinoPLAIN_TESTS_SH_SED_${_T}?= # empty 589e684a3aSJulio MerinoPLAIN_TESTS_SH_SRC_${_T}?= ${_T}.sh 599e684a3aSJulio Merino${_T}: ${PLAIN_TESTS_SH_SRC_${_T}} 60db572ab6SEnji Cooper.if empty(PLAIN_TESTS_SH_SED_${_T}) 61db572ab6SEnji Cooper cat ${.ALLSRC:N*Makefile*} >${.TARGET}.tmp 62db572ab6SEnji Cooper.else 6364dc0245SJulio Merino cat ${.ALLSRC:N*Makefile*} \ 6464dc0245SJulio Merino | sed ${PLAIN_TESTS_SH_SED_${_T}} >${.TARGET}.tmp 65db572ab6SEnji Cooper.endif 669e684a3aSJulio Merino chmod +x ${.TARGET}.tmp 679e684a3aSJulio Merino mv ${.TARGET}.tmp ${.TARGET} 686532e7bfSRui Paulo.endfor 696532e7bfSRui Paulo.endif 70