diff options
author | rpaulo <rpaulo@FreeBSD.org> | 2013-10-19 06:48:49 +0000 |
---|---|---|
committer | rpaulo <rpaulo@FreeBSD.org> | 2013-10-19 06:48:49 +0000 |
commit | cfe21388ca160ef60459717a04f446474687e81c (patch) | |
tree | b75acb04faf3a592bbc877762f093885c7b3fc8e /share/mk/atf.test.mk | |
parent | fa957a569b51703a1b35abaabfeab9c428b5be5e (diff) | |
download | FreeBSD-src-cfe21388ca160ef60459717a04f446474687e81c.zip FreeBSD-src-cfe21388ca160ef60459717a04f446474687e81c.tar.gz |
Clearly split the logic to build ATF and plain tests apart.
This change introduces a new plain.test.mk file that provides the build
infrastructure to build test programs that don't use any framework.
Most of the code previously in bsd.test.mk moves to plain.test.mk and
atf.test.mk is extended with the missing pieces.
In doing so, this change pushes all test program building logic to the
various *.test.mk files instead of trying to reuse some tiny bits.
In fact, this attempt to reuse some definitions makes the code harder
to read and harder to extend.
The clear benefit of this is that the interface of bsd.test.mk is now
clearly delimited.
Submitted by: Julio Merino jmmv google.com
MFC after: 2 weeks
Diffstat (limited to 'share/mk/atf.test.mk')
-rw-r--r-- | share/mk/atf.test.mk | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/share/mk/atf.test.mk b/share/mk/atf.test.mk index da4d12f..85ddfa5 100644 --- a/share/mk/atf.test.mk +++ b/share/mk/atf.test.mk @@ -1,49 +1,53 @@ -# $NetBSD$ # $FreeBSD$ # +# Logic to build and install ATF test programs; i.e. test programs linked +# against the ATF libraries. .include <bsd.init.mk> -ATF_TESTS:= - -.if make(*test) -TESTSDIR?= . -.endif - -.if defined(ATF_TESTS_SUBDIRS) -# Only visit subdirs when building, etc because ATF does this it on its own. -.if !make(atf-test) -SUBDIR+= ${ATF_TESTS_SUBDIRS} -.endif -ATF_TESTS+= ${ATF_TESTS_SUBDIRS} - -.include <bsd.subdir.mk> -.endif - -.if defined(TESTS_C) -ATF_TESTS+= ${TESTS_C} -.for _T in ${TESTS_C} +# List of C, C++ and shell test programs to build. +# +# Programs listed here are built using PROGS, PROGS_CXX and SCRIPTS, +# respectively, from bsd.prog.mk. However, the build rules are tweaked to +# require the ATF libraries. +# +# 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. +ATF_TESTS_C?= +ATF_TESTS_CXX?= +ATF_TESTS_SH?= + +.if !empty(ATF_TESTS_C) +PROGS+= ${ATF_TESTS_C} +.for _T in ${ATF_TESTS_C} +BINDIR.${_T}= ${TESTSDIR} +MAN.${_T}?= # empty SRCS.${_T}?= ${_T}.c DPADD.${_T}+= ${LIBATF_C} LDADD.${_T}+= -latf-c .endfor .endif -.if defined(TESTS_CXX) -ATF_TESTS+= ${TESTS_CXX} -.for _T in ${TESTS_CXX} +.if !empty(ATF_TESTS_CXX) +PROGS_CXX+= ${ATF_TESTS_CXX} +PROGS+= ${ATF_TESTS_CXX} +.for _T in ${ATF_TESTS_CXX} +BINDIR.${_T}= ${TESTSDIR} +MAN.${_T}?= # empty SRCS.${_T}?= ${_T}${CXX_SUFFIX:U.cc} DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C} LDADD.${_T}+= -latf-c++ -latf-c .endfor .endif -.if defined(TESTS_SH) -ATF_TESTS+= ${TESTS_SH} -.for _T in ${TESTS_SH} +.if !empty(ATF_TESTS_SH) +SCRIPTS+= ${ATF_TESTS_SH} +.for _T in ${ATF_TESTS_SH} +SCRIPTSDIR_${_T}= ${TESTSDIR} CLEANFILES+= ${_T} ${_T}.tmp -TESTS_SH_SRC_${_T}?= ${_T}.sh -${_T}: ${TESTS_SH_SRC_${_T}} +ATF_TESTS_SH_SRC_${_T}?= ${_T}.sh +${_T}: ${ATF_TESTS_SH_SRC_${_T}} echo '#! /usr/bin/atf-sh' > ${.TARGET}.tmp cat ${.ALLSRC} >> ${.TARGET}.tmp chmod +x ${.TARGET}.tmp |