[Midnightbsd-cvs] src [10261] trunk/share/mk/suite.test.mk: update suite tests config

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 2 18:03:31 EDT 2018


Revision: 10261
          http://svnweb.midnightbsd.org/src/?rev=10261
Author:   laffer1
Date:     2018-06-02 18:03:31 -0400 (Sat, 02 Jun 2018)
Log Message:
-----------
update suite tests config

Modified Paths:
--------------
    trunk/share/mk/suite.test.mk

Modified: trunk/share/mk/suite.test.mk
===================================================================
--- trunk/share/mk/suite.test.mk	2018-06-02 22:02:23 UTC (rev 10260)
+++ trunk/share/mk/suite.test.mk	2018-06-02 22:03:31 UTC (rev 10261)
@@ -1,5 +1,5 @@
 # $MidnightBSD$
-# $FreeBSD: stable/10/share/mk/suite.test.mk 289050 2015-10-08 19:10:51Z bdrewery $
+# $FreeBSD: stable/10/share/mk/suite.test.mk 313792 2017-02-16 05:22:08Z ngie $
 #
 # You must include bsd.test.mk instead of this file from your Makefile.
 #
@@ -9,10 +9,6 @@
 .error suite.test.mk cannot be included directly.
 .endif
 
-# Directory in which to install tests defined by the current Makefile.
-# Makefiles have to override this to point to a subdirectory of TESTSBASE.
-TESTSDIR?= .
-
 # Name of the test suite these tests belong to.  Should rarely be changed for
 # Makefiles built into the MidnightBSD src tree.
 TESTSUITE?= MidnightBSD
@@ -35,35 +31,33 @@
 # 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"
 
-# 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 ${KYUAFILE:tl} == "yes"
+.if ${KYUAFILE:tl} != "no"
 FILES+=	Kyuafile
 FILESDIR_Kyuafile= ${TESTSDIR}
+.endif
 
-CLEANFILES+= Kyuafile.auto Kyuafile.auto.tmp
-.elif ${KYUAFILE:tl} == "auto"
-FILES+=	Kyuafile.auto
-FILESDIR_Kyuafile.auto= ${TESTSDIR}
-FILESNAME_Kyuafile.auto= Kyuafile
+.for _T in ${_TESTS}
+_TEST_METADATA.${_T}= ${TEST_METADATA} ${TEST_METADATA.${_T}}
+.endfor
 
-CLEANFILES+= Kyuafile.auto Kyuafile.auto.tmp
-
-.NOPATH: Kyuafile.auto
-Kyuafile.auto: Makefile
+.if ${KYUAFILE:tl} == "auto"
+CLEANFILES+= Kyuafile Kyuafile.tmp
+Kyuafile: Makefile
 	@{ \
 	    echo '-- Automatically generated by bsd.test.mk.'; \
 	    echo; \
@@ -71,25 +65,27 @@
 	    echo; \
 	    echo 'test_suite("${TESTSUITE}")'; \
             echo; \
-	} >Kyuafile.auto.tmp
+	} > ${.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}}' \
-	    >>Kyuafile.auto.tmp
+	@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}
-	@echo "include(\"${_T}/Kyuafile\")" >>Kyuafile.auto.tmp
+	@echo "include(\"${_T}/${.TARGET}\")" >>${.TARGET}.tmp
 .endfor
-	@mv Kyuafile.auto.tmp Kyuafile.auto
+	@mv ${.TARGET}.tmp ${.TARGET}
 .endif
 
-KYUA?= ${KYUA_PREFIX}/bin/kyua
-.if exists(${KYUA})
-# Definition of the "make test" target and supporting variables.
+CHECKDIR?=	${DESTDIR}${TESTSDIR}
+
+KYUA= ${LOCALBASE}/bin/kyua
+
+# Definition of the "make check" target and supporting variables.
 #
 # This target, by necessity, can only work for native builds (i.e. a MidnightBSD
 # host building a release for the same system).  The target runs Kyua, which is
@@ -98,36 +94,15 @@
 # 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



More information about the Midnightbsd-cvs mailing list