From owner-freebsd-testing@FreeBSD.ORG Wed Mar 5 00:35:44 2014 Return-Path: Delivered-To: freebsd-testing@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 74D7948D for ; Wed, 5 Mar 2014 00:35:44 +0000 (UTC) Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com [209.85.216.46]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2CE6A24F for ; Wed, 5 Mar 2014 00:35:43 +0000 (UTC) Received: by mail-qa0-f46.google.com with SMTP id i13so322411qae.33 for ; Tue, 04 Mar 2014 16:35:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:subject:message-id :mime-version:content-type:content-disposition:user-agent; bh=xhRFBoJN4RtZDQcP5udulIjL4MIj0ktr/W5QjAWFJL4=; b=MDqOLVtgSKdDZ0SM4p4l59/2jILNZUnLTGz0IjhuS437Tt9e4r7Niog48zOAeKXJeo 171PTmjVW8LeiM/m+atSzQVcTv1LfpvS8ac1Oo0Bn/zOvmySuq8NWxbZl3dwIbXBOjzL No8SfaQb8VaziGKFOw07hsMqAJtDkYdTaaaNp0u7xwe5xBHhfgLKOjunREMdQRPwyFn6 UEAlwre6daStNttojoKKR1UAh61aw4MjM8zlbspvZQGWBviVIOdCtzsXP8hn0QFzalXs OkFVfLWkX3VHm39MKf7WNNRl1LIyYYtaAEoOeBKob/Ouk+88hUo/oq9TeeYoPM6VZVoD 56Qw== X-Gm-Message-State: ALoCoQlf9Ellwf57RBybH2tYCYnEpa6FH9j5cfQ2SY5IlfXE5ppeEpat6IGmiBIdZV6zqcvnbsYg X-Received: by 10.140.85.35 with SMTP id m32mr3198020qgd.40.1393979243558; Tue, 04 Mar 2014 16:27:23 -0800 (PST) Received: from fbair.virtual.network (dhcp-172-26-12-18.nyc.corp.google.com [172.26.12.18]) by mx.google.com with ESMTPSA id a5sm2060362qae.2.2014.03.04.16.27.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Mar 2014 16:27:22 -0800 (PST) Sender: Julio Merino Date: Tue, 4 Mar 2014 19:27:21 -0500 From: Julio Merino To: freebsd-testing@freebsd.org Subject: Merging *.test.mk into bsd.test.mk Message-ID: <20140305002721.GA1156@fbair.virtual.network> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="yrj/dFKFPuw6o+aM" Content-Disposition: inline User-Agent: Mutt/1.5.22 (2013-10-16) X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2014 00:35:44 -0000 --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 +.include 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 +.include 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 +.include 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 +.include 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 +.include 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 +.include 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 +.include 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 +.include 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 +.include 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 +.include 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 +.include 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 +.include 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 +.include 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 +.include 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 +.if !target(____) +.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 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 @@ -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 +.include +.include + .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 +.if !target(____) +.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 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 +.if !target(____) +.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 Index: tests/sys/kern/Makefile =================================================================== --- tests/sys/kern/Makefile (revision 262758) +++ tests/sys/kern/Makefile (working copy) @@ -8,4 +8,4 @@ LDADD+= -lpthread -.include +.include 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 +.include --yrj/dFKFPuw6o+aM--