Changeset View
Changeset View
Standalone View
Standalone View
share/mk/suite.test.mk
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
# unqualified TEST_METADATA variable. | # unqualified TEST_METADATA variable. | ||||
#TEST_METADATA.<test-program>+= key="value" | #TEST_METADATA.<test-program>+= key="value" | ||||
.if ${KYUAFILE:tl} != "no" | .if ${KYUAFILE:tl} != "no" | ||||
FILES+= Kyuafile | FILES+= Kyuafile | ||||
FILESDIR_Kyuafile= ${TESTSDIR} | FILESDIR_Kyuafile= ${TESTSDIR} | ||||
.endif | .endif | ||||
.if ${KYUAFILE:tl} == "auto" | |||||
CLEANFILES+= Kyuafile Kyuafile.tmp | |||||
.endif | |||||
.for _T in ${_TESTS} | .for _T in ${_TESTS} | ||||
_TEST_METADATA.${_T}= ${TEST_METADATA} ${TEST_METADATA.${_T}} | _TEST_METADATA.${_T}= ${TEST_METADATA} ${TEST_METADATA.${_T}} | ||||
.endfor | .endfor | ||||
.if ${KYUAFILE:tl} == "auto" | .if ${KYUAFILE:tl} == "auto" | ||||
CLEANFILES+= Kyuafile Kyuafile.tmp | |||||
Kyuafile: Makefile | Kyuafile: Makefile | ||||
ngie: I think .NOPATH breaks tinderbox. Need to remove and retest. | |||||
@{ \ | @{ \ | ||||
echo '-- Automatically generated by bsd.test.mk.'; \ | echo '-- Automatically generated by bsd.test.mk.'; \ | ||||
echo; \ | echo; \ | ||||
echo 'syntax(2)'; \ | echo 'syntax(2)'; \ | ||||
echo; \ | echo; \ | ||||
echo 'test_suite("${TESTSUITE}")'; \ | echo 'test_suite("${TESTSUITE}")'; \ | ||||
echo; \ | echo; \ | ||||
} > ${.TARGET}.tmp | } > ${.TARGET}.tmp | ||||
.for _T in ${_TESTS} | .for _T in ${_TESTS} | ||||
@echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${_TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \ | @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${_TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \ | ||||
>>${.TARGET}.tmp | >>${.TARGET}.tmp | ||||
.endfor | .endfor | ||||
.for _T in ${TESTS_SUBDIRS:N.WAIT} | .for _T in ${TESTS_SUBDIRS:N.WAIT} | ||||
@echo "include(\"${_T}/${.TARGET}\")" >>${.TARGET}.tmp | @echo "include(\"${_T}/${.TARGET}\")" >>${.TARGET}.tmp | ||||
.endfor | .endfor | ||||
@mv ${.TARGET}.tmp ${.TARGET} | @mv ${.TARGET}.tmp ${.TARGET} | ||||
Done Inline ActionsI'd be fine with these cleanups going in first emaste: I'd be fine with these cleanups going in first | |||||
.endif | .endif | ||||
CHECKDIR?= ${DESTDIR}${TESTSDIR} | |||||
KYUA= ${LOCALBASE}/bin/kyua | KYUA= ${LOCALBASE}/bin/kyua | ||||
.if exists(${KYUA}) | |||||
# Definition of the "make test" target and supporting variables. | # Definition of the "make check" target and supporting variables. | ||||
# | # | ||||
# This target, by necessity, can only work for native builds (i.e. a FreeBSD | # 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 | # 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. | # 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 | # 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 | # 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. | # 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 | |||||
@${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile; \ | |||||
result=0; \ | |||||
echo; \ | |||||
echo "*** Once again, note that "make test" is unsupported."; \ | |||||
test $${result} -eq 0 | |||||
.endif | |||||
Done Inline Actionsthis seems strange to me, I'd expect a if [ ! -x ${LOCALBASE}/bin/kyua ] type test in the intended target instead emaste: this seems strange to me, I'd expect a `if [ ! -x ${LOCALBASE}/bin/kyua ]` type test in the… | |||||
Done Inline ActionsYeah, you're right. There might be some unintended side effects of doing it this way, so I'll do an inline if statement instead. ngie: Yeah, you're right. There might be some unintended side effects of doing it this way, so I'll… | |||||
beforetest: .PHONY | realcheck: .PHONY | ||||
.if defined(TESTSDIR) | @if [ ! -x ${KYUA} ]; then \ | ||||
.if ${TESTSDIR} == ${TESTSBASE} | echo; \ | ||||
# Forbid running from ${TESTSBASE}. It can cause false positives/negatives and | echo "kyua binary not installed at expected location (${.TARGET})"; \ | ||||
# it does not cover all the tests (e.g. it misses testing software in external). | echo; \ | ||||
@echo "*** Sorry, you cannot use make test from src/tests. Install the" | echo "Please install via pkg install, or specify the path to the kyua"; \ | ||||
@echo "*** tests into their final location and run them from ${TESTSBASE}" | echo "package via the \$${LOCALBASE} variable, e.g. "; \ | ||||
@false | echo "LOCALBASE=\"${LOCALBASE}\""; \ | ||||
.else | false; \ | ||||
@echo "*** Using this test does not preclude you from running the tests" | fi | ||||
@echo "*** installed in ${TESTSBASE}. This test run may raise false" | @${KYUA} test -k ${CHECKDIR}/Kyuafile | ||||
@echo "*** positives and/or false negatives." | |||||
.endif | |||||
.else | |||||
@echo "*** No TESTSDIR defined; nothing to do." | |||||
@false | |||||
.endif | |||||
@echo |
I think .NOPATH breaks tinderbox. Need to remove and retest.