Plug kyua into the 'test' target.

If kyua exists in KYUA_PREFIX, the test target is automatically
defined to use it for the execution of test programs.

Submitted by:	Julio Merino jmmv google.com
MFC after:	2 weeks
This commit is contained in:
Rui Paulo 2013-10-19 06:52:06 +00:00
parent 30cc088dc0
commit 7bb2d4b324
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=256765

View File

@ -62,6 +62,13 @@ TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:C/ +/:/g}
# as needed.
_TESTS?=
# Path to the prefix of the installed Kyua CLI, if any.
#
# If kyua is installed from ports, we automatically define a realtest target
# below to run the tests using this tool. The tools are searched for in the
# hierarchy specified by this variable.
KYUA_PREFIX?= /usr/local
.if !empty(TESTS_SUBDIRS)
SUBDIR+= ${TESTS_SUBDIRS}
.endif
@ -103,6 +110,32 @@ Kyuafile: Makefile
.endif
.endif
KYUA?= ${KYUA_PREFIX}/bin/kyua
.if exists(${KYUA})
# Definition of the "make test" target and supporting variables.
#
# 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.
realtest: .PHONY
@echo "*** WARNING: make test is experimental"
@echo "***"
@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."
@echo
@set -e; \
${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile; \
result=0; \
echo; \
echo "*** Once again, note that "make test" is unsupported."; \
test $${result} -eq 0
.endif
beforetest: .PHONY
.if defined(TESTSDIR)
.if ${TESTSDIR} == ${TESTSBASE}