2014-03-14 12:52:55 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# You must include bsd.test.mk instead of this file from your Makefile.
|
|
|
|
#
|
|
|
|
# Internal glue for the build of /usr/tests/.
|
|
|
|
|
|
|
|
.if !target(__<bsd.test.mk>__)
|
|
|
|
.error suite.test.mk cannot be included directly.
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# Name of the test suite these tests belong to. Should rarely be changed for
|
|
|
|
# Makefiles built into the FreeBSD src tree.
|
|
|
|
TESTSUITE?= FreeBSD
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
# Per-test program interface definition.
|
|
|
|
#
|
|
|
|
# The name provided here must match one of the interface names supported by
|
|
|
|
# Kyua as this is later encoded in the Kyuafile test program definitions.
|
|
|
|
#TEST_INTERFACE.<test-program>= interface-name
|
|
|
|
|
2015-07-04 02:37:36 +00:00
|
|
|
# Metadata properties applicable to all test programs.
|
|
|
|
#
|
|
|
|
# All the variables for a test program defined in the Makefile are appended
|
|
|
|
# to the test program's definition in the Kyuafile. This feature can be
|
|
|
|
# used to avoid having to explicitly supply a Kyuafile in the source
|
|
|
|
# directory, allowing the caller Makefile to rely on the KYUAFILE=auto
|
|
|
|
# behavior defined here.
|
|
|
|
#TEST_METADATA+= key="value"
|
|
|
|
|
2014-03-14 12:52:55 +00:00
|
|
|
# Per-test program metadata properties as a list of key/value pairs.
|
|
|
|
#
|
2015-07-04 02:37:36 +00:00
|
|
|
# These per-test program settings _extend_ the values provided in the
|
|
|
|
# unqualified TEST_METADATA variable.
|
2014-03-14 12:52:55 +00:00
|
|
|
#TEST_METADATA.<test-program>+= key="value"
|
|
|
|
|
2015-12-20 05:38:06 +00:00
|
|
|
.if ${KYUAFILE:tl} != "no"
|
2016-05-04 23:20:53 +00:00
|
|
|
${PACKAGE}FILES+= Kyuafile
|
|
|
|
${PACKAGE}FILESDIR_Kyuafile= ${TESTSDIR}
|
2015-12-20 05:38:06 +00:00
|
|
|
.endif
|
2014-03-14 12:52:55 +00:00
|
|
|
|
2015-07-04 02:37:36 +00:00
|
|
|
.for _T in ${_TESTS}
|
|
|
|
_TEST_METADATA.${_T}= ${TEST_METADATA} ${TEST_METADATA.${_T}}
|
|
|
|
.endfor
|
|
|
|
|
2015-12-20 05:41:12 +00:00
|
|
|
.if ${KYUAFILE:tl} == "auto"
|
2016-02-07 18:40:04 +00:00
|
|
|
CLEANFILES+= Kyuafile Kyuafile.tmp
|
2015-12-20 05:38:06 +00:00
|
|
|
Kyuafile: Makefile
|
2014-03-14 12:52:55 +00:00
|
|
|
@{ \
|
|
|
|
echo '-- Automatically generated by bsd.test.mk.'; \
|
|
|
|
echo; \
|
|
|
|
echo 'syntax(2)'; \
|
|
|
|
echo; \
|
|
|
|
echo 'test_suite("${TESTSUITE}")'; \
|
|
|
|
echo; \
|
2015-12-20 05:38:06 +00:00
|
|
|
} > ${.TARGET}.tmp
|
2014-03-14 12:52:55 +00:00
|
|
|
.for _T in ${_TESTS}
|
2015-07-04 02:37:36 +00:00
|
|
|
@echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${_TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \
|
2015-12-20 05:38:06 +00:00
|
|
|
>>${.TARGET}.tmp
|
2014-03-14 12:52:55 +00:00
|
|
|
.endfor
|
|
|
|
.for _T in ${TESTS_SUBDIRS:N.WAIT}
|
2015-12-20 06:01:53 +00:00
|
|
|
@echo "include(\"${_T}/${.TARGET}\")" >>${.TARGET}.tmp
|
2014-03-14 12:52:55 +00:00
|
|
|
.endfor
|
2015-12-20 05:38:06 +00:00
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
2014-03-14 12:52:55 +00:00
|
|
|
.endif
|
|
|
|
|
2016-02-07 18:40:04 +00:00
|
|
|
CHECKDIR?= ${DESTDIR}${TESTSDIR}
|
|
|
|
|
2015-12-20 06:26:15 +00:00
|
|
|
KYUA= ${LOCALBASE}/bin/kyua
|
2016-02-07 18:40:04 +00:00
|
|
|
|
|
|
|
# Definition of the "make check" target and supporting variables.
|
2014-03-14 12:52:55 +00:00
|
|
|
#
|
|
|
|
# This target, by necessity, can only work for native builds (i.e. a FreeBSD
|
|
|
|
# host building a release for the same system). The target runs Kyua, which is
|
|
|
|
# not in the toolchain, and the tests execute code built for the target host.
|
|
|
|
#
|
|
|
|
# Due to the dependencies of the binaries built by the source tree and how they
|
|
|
|
# are used by tests, it is highly possible for a execution of "make test" to
|
|
|
|
# report bogus results unless the new binaries are put in place.
|
|
|
|
|
2016-02-07 18:40:04 +00:00
|
|
|
realcheck: .PHONY
|
|
|
|
@if [ ! -x ${KYUA} ]; then \
|
|
|
|
echo; \
|
|
|
|
echo "kyua binary not installed at expected location (${.TARGET})"; \
|
|
|
|
echo; \
|
|
|
|
echo "Please install via pkg install, or specify the path to the kyua"; \
|
|
|
|
echo "package via the \$${LOCALBASE} variable, e.g. "; \
|
|
|
|
echo "LOCALBASE=\"${LOCALBASE}\""; \
|
|
|
|
false; \
|
|
|
|
fi
|
|
|
|
@${KYUA} test -k ${CHECKDIR}/Kyuafile
|