Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Mar 2014 08:56:20 +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: r263161 - in head: bin/date/tests bin/mv/tests bin/pax/tests bin/sh/tests bin/test/tests lib/atf/libatf-c++/tests lib/atf/libatf-c++/tests/detail lib/atf/libatf-c/tests lib/atf/libatf-c...
Message-ID:  <201403140856.s2E8uKQQ085804@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmmv
Date: Fri Mar 14 08:56:19 2014
New Revision: 263161
URL: http://svnweb.freebsd.org/changeset/base/263161

Log:
  Make bsd.test.mk the only public mk fragment for the building of tests.
  
  Change {atf,plain,tap}.test.mk to be internal implementation details of
  bsd.test.mk.  Makefiles that build tests should now only include bsd.test.mk
  and declaratively specify what they want to build, without worrying about
  the internal implementation of the mk files.
  
  The reason for this change is to permit building test programs of different
  interfaces from a single directory, which is something I had a need for
  while porting tests over from src/tools/regression/.
  
  Additionally, this change makes it possible to perform some other requested
  changes to bsd.test.mk in an easier manner.  Coming soon.

Modified:
  head/bin/date/tests/Makefile
  head/bin/mv/tests/Makefile
  head/bin/pax/tests/Makefile
  head/bin/sh/tests/Makefile
  head/bin/test/tests/Makefile
  head/lib/atf/libatf-c++/tests/Makefile
  head/lib/atf/libatf-c++/tests/detail/Makefile
  head/lib/atf/libatf-c/tests/Makefile
  head/lib/atf/libatf-c/tests/detail/Makefile
  head/lib/atf/tests/test-programs/Makefile
  head/lib/libcrypt/tests/Makefile
  head/libexec/atf/atf-check/tests/Makefile
  head/share/examples/tests/tests/atf/Makefile
  head/share/examples/tests/tests/plain/Makefile
  head/share/mk/atf.test.mk
  head/share/mk/bsd.test.mk
  head/share/mk/plain.test.mk
  head/share/mk/tap.test.mk
  head/tests/sys/kern/Makefile
  head/usr.bin/atf/atf-sh/tests/Makefile

Modified: head/bin/date/tests/Makefile
==============================================================================
--- head/bin/date/tests/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/bin/date/tests/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -6,4 +6,4 @@ TESTSDIR=	${TESTSBASE}/bin/date
 
 TAP_TESTS_SH=	legacy_test
 
-.include <tap.test.mk>
+.include <bsd.test.mk>

Modified: head/bin/mv/tests/Makefile
==============================================================================
--- head/bin/mv/tests/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/bin/mv/tests/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -6,4 +6,4 @@ TESTSDIR=	${TESTSBASE}/bin/mv
 
 TAP_TESTS_SH=	legacy_test
 
-.include <tap.test.mk>
+.include <bsd.test.mk>

Modified: head/bin/pax/tests/Makefile
==============================================================================
--- head/bin/pax/tests/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/bin/pax/tests/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -6,4 +6,4 @@ TESTSDIR=	${TESTSBASE}/bin/pax
 
 TAP_TESTS_PERL=	legacy_test
 
-.include <tap.test.mk>
+.include <bsd.test.mk>

Modified: head/bin/sh/tests/Makefile
==============================================================================
--- head/bin/sh/tests/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/bin/sh/tests/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -15,4 +15,4 @@ TEST_METADATA.legacy_test+= required_use
 
 SUBDIR+=	builtins errors execution expansion parameters parser set-e
 
-.include <tap.test.mk>
+.include <bsd.test.mk>

Modified: head/bin/test/tests/Makefile
==============================================================================
--- head/bin/test/tests/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/bin/test/tests/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -12,4 +12,4 @@ TAP_TESTS_SH=	legacy_test
 # requested.  See https://code.google.com/p/kyua/issues/detail?id=6
 TEST_METADATA.legacy_test+= required_user="unprivileged"
 
-.include <tap.test.mk>
+.include <bsd.test.mk>

Modified: head/lib/atf/libatf-c++/tests/Makefile
==============================================================================
--- head/lib/atf/libatf-c++/tests/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/lib/atf/libatf-c++/tests/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -28,4 +28,4 @@ SRCS.${_T}=	${_T}.cpp test_helpers.cpp
 
 ATF_TESTS_SH=	pkg_config_test
 
-.include <atf.test.mk>
+.include <bsd.test.mk>

Modified: head/lib/atf/libatf-c++/tests/detail/Makefile
==============================================================================
--- head/lib/atf/libatf-c++/tests/detail/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/lib/atf/libatf-c++/tests/detail/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -29,4 +29,4 @@ BINDIR.${p}=	${TESTSDIR}
 version_helper.o: atf-version
 
 .include "../../../common.mk"
-.include <atf.test.mk>
+.include <bsd.test.mk>

Modified: head/lib/atf/libatf-c/tests/Makefile
==============================================================================
--- head/lib/atf/libatf-c/tests/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/lib/atf/libatf-c/tests/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -35,4 +35,4 @@ SRCS.${_T}=	${_T}.c test_helpers.c
 
 ATF_TESTS_SH=	pkg_config_test
 
-.include <atf.test.mk>
+.include <bsd.test.mk>

Modified: head/lib/atf/libatf-c/tests/detail/Makefile
==============================================================================
--- head/lib/atf/libatf-c/tests/detail/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/lib/atf/libatf-c/tests/detail/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -31,4 +31,4 @@ BINDIR.${p}=	${TESTSDIR}
 version_helper.o: atf-version
 
 .include "../../../common.mk"
-.include <atf.test.mk>
+.include <bsd.test.mk>

Modified: head/lib/atf/tests/test-programs/Makefile
==============================================================================
--- head/lib/atf/tests/test-programs/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/lib/atf/tests/test-programs/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -21,4 +21,4 @@ ATF_TESTS_SH+=		${_T}
 ATF_TESTS_SH_SRC_${_T}=	common.sh ${_T}.sh
 .endfor
 
-.include <atf.test.mk>
+.include <bsd.test.mk>

Modified: head/lib/libcrypt/tests/Makefile
==============================================================================
--- head/lib/libcrypt/tests/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/lib/libcrypt/tests/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -9,4 +9,4 @@ ATF_TESTS_C= crypt_tests
 CFLAGS+= -I${.CURDIR:H}
 LDADD+= -L${.OBJDIR:H} -lcrypt
 
-.include <atf.test.mk>
+.include <bsd.test.mk>

Modified: head/libexec/atf/atf-check/tests/Makefile
==============================================================================
--- head/libexec/atf/atf-check/tests/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/libexec/atf/atf-check/tests/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -9,4 +9,4 @@ ATF=		${.CURDIR:H:H:H:H}/contrib/atf
 
 ATF_TESTS_SH=	atf-check_test
 
-.include <atf.test.mk>
+.include <bsd.test.mk>

Modified: head/share/examples/tests/tests/atf/Makefile
==============================================================================
--- head/share/examples/tests/tests/atf/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/share/examples/tests/tests/atf/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -27,4 +27,4 @@ ATF_TESTS_SH=	cp_test
 # definitions from above.
 KYUAFILE=	yes
 
-.include <atf.test.mk>
+.include <bsd.test.mk>

Modified: head/share/examples/tests/tests/plain/Makefile
==============================================================================
--- head/share/examples/tests/tests/plain/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/share/examples/tests/tests/plain/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -27,4 +27,4 @@ PLAIN_TESTS_SH=	cp_test
 # definitions from above.
 KYUAFILE=	yes
 
-.include <plain.test.mk>
+.include <bsd.test.mk>

Modified: head/share/mk/atf.test.mk
==============================================================================
--- head/share/mk/atf.test.mk	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/share/mk/atf.test.mk	Fri Mar 14 08:56:19 2014	(r263161)
@@ -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>

Modified: head/share/mk/bsd.test.mk
==============================================================================
--- head/share/mk/bsd.test.mk	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/share/mk/bsd.test.mk	Fri Mar 14 08:56:19 2014	(r263161)
@@ -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/ +/:/
 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

Modified: head/share/mk/plain.test.mk
==============================================================================
--- head/share/mk/plain.test.mk	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/share/mk/plain.test.mk	Fri Mar 14 08:56:19 2014	(r263161)
@@ -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>

Modified: head/share/mk/tap.test.mk
==============================================================================
--- head/share/mk/tap.test.mk	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/share/mk/tap.test.mk	Fri Mar 14 08:56:19 2014	(r263161)
@@ -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>

Modified: head/tests/sys/kern/Makefile
==============================================================================
--- head/tests/sys/kern/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/tests/sys/kern/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -10,4 +10,4 @@ LDADD.unix_seqpacket_test+=		-lpthread
 
 WARNS?=	5
 
-.include <atf.test.mk>
+.include <bsd.test.mk>

Modified: head/usr.bin/atf/atf-sh/tests/Makefile
==============================================================================
--- head/usr.bin/atf/atf-sh/tests/Makefile	Fri Mar 14 08:43:56 2014	(r263160)
+++ head/usr.bin/atf/atf-sh/tests/Makefile	Fri Mar 14 08:56:19 2014	(r263161)
@@ -23,4 +23,4 @@ misc_helpers: misc_helpers.sh
 	chmod +x ${.TARGET}.tmp
 	mv ${.TARGET}.tmp ${.TARGET}
 
-.include <atf.test.mk>
+.include <bsd.test.mk>



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