summaryrefslogtreecommitdiffstats
path: root/share/mk
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/atf.test.mk8
-rw-r--r--share/mk/bsd.test.mk26
-rw-r--r--share/mk/plain.test.mk8
-rw-r--r--share/mk/tap.test.mk8
4 files changed, 29 insertions, 21 deletions
diff --git a/share/mk/atf.test.mk b/share/mk/atf.test.mk
index 3ffb2cb..1be7244 100644
--- a/share/mk/atf.test.mk
+++ b/share/mk/atf.test.mk
@@ -1,9 +1,13 @@
# $FreeBSD$
#
+# You must include bsd.test.mk instead of this file from your Makefile.
+#
# Logic to build and install ATF test programs; i.e. test programs linked
# against the ATF libraries.
-.include <bsd.init.mk>
+.if !target(__<bsd.test.mk>__)
+.error atf.test.mk cannot be included directly.
+.endif
# List of C, C++ and shell test programs to build.
#
@@ -164,5 +168,3 @@ realtest: .PHONY
.endif
.endif
-
-.include <bsd.test.mk>
diff --git a/share/mk/bsd.test.mk b/share/mk/bsd.test.mk
index ee96f77..94b22b1 100644
--- a/share/mk/bsd.test.mk
+++ b/share/mk/bsd.test.mk
@@ -2,16 +2,14 @@
#
# Generic build infrastructure for test programs.
#
-# The code in this file is independent of the implementation of the test
-# programs being built; this file just provides generic infrastructure for the
-# build and the definition of various helper variables and targets.
-#
-# Makefiles should never include this file directly. Instead, they should
-# include one of the various *.test.mk depending on the specific test programs
-# being built.
+# This is the only public file that should be included by Makefiles when
+# tests are to be built. All other *.test.mk files are internal and not
+# to be included directly.
.include <bsd.init.mk>
+__<bsd.test.mk>__:
+
# Directory in which to install tests defined by the current Makefile.
# Makefiles have to override this to point to a subdirectory of TESTSBASE.
TESTSDIR?= .
@@ -67,11 +65,6 @@ TESTS_ENV+= PATH=${TESTS_PATH:tW:C/ +/:/g}
TESTS_LD_LIBRARY_PATH+= ${DESTDIR}/lib ${DESTDIR}/usr/lib
TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:C/ +/:/g}
-# List of all tests being built. This variable is internal should not be
-# defined by the Makefile. The various *.test.mk modules extend this variable
-# 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
@@ -79,6 +72,15 @@ _TESTS?=
# hierarchy specified by this variable.
KYUA_PREFIX?= /usr/local
+# List of all tests being built. The various *.test.mk modules extend this
+# variable as needed.
+_TESTS=
+
+# Pull in the definitions of all supported test interfaces.
+.include <atf.test.mk>
+.include <plain.test.mk>
+.include <tap.test.mk>
+
.if !empty(TESTS_SUBDIRS)
SUBDIR+= ${TESTS_SUBDIRS}
.endif
diff --git a/share/mk/plain.test.mk b/share/mk/plain.test.mk
index 2e2752d..99685ef 100644
--- a/share/mk/plain.test.mk
+++ b/share/mk/plain.test.mk
@@ -1,10 +1,14 @@
# $FreeBSD$
#
+# You must include bsd.test.mk instead of this file from your Makefile.
+#
# Logic to build and install plain test programs. A plain test programs it not
# supposed to use any specific testing framework: all it does is run some code
# and report the test's pass or fail status via a 0 or 1 exit code.
-.include <bsd.init.mk>
+.if !target(__<bsd.test.mk>__)
+.error plain.test.mk cannot be included directly.
+.endif
# List of C, C++ and shell test programs to build.
#
@@ -58,5 +62,3 @@ ${_T}: ${PLAIN_TESTS_SH_SRC_${_T}}
mv ${.TARGET}.tmp ${.TARGET}
.endfor
.endif
-
-.include <bsd.test.mk>
diff --git a/share/mk/tap.test.mk b/share/mk/tap.test.mk
index 9c1ef54..4c05661 100644
--- a/share/mk/tap.test.mk
+++ b/share/mk/tap.test.mk
@@ -1,12 +1,16 @@
# $FreeBSD$
#
+# You must include bsd.test.mk instead of this file from your Makefile.
+#
# Logic to build and install TAP-compliant test programs.
#
# This is provided to support existing tests in the FreeBSD source tree
# (particularly those coming from tools/regression/) that comply with the
# Test Anything Protocol. It should not be used for new tests.
-.include <bsd.init.mk>
+.if !target(__<bsd.test.mk>__)
+.error tap.test.mk cannot be included directly.
+.endif
# List of C, C++ and shell test programs to build.
#
@@ -87,5 +91,3 @@ ${_T}: ${TAP_TESTS_SH_SRC_${_T}}
mv ${.TARGET}.tmp ${.TARGET}
.endfor
.endif
-
-.include <bsd.test.mk>
OpenPOWER on IntegriCloud