Add the automatic generation of Atffile files.

These are only used by the deprecated atf-run and atf-report tools.
Generating them is easy and provides a mechanism for people to
experiment with these tools if they wish.

But, because these tools and files are deprecated, doing this only
happens if the user has explicitly set ALLOW_DEPRECATED_ATF_TOOLS
to yes.

Submitted by:	Julio Merino jmmv google.com
MFC after:	2 weeks
This commit is contained in:
Rui Paulo 2013-10-19 06:50:17 +00:00
parent d4a14c8563
commit 26ea29af54
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=256762
2 changed files with 51 additions and 0 deletions

View File

@ -18,6 +18,24 @@ ATF_TESTS_C?=
ATF_TESTS_CXX?=
ATF_TESTS_SH?=
# 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
.if !empty(ATF_TESTS_C)
PROGS+= ${ATF_TESTS_C}
.for _T in ${ATF_TESTS_C}
@ -55,4 +73,31 @@ ${_T}: ${ATF_TESTS_SH_SRC_${_T}}
.endfor
.endif
.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
.include <bsd.test.mk>

View File

@ -20,6 +20,10 @@ TESTSBASE?= /usr/tests
# Makefiles have to override this to point to a subdirectory of TESTSBASE.
TESTSDIR?= .
# Name of the test suite these tests belong to. Should rarely be changed for
# Makefiles built into the FreeBSD src tree.
TESTSUITE?= FreeBSD
# List of subdirectories containing tests into which to recurse. This has the
# same semantics as SUBDIR at build-time. However, the directories listed here
# get registered into the run-time test suite definitions so that the test
@ -82,6 +86,8 @@ test: aftertest
.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS)
.include <bsd.progs.mk>
.elif !empty(FILES)
.include <bsd.files.mk>
.endif
.include <bsd.obj.mk>