Add tap.test.mk.

This file provides support to build test programs that comply with the
Test Anything Protocol.  Its main goal is to support the painless
integration of existing tests from tools/regression/ into the Kyua-based
test suite.

Approved by:	rpaulo (mentor)
This commit is contained in:
Julio Merino 2013-12-11 03:39:50 +00:00
parent becd984900
commit d8278f57f8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=259208
2 changed files with 65 additions and 0 deletions

View File

@ -46,6 +46,7 @@ FILESDIR= ${BINDIR}/mk
.if ${MK_TESTS} != "no"
FILES+= atf.test.mk
FILES+= plain.test.mk
FILES+= tap.test.mk
.endif
.include <bsd.prog.mk>

64
share/mk/tap.test.mk Normal file
View File

@ -0,0 +1,64 @@
# $FreeBSD$
#
# Logic to build and install TAP-compliant test programs.
#
# This is provided to support existing tests in the FreeBSD source tree
# (particularly those coming from tools/regression/) that comply with the
# Test Anything Protocol. It should not be used for new tests.
.include <bsd.init.mk>
# List of C, C++ and shell test programs to build.
#
# Programs listed here are built according to the semantics of bsd.prog.mk for
# PROGS, PROGS_CXX and SCRIPTS, respectively.
#
# Test programs registered in this manner are set to be installed into TESTSDIR
# (which should be overriden by the Makefile) and are not required to provide a
# manpage.
TAP_TESTS_C?=
TAP_TESTS_CXX?=
TAP_TESTS_SH?=
.if !empty(TAP_TESTS_C)
PROGS+= ${TAP_TESTS_C}
_TESTS+= ${TAP_TESTS_C}
.for _T in ${TAP_TESTS_C}
BINDIR.${_T}= ${TESTSDIR}
MAN.${_T}?= # empty
SRCS.${_T}?= ${_T}.c
TEST_INTERFACE.${_T}= tap
.endfor
.endif
.if !empty(TAP_TESTS_CXX)
PROGS_CXX+= ${TAP_TESTS_CXX}
_TESTS+= ${TAP_TESTS_CXX}
.for _T in ${TAP_TESTS_CXX}
BINDIR.${_T}= ${TESTSDIR}
MAN.${_T}?= # empty
SRCS.${_T}?= ${_T}.cc
TEST_INTERFACE.${_T}= tap
.endfor
.endif
.if !empty(TAP_TESTS_SH)
SCRIPTS+= ${TAP_TESTS_SH}
_TESTS+= ${TAP_TESTS_SH}
.for _T in ${TAP_TESTS_SH}
SCRIPTSDIR_${_T}= ${TESTSDIR}
TEST_INTERFACE.${_T}= tap
CLEANFILES+= ${_T} ${_T}.tmp
# TODO(jmmv): It seems to me that this SED and SRC functionality should
# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if
# this proves to be useful within the tests.
TAP_TESTS_SH_SED_${_T}?= # empty
TAP_TESTS_SH_SRC_${_T}?= ${_T}.sh
${_T}: ${TAP_TESTS_SH_SRC_${_T}}
cat ${.ALLSRC} | sed ${TAP_TESTS_SH_SED_${_T}} >${.TARGET}.tmp
chmod +x ${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}
.endfor
.endif
.include <bsd.test.mk>