Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Mar 2014 12:52:55 +0000 (UTC)
From:      Julio Merino <jmmv@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r263172 - head/share/mk
Message-ID:  <201403141252.s2ECqtL0086081@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmmv
Date: Fri Mar 14 12:52:55 2014
New Revision: 263172
URL: http://svnweb.freebsd.org/changeset/base/263172

Log:
  Move FreeBSD Test Suite-specific code to a suite.test.mk file.
  
  The new suite.test.mk file contains all the logic needed to install test
  programs under /usr/tests/ and to support Kyua as the run-time engine.
  This file is included by default by bsd.test.mk so Makefiles do not need
  to care about its existence.
  
  Specific Makefiles can define NOT_FOR_TEST_SUITE to indicate that whatever
  test programs they are building are not supposed to be installed under
  /usr/tests/ nor run by Kyua.  (The effect of passing this setting is that
  suite.test.mk is simply not included.)
  
  NOT_FOR_TEST_SUITE should never be used by Makefiles in the base system.
  This functionality is provided so that third-parties can hook in their
  own test code, with different semantics, if they wish.  This was asked
  for by sjg@.

Added:
  head/share/mk/suite.test.mk   (contents, props changed)
Modified:
  head/share/mk/Makefile
  head/share/mk/bsd.test.mk

Modified: head/share/mk/Makefile
==============================================================================
--- head/share/mk/Makefile	Fri Mar 14 12:42:30 2014	(r263171)
+++ head/share/mk/Makefile	Fri Mar 14 12:52:55 2014	(r263172)
@@ -46,6 +46,7 @@ FILESDIR=	${BINDIR}/mk
 .if ${MK_TESTS} != "no"
 FILES+=	atf.test.mk
 FILES+=	plain.test.mk
+FILES+=	suite.test.mk
 FILES+=	tap.test.mk
 .endif
 

Modified: head/share/mk/bsd.test.mk
==============================================================================
--- head/share/mk/bsd.test.mk	Fri Mar 14 12:42:30 2014	(r263171)
+++ head/share/mk/bsd.test.mk	Fri Mar 14 12:52:55 2014	(r263172)
@@ -10,14 +10,6 @@
 
 __<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?= .
-
-# Name of the test suite these tests belong to.  Should rarely be changed for
-# Makefiles built into the FreeBSD src tree.
-TESTSUITE?= FreeBSD
-
 # List of subdirectories containing tests into which to recurse.  This has the
 # same semantics as SUBDIR at build-time.  However, the directories listed here
 # get registered into the run-time test suite definitions so that the test
@@ -27,31 +19,10 @@ TESTSUITE?= FreeBSD
 # SUBDIR for directories that may contain helper binaries and/or data files.
 TESTS_SUBDIRS?=
 
-# Knob to control the handling of the Kyuafile for this Makefile.
-#
-# If 'yes', a Kyuafile exists in the source tree and is installed into
-# TESTSDIR.
-#
-# If 'auto', a Kyuafile is automatically generated based on the list of test
-# programs built by the Makefile and is installed into TESTSDIR.  This is the
-# default and is sufficient in the majority of the cases.
-#
-# If 'no', no Kyuafile is installed.
-KYUAFILE?= auto
-
-# Per-test program interface definition.
-#
-# The name provided here must match one of the interface names supported by
-# Kyua as this is later encoded in the Kyuafile test program definitions.
-#TEST_INTERFACE.<test-program>= interface-name
-
-# 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.
-#TEST_METADATA.<test-program>+= key="value"
+# If defined, indicates that the tests built by the Makefile are not part of
+# the FreeBSD Test Suite.  The implication of this is that the tests won't be
+# installed under /usr/tests/ and that Kyua won't be able to run them.
+#NOT_FOR_TEST_SUITE=
 
 # List of variables to pass to the tests at run-time via the environment.
 TESTS_ENV?=
@@ -65,13 +36,6 @@ TESTS_ENV+= PATH=${TESTS_PATH:tW:C/ +/:/
 TESTS_LD_LIBRARY_PATH+= ${DESTDIR}/lib ${DESTDIR}/usr/lib
 TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:C/ +/:/g}
 
-# 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
-
 # List of all tests being built.  The various *.test.mk modules extend this
 # variable as needed.
 _TESTS=
@@ -95,82 +59,9 @@ WITHOUT_MAN=yes
 PROG_VARS+= BINDIR
 PROGS_TARGETS+= install
 
-.if ${KYUAFILE:tl} == "yes"
-FILES+=	Kyuafile
-FILESDIR_Kyuafile= ${TESTSDIR}
-
-CLEANFILES+= Kyuafile.auto Kyuafile.auto.tmp
-.elif ${KYUAFILE:tl} == "auto"
-FILES+=	Kyuafile.auto
-FILESDIR_Kyuafile.auto= ${TESTSDIR}
-FILESNAME_Kyuafile.auto= Kyuafile
-
-CLEANFILES+= Kyuafile.auto Kyuafile.auto.tmp
-
-.NOPATH: Kyuafile.auto
-Kyuafile.auto: Makefile
-	@{ \
-	    echo '-- Automatically generated by bsd.test.mk.'; \
-	    echo; \
-	    echo 'syntax(2)'; \
-	    echo; \
-	    echo 'test_suite("${TESTSUITE}")'; \
-            echo; \
-	} >Kyuafile.auto.tmp
-.for _T in ${_TESTS}
-	@echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \
-	    >>Kyuafile.auto.tmp
-.endfor
-.for _T in ${TESTS_SUBDIRS:N.WAIT}
-	@echo "include(\"${_T}/Kyuafile\")" >>Kyuafile.auto.tmp
-.endfor
-	@mv Kyuafile.auto.tmp Kyuafile.auto
-.endif
-
-KYUA?= ${KYUA_PREFIX}/bin/kyua
-.if exists(${KYUA})
-# Definition of the "make test" 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
-# 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
-# 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
+.if !defined(NOT_FOR_TEST_SUITE)
+.include <suite.test.mk>
 .endif
-	@echo
 
 .if !target(realtest)
 realtest: .PHONY

Added: head/share/mk/suite.test.mk
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/mk/suite.test.mk	Fri Mar 14 12:52:55 2014	(r263172)
@@ -0,0 +1,127 @@
+# $FreeBSD$
+#
+# You must include bsd.test.mk instead of this file from your Makefile.
+#
+# Internal glue for the build of /usr/tests/.
+
+.if !target(__<bsd.test.mk>__)
+.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 FreeBSD src tree.
+TESTSUITE?= FreeBSD
+
+# Knob to control the handling of the Kyuafile for this Makefile.
+#
+# If 'yes', a Kyuafile exists in the source tree and is installed into
+# TESTSDIR.
+#
+# If 'auto', a Kyuafile is automatically generated based on the list of test
+# programs built by the Makefile and is installed into TESTSDIR.  This is the
+# default and is sufficient in the majority of the cases.
+#
+# If 'no', no Kyuafile is installed.
+KYUAFILE?= auto
+
+# Per-test program interface definition.
+#
+# The name provided here must match one of the interface names supported by
+# Kyua as this is later encoded in the Kyuafile test program definitions.
+#TEST_INTERFACE.<test-program>= interface-name
+
+# 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.
+#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"
+FILES+=	Kyuafile
+FILESDIR_Kyuafile= ${TESTSDIR}
+
+CLEANFILES+= Kyuafile.auto Kyuafile.auto.tmp
+.elif ${KYUAFILE:tl} == "auto"
+FILES+=	Kyuafile.auto
+FILESDIR_Kyuafile.auto= ${TESTSDIR}
+FILESNAME_Kyuafile.auto= Kyuafile
+
+CLEANFILES+= Kyuafile.auto Kyuafile.auto.tmp
+
+.NOPATH: Kyuafile.auto
+Kyuafile.auto: Makefile
+	@{ \
+	    echo '-- Automatically generated by bsd.test.mk.'; \
+	    echo; \
+	    echo 'syntax(2)'; \
+	    echo; \
+	    echo 'test_suite("${TESTSUITE}")'; \
+            echo; \
+	} >Kyuafile.auto.tmp
+.for _T in ${_TESTS}
+	@echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \
+	    >>Kyuafile.auto.tmp
+.endfor
+.for _T in ${TESTS_SUBDIRS:N.WAIT}
+	@echo "include(\"${_T}/Kyuafile\")" >>Kyuafile.auto.tmp
+.endfor
+	@mv Kyuafile.auto.tmp Kyuafile.auto
+.endif
+
+KYUA?= ${KYUA_PREFIX}/bin/kyua
+.if exists(${KYUA})
+# Definition of the "make test" 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
+# 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
+# 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403141252.s2ECqtL0086081>