2012-11-07 22:02:02 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
#
|
2013-10-19 06:48:49 +00:00
|
|
|
# Logic to build and install ATF test programs; i.e. test programs linked
|
|
|
|
# against the ATF libraries.
|
2012-11-07 22:02:02 +00:00
|
|
|
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
|
2013-10-19 06:48:49 +00:00
|
|
|
# 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?=
|
|
|
|
|
2013-10-19 06:50:17 +00:00
|
|
|
# Whether to allow using the deprecated ATF tools or not.
|
|
|
|
#
|
|
|
|
# If 'yes', this file will generate Atffiles when requested and will also
|
|
|
|
# support using the deprecated atf-run tool to execute the tests.
|
|
|
|
ALLOW_DEPRECATED_ATF_TOOLS?= no
|
|
|
|
|
|
|
|
# Knob to control the handling of the Atffile for this Makefile.
|
|
|
|
#
|
|
|
|
# If 'yes', an Atffile exists in the source tree and is installed into
|
|
|
|
# TESTSDIR.
|
|
|
|
#
|
|
|
|
# If 'auto', an Atffile is automatically generated based on the list of test
|
|
|
|
# programs built by the Makefile and is installed into TESTSDIR. This is the
|
|
|
|
# default and is sufficient in the majority of the cases.
|
|
|
|
#
|
|
|
|
# If 'no', no Atffile is installed.
|
|
|
|
ATFFILE?= auto
|
|
|
|
|
2013-10-19 06:48:49 +00:00
|
|
|
.if !empty(ATF_TESTS_C)
|
|
|
|
PROGS+= ${ATF_TESTS_C}
|
|
|
|
.for _T in ${ATF_TESTS_C}
|
|
|
|
BINDIR.${_T}= ${TESTSDIR}
|
|
|
|
MAN.${_T}?= # empty
|
2012-11-07 22:02:02 +00:00
|
|
|
SRCS.${_T}?= ${_T}.c
|
|
|
|
DPADD.${_T}+= ${LIBATF_C}
|
|
|
|
LDADD.${_T}+= -latf-c
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
2013-10-19 06:48:49 +00:00
|
|
|
.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
|
2012-11-07 22:02:02 +00:00
|
|
|
SRCS.${_T}?= ${_T}${CXX_SUFFIX:U.cc}
|
|
|
|
DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C}
|
|
|
|
LDADD.${_T}+= -latf-c++ -latf-c
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
2013-10-19 06:48:49 +00:00
|
|
|
.if !empty(ATF_TESTS_SH)
|
|
|
|
SCRIPTS+= ${ATF_TESTS_SH}
|
|
|
|
.for _T in ${ATF_TESTS_SH}
|
|
|
|
SCRIPTSDIR_${_T}= ${TESTSDIR}
|
2012-11-07 22:02:02 +00:00
|
|
|
CLEANFILES+= ${_T} ${_T}.tmp
|
2013-10-19 06:48:49 +00:00
|
|
|
ATF_TESTS_SH_SRC_${_T}?= ${_T}.sh
|
|
|
|
${_T}: ${ATF_TESTS_SH_SRC_${_T}}
|
2012-11-07 22:02:02 +00:00
|
|
|
echo '#! /usr/bin/atf-sh' > ${.TARGET}.tmp
|
|
|
|
cat ${.ALLSRC} >> ${.TARGET}.tmp
|
|
|
|
chmod +x ${.TARGET}.tmp
|
|
|
|
mv ${.TARGET}.tmp ${.TARGET}
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
2013-10-19 06:50:17 +00:00
|
|
|
.if ${ALLOW_DEPRECATED_ATF_TOOLS} != "no"
|
|
|
|
|
|
|
|
.if ${ATFFILE:tl} != "no"
|
|
|
|
FILES+= Atffile
|
|
|
|
FILESDIR_Atffile= ${TESTSDIR}
|
|
|
|
|
|
|
|
.if ${ATFFILE:tl} == "auto"
|
|
|
|
CLEANFILES+= Atffile Atffile.tmp
|
|
|
|
|
|
|
|
Atffile: Makefile
|
|
|
|
@{ echo 'Content-Type: application/X-atf-atffile; version="1"'; \
|
|
|
|
echo; \
|
|
|
|
echo '# Automatically generated by atf-test.mk.'; \
|
|
|
|
echo; \
|
|
|
|
echo 'prop: test-suite = "'${TESTSUITE}'"'; \
|
|
|
|
echo; \
|
|
|
|
for tp in ${ATF_TESTS_C} ${ATF_TESTS_CXX} ${ATF_TESTS_SH} \
|
|
|
|
${TESTS_SUBDIRS}; \
|
|
|
|
do \
|
|
|
|
echo "tp: $${tp}"; \
|
|
|
|
done; } >Atffile.tmp
|
|
|
|
@mv Atffile.tmp Atffile
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.endif
|
|
|
|
|
2012-11-07 22:02:02 +00:00
|
|
|
.include <bsd.test.mk>
|