Date: Tue, 4 Mar 2014 19:27:21 -0500 From: Julio Merino <jmmv@freebsd.org> To: freebsd-testing@freebsd.org Subject: Merging *.test.mk into bsd.test.mk Message-ID: <20140305002721.GA1156@fbair.virtual.network>
next in thread | raw e-mail | index | archive | help
--yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello all, Having {atf,plain,tap}.test.mk is nice for modularity, but, in retrospect, it is not a good idea for these files to be user-facing. In a sense, these files are all internal implementation details of the glue code in bsd.test.mk. I am going to make bsd.test.mk the only publicly-visible mk fragment to control the build of tests. The behavior of this file should be determined by the declarative variables in the Makefile, not by what is being included. The main reason is that I'm now finding a situation where I'd like to build ATF and TAP test programs from a single directory. To do so, I'd need to include atf.test.mk and tap.test.mk simultaneously, both of which indirectly include bsd.test.mk. This, of course, causes trouble. Please see the attached patch (being tested now) for an idea of what this means. Anyone thinks this is a bad idea? Thanks! PS: This is a "prerequisite" to easily make all the Kyua-related code optional as some people have requested. But I'll provide more details on that in a followup thread. --yrj/dFKFPuw6o+aM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="merge.diff" Index: bin/date/tests/Makefile =================================================================== --- bin/date/tests/Makefile (revision 262758) +++ bin/date/tests/Makefile (working copy) @@ -6,4 +6,4 @@ TAP_TESTS_SH= legacy_test -.include <tap.test.mk> +.include <bsd.test.mk> Index: bin/mv/tests/Makefile =================================================================== --- bin/mv/tests/Makefile (revision 262758) +++ bin/mv/tests/Makefile (working copy) @@ -6,4 +6,4 @@ TAP_TESTS_SH= legacy_test -.include <tap.test.mk> +.include <bsd.test.mk> Index: bin/pax/tests/Makefile =================================================================== --- bin/pax/tests/Makefile (revision 262758) +++ bin/pax/tests/Makefile (working copy) @@ -6,4 +6,4 @@ TAP_TESTS_PERL= legacy_test -.include <tap.test.mk> +.include <bsd.test.mk> Index: bin/sh/tests/Makefile =================================================================== --- bin/sh/tests/Makefile (revision 262758) +++ bin/sh/tests/Makefile (working copy) @@ -15,4 +15,4 @@ SUBDIR+= builtins errors execution expansion parameters parser set-e -.include <tap.test.mk> +.include <bsd.test.mk> Index: bin/test/tests/Makefile =================================================================== --- bin/test/tests/Makefile (revision 262758) +++ bin/test/tests/Makefile (working copy) @@ -12,4 +12,4 @@ # 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> Index: lib/atf/libatf-c/tests/Makefile =================================================================== --- lib/atf/libatf-c/tests/Makefile (revision 262758) +++ lib/atf/libatf-c/tests/Makefile (working copy) @@ -35,4 +35,4 @@ ATF_TESTS_SH= pkg_config_test -.include <atf.test.mk> +.include <bsd.test.mk> Index: lib/atf/libatf-c/tests/detail/Makefile =================================================================== --- lib/atf/libatf-c/tests/detail/Makefile (revision 262758) +++ lib/atf/libatf-c/tests/detail/Makefile (working copy) @@ -31,4 +31,4 @@ version_helper.o: atf-version .include "../../../common.mk" -.include <atf.test.mk> +.include <bsd.test.mk> Index: lib/atf/libatf-c++/tests/Makefile =================================================================== --- lib/atf/libatf-c++/tests/Makefile (revision 262758) +++ lib/atf/libatf-c++/tests/Makefile (working copy) @@ -28,4 +28,4 @@ ATF_TESTS_SH= pkg_config_test -.include <atf.test.mk> +.include <bsd.test.mk> Index: lib/atf/libatf-c++/tests/detail/Makefile =================================================================== --- lib/atf/libatf-c++/tests/detail/Makefile (revision 262758) +++ lib/atf/libatf-c++/tests/detail/Makefile (working copy) @@ -29,4 +29,4 @@ version_helper.o: atf-version .include "../../../common.mk" -.include <atf.test.mk> +.include <bsd.test.mk> Index: lib/atf/tests/test-programs/Makefile =================================================================== --- lib/atf/tests/test-programs/Makefile (revision 262758) +++ lib/atf/tests/test-programs/Makefile (working copy) @@ -21,4 +21,4 @@ ATF_TESTS_SH_SRC_${_T}= common.sh ${_T}.sh .endfor -.include <atf.test.mk> +.include <bsd.test.mk> Index: lib/libcrypt/tests/Makefile =================================================================== --- lib/libcrypt/tests/Makefile (revision 262758) +++ lib/libcrypt/tests/Makefile (working copy) @@ -9,4 +9,4 @@ CFLAGS+= -I${.CURDIR:H} LDADD+= -L${.OBJDIR:H} -lcrypt -.include <atf.test.mk> +.include <bsd.test.mk> Index: libexec/atf/atf-check/tests/Makefile =================================================================== --- libexec/atf/atf-check/tests/Makefile (revision 262758) +++ libexec/atf/atf-check/tests/Makefile (working copy) @@ -9,4 +9,4 @@ ATF_TESTS_SH= atf-check_test -.include <atf.test.mk> +.include <bsd.test.mk> Index: share/examples/tests/tests/atf/Makefile =================================================================== --- share/examples/tests/tests/atf/Makefile (revision 262758) +++ share/examples/tests/tests/atf/Makefile (working copy) @@ -27,4 +27,4 @@ # definitions from above. KYUAFILE= yes -.include <atf.test.mk> +.include <bsd.test.mk> Index: share/examples/tests/tests/plain/Makefile =================================================================== --- share/examples/tests/tests/plain/Makefile (revision 262758) +++ share/examples/tests/tests/plain/Makefile (working copy) @@ -27,4 +27,4 @@ # definitions from above. KYUAFILE= yes -.include <plain.test.mk> +.include <bsd.test.mk> Index: share/mk/atf.test.mk =================================================================== --- share/mk/atf.test.mk (revision 262758) +++ share/mk/atf.test.mk (working copy) @@ -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.init.mk>__) +.error atf.test.mk cannot be included directly. +.endif # List of C, C++ and shell test programs to build. # @@ -164,5 +168,3 @@ .endif .endif - -.include <bsd.test.mk> Index: share/mk/bsd.test.mk =================================================================== --- share/mk/bsd.test.mk (revision 262758) +++ share/mk/bsd.test.mk (working copy) @@ -2,13 +2,9 @@ # # 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> @@ -67,11 +63,6 @@ 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 +70,15 @@ # 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 Index: share/mk/plain.test.mk =================================================================== --- share/mk/plain.test.mk (revision 262758) +++ share/mk/plain.test.mk (working copy) @@ -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.init.mk>__) +.error plain.test.mk cannot be included directly. +.endif # List of C, C++ and shell test programs to build. # @@ -58,5 +62,3 @@ mv ${.TARGET}.tmp ${.TARGET} .endfor .endif - -.include <bsd.test.mk> Index: share/mk/tap.test.mk =================================================================== --- share/mk/tap.test.mk (revision 262758) +++ share/mk/tap.test.mk (working copy) @@ -1,5 +1,7 @@ # $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 @@ -6,7 +8,9 @@ # (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.init.mk>__) +.error tap.test.mk cannot be included directly. +.endif # List of C, C++ and shell test programs to build. # @@ -87,5 +91,3 @@ mv ${.TARGET}.tmp ${.TARGET} .endfor .endif - -.include <bsd.test.mk> Index: tests/sys/kern/Makefile =================================================================== --- tests/sys/kern/Makefile (revision 262758) +++ tests/sys/kern/Makefile (working copy) @@ -8,4 +8,4 @@ LDADD+= -lpthread -.include <atf.test.mk> +.include <bsd.test.mk> Index: usr.bin/atf/atf-sh/tests/Makefile =================================================================== --- usr.bin/atf/atf-sh/tests/Makefile (revision 262758) +++ usr.bin/atf/atf-sh/tests/Makefile (working copy) @@ -23,4 +23,4 @@ chmod +x ${.TARGET}.tmp mv ${.TARGET}.tmp ${.TARGET} -.include <atf.test.mk> +.include <bsd.test.mk> --yrj/dFKFPuw6o+aM--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140305002721.GA1156>