3 # You must include bsd.test.mk instead of this file from your Makefile.
5 # Internal glue for the build of /usr/tests/.
7 .if !target(__<bsd.test.mk>__)
8 .error suite.test.mk cannot be included directly.
11 # Name of the test suite these tests belong to. Should rarely be changed for
12 # Makefiles built into the FreeBSD src tree.
15 # Knob to control the handling of the Kyuafile for this Makefile.
17 # If 'yes', a Kyuafile exists in the source tree and is installed into
20 # If 'auto', a Kyuafile is automatically generated based on the list of test
21 # programs built by the Makefile and is installed into TESTSDIR. This is the
22 # default and is sufficient in the majority of the cases.
24 # If 'no', no Kyuafile is installed.
27 # Per-test program interface definition.
29 # The name provided here must match one of the interface names supported by
30 # Kyua as this is later encoded in the Kyuafile test program definitions.
31 #TEST_INTERFACE.<test-program>= interface-name
33 # Per-test program metadata properties as a list of key/value pairs.
35 # All the variables for a particular program are appended to the program's
36 # definition in the Kyuafile. This feature can be used to avoid having to
37 # explicitly supply a Kyuafile in the source directory, allowing the caller
38 # Makefile to rely on the KYUAFILE=auto behavior defined here.
39 #TEST_METADATA.<test-program>+= key="value"
41 .if ${KYUAFILE:tl} != "no"
43 FILESDIR_Kyuafile= ${TESTSDIR}
46 .if ${KYUAFILE:tl} == "auto"
47 CLEANFILES+= Kyuafile Kyuafile.tmp
50 .if ${KYUAFILE:tl} == "auto"
53 echo '-- Automatically generated by bsd.test.mk.'; \
57 echo 'test_suite("${TESTSUITE}")'; \
61 .if defined(.PARSEDIR)
62 @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \
65 @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/^/, /:Q:S/\\ ,/,/g:S,\\,,g}}' \
69 .for _T in ${TESTS_SUBDIRS:N.WAIT}
70 @echo "include(\"${_T}/${.TARGET}\")" >>${.TARGET}.tmp
72 @mv ${.TARGET}.tmp ${.TARGET}
75 KYUA= ${LOCALBASE}/bin/kyua
77 # Definition of the "make test" target and supporting variables.
79 # This target, by necessity, can only work for native builds (i.e. a FreeBSD
80 # host building a release for the same system). The target runs Kyua, which is
81 # not in the toolchain, and the tests execute code built for the target host.
83 # Due to the dependencies of the binaries built by the source tree and how they
84 # are used by tests, it is highly possible for a execution of "make test" to
85 # report bogus results unless the new binaries are put in place.
87 @echo "*** WARNING: make test is experimental"
89 @echo "*** Using this test does not preclude you from running the tests"
90 @echo "*** installed in ${TESTSBASE}. This test run may raise false"
91 @echo "*** positives and/or false negatives."
94 ${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile; \
97 echo "*** Once again, note that "make test" is unsupported."; \
102 .if defined(TESTSDIR)
103 .if ${TESTSDIR} == ${TESTSBASE}
104 # Forbid running from ${TESTSBASE}. It can cause false positives/negatives and
105 # it does not cover all the tests (e.g. it misses testing software in external).
106 @echo "*** Sorry, you cannot use make test from src/tests. Install the"
107 @echo "*** tests into their final location and run them from ${TESTSBASE}"
110 @echo "*** Using this test does not preclude you from running the tests"
111 @echo "*** installed in ${TESTSBASE}. This test run may raise false"
112 @echo "*** positives and/or false negatives."
115 @echo "*** No TESTSDIR defined; nothing to do."