ac33783cd3
These files are generated from bsd.test.mk because kyua is able to run test programs implemented using different libraries/frameworks. In order to make this possible, this change also extends the various *.test.mk file to explicitly indicate the interface of every test program. Submitted by: Julio Merino jmmv google.com MFC after: 2 weeks
138 lines
3.9 KiB
Makefile
138 lines
3.9 KiB
Makefile
# $FreeBSD$
|
|
#
|
|
# Generic build infrastructure for test programs.
|
|
#
|
|
# The code in this file is independent of the implementation of the test
|
|
# programs being built; this file just provides generic infrastructure for the
|
|
# build and the definition of various helper variables and targets.
|
|
#
|
|
# Makefiles should never include this file directly. Instead, they should
|
|
# include one of the various *.test.mk depending on the specific test programs
|
|
# being built.
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
# Pointer to the top directory into which tests are installed. Should not be
|
|
# overriden by Makefiles, but the user may choose to set this in src.conf(5).
|
|
TESTSBASE?= /usr/tests
|
|
|
|
# Directory in which to install tests defined by the current Makefile.
|
|
# 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
|
|
# engines know to recurse into these directories.
|
|
#
|
|
# In other words: list here any directories that contain test programs but use
|
|
# SUBDIR for directories that may contain helper binaries and/or data files.
|
|
TESTS_SUBDIRS?=
|
|
|
|
# Knob to control the handling of the Kyuafile for this Makefile.
|
|
#
|
|
# If 'yes', a Kyuafile exists in the source tree and is installed into
|
|
# TESTSDIR.
|
|
#
|
|
# If 'auto', a Kyuafile 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 Kyuafile is installed.
|
|
KYUAFILE?= auto
|
|
|
|
# List of all tests being built. This variable is internal should not be
|
|
# defined by the Makefile. The various *.test.mk modules extend this variable
|
|
# as needed.
|
|
_TESTS?=
|
|
|
|
.if !empty(TESTS_SUBDIRS)
|
|
SUBDIR+= ${TESTS_SUBDIRS}
|
|
.endif
|
|
|
|
# it is rare for test cases to have man pages
|
|
.if !defined(MAN)
|
|
WITHOUT_MAN=yes
|
|
.export WITHOUT_MAN
|
|
.endif
|
|
|
|
# tell progs.mk we might want to install things
|
|
PROG_VARS+= BINDIR
|
|
PROGS_TARGETS+= install
|
|
|
|
.if ${KYUAFILE:tl} != "no"
|
|
FILES+= Kyuafile
|
|
FILESDIR_Kyuafile= ${TESTSDIR}
|
|
|
|
.if ${KYUAFILE:tl} == "auto"
|
|
CLEANFILES+= Kyuafile Kyuafile.tmp
|
|
|
|
Kyuafile: Makefile
|
|
@{ \
|
|
echo '-- Automatically generated by bsd.test.mk.'; \
|
|
echo; \
|
|
echo 'syntax(2)'; \
|
|
echo; \
|
|
echo 'test_suite("${TESTSUITE}")'; \
|
|
echo; \
|
|
} >Kyuafile.tmp
|
|
.for _T in ${_TESTS}
|
|
@echo "${TEST_INTERFACE.${_T}}_test_program{name=\"${_T}\"}" \
|
|
>>Kyuafile.tmp
|
|
.endfor
|
|
.for _T in ${TESTS_SUBDIRS:N.WAIT}
|
|
@echo "include(\"${_T}/Kyuafile\")" >>Kyuafile.tmp
|
|
.endfor
|
|
@mv Kyuafile.tmp Kyuafile
|
|
.endif
|
|
.endif
|
|
|
|
beforetest: .PHONY
|
|
.if defined(TESTSDIR)
|
|
.if ${TESTSDIR} == ${TESTSBASE}
|
|
# Forbid running from ${TESTSBASE}. It can cause false positives/negatives and
|
|
# it does not cover all the tests (e.g. it misses testing software in external).
|
|
@echo "*** Sorry, you cannot use make test from src/tests. Install the"
|
|
@echo "*** tests into their final location and run them from ${TESTSBASE}"
|
|
@false
|
|
.else
|
|
@echo "*** Using this test does not preclude you from running the tests"
|
|
@echo "*** installed in ${TESTSBASE}. This test run may raise false"
|
|
@echo "*** positives and/or false negatives."
|
|
.endif
|
|
.else
|
|
@echo "*** No TESTSDIR defined; nothing to do."
|
|
@false
|
|
.endif
|
|
@echo
|
|
|
|
.if !target(realtest)
|
|
realtest: .PHONY
|
|
@echo "$@ not defined; skipping"
|
|
.endif
|
|
|
|
test: .PHONY
|
|
.ORDER: beforetest realtest
|
|
test: beforetest realtest
|
|
|
|
.if target(aftertest)
|
|
.ORDER: realtest aftertest
|
|
test: aftertest
|
|
.endif
|
|
|
|
.if !empty(SUBDIR)
|
|
.include <bsd.subdir.mk>
|
|
.endif
|
|
|
|
.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS)
|
|
.include <bsd.progs.mk>
|
|
.elif !empty(FILES)
|
|
.include <bsd.files.mk>
|
|
.endif
|
|
|
|
.include <bsd.obj.mk>
|