summaryrefslogtreecommitdiffstats
path: root/share/mk/suite.test.mk
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk/suite.test.mk')
-rw-r--r--share/mk/suite.test.mk77
1 files changed, 33 insertions, 44 deletions
diff --git a/share/mk/suite.test.mk b/share/mk/suite.test.mk
index 0d48950..90e1687 100644
--- a/share/mk/suite.test.mk
+++ b/share/mk/suite.test.mk
@@ -30,12 +30,19 @@ KYUAFILE?= auto
# Kyua as this is later encoded in the Kyuafile test program definitions.
#TEST_INTERFACE.<test-program>= interface-name
+# 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"
+
# Per-test program metadata properties as a list of key/value pairs.
#
-# All the variables for a particular program are appended to the 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.
+# These per-test program settings _extend_ the values provided in the
+# unqualified TEST_METADATA variable.
#TEST_METADATA.<test-program>+= key="value"
.if ${KYUAFILE:tl} != "no"
@@ -43,11 +50,12 @@ FILES+= Kyuafile
FILESDIR_Kyuafile= ${TESTSDIR}
.endif
-.if ${KYUAFILE:tl} == "auto"
-CLEANFILES+= Kyuafile Kyuafile.tmp
-.endif
+.for _T in ${_TESTS}
+_TEST_METADATA.${_T}= ${TEST_METADATA} ${TEST_METADATA.${_T}}
+.endfor
.if ${KYUAFILE:tl} == "auto"
+CLEANFILES+= Kyuafile Kyuafile.tmp
Kyuafile: Makefile
@{ \
echo '-- Automatically generated by bsd.test.mk.'; \
@@ -59,11 +67,11 @@ Kyuafile: Makefile
} > ${.TARGET}.tmp
.for _T in ${_TESTS}
.if defined(.PARSEDIR)
- @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
.else
- @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/^/, /:Q:S/\\ ,/,/g:S,\\,,g}}' \
- >>Kyuafile.auto.tmp
+ @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${_TEST_METADATA.${_T}:C/^/, /:Q:S/\\ ,/,/g:S,\\,,g}}' \
+ >>${.TARGET}.tmp
.endif
.endfor
.for _T in ${TESTS_SUBDIRS:N.WAIT}
@@ -72,9 +80,11 @@ Kyuafile: Makefile
@mv ${.TARGET}.tmp ${.TARGET}
.endif
+CHECKDIR?= ${DESTDIR}${TESTSDIR}
+
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
# host building a release for the same system). The target runs Kyua, which is
@@ -83,36 +93,15 @@ KYUA= ${LOCALBASE}/bin/kyua
# 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}
-# 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
+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
OpenPOWER on IntegriCloud