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. 19TAP_TESTS_C?= 20TAP_TESTS_CXX?= 21TAP_TESTS_SH?= 22 23.if !empty(TAP_TESTS_C) 24PROGS+= ${TAP_TESTS_C} 25_TESTS+= ${TAP_TESTS_C} 26.for _T in ${TAP_TESTS_C} 27BINDIR.${_T}= ${TESTSDIR} 28MAN.${_T}?= # empty 29SRCS.${_T}?= ${_T}.c 30TEST_INTERFACE.${_T}= tap 31.endfor 32.endif 33 34.if !empty(TAP_TESTS_CXX) 35PROGS_CXX+= ${TAP_TESTS_CXX} 36_TESTS+= ${TAP_TESTS_CXX} 37.for _T in ${TAP_TESTS_CXX} 38BINDIR.${_T}= ${TESTSDIR} 39MAN.${_T}?= # empty 40SRCS.${_T}?= ${_T}.cc 41TEST_INTERFACE.${_T}= tap 42.endfor 43.endif 44 45.if !empty(TAP_TESTS_SH) 46SCRIPTS+= ${TAP_TESTS_SH} 47_TESTS+= ${TAP_TESTS_SH} 48.for _T in ${TAP_TESTS_SH} 49SCRIPTSDIR_${_T}= ${TESTSDIR} 50TEST_INTERFACE.${_T}= tap 51CLEANFILES+= ${_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. 55TAP_TESTS_SH_SED_${_T}?= # empty 56TAP_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> 65