From owner-svn-src-user@freebsd.org Wed May 4 06:58:10 2016 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FFE5B2C8D4 for ; Wed, 4 May 2016 06:58:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 432921D00; Wed, 4 May 2016 06:58:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u446w9nX068385; Wed, 4 May 2016 06:58:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u446w9Zx068381; Wed, 4 May 2016 06:58:09 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201605040658.u446w9Zx068381@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 4 May 2016 06:58:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r299054 - in user/ngie/release-pkg-fix-tests/share/examples/tests/tests: atf plain X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2016 06:58:10 -0000 Author: ngie Date: Wed May 4 06:58:08 2016 New Revision: 299054 URL: https://svnweb.freebsd.org/changeset/base/299054 Log: Provide working examples which use PACKAGE/${PACKAGE}FILES file1 was previously created on the fly and deleted after the test was over. Switch things up a bit by installing it via the build, so helpful comments and reasoning can be added for the ${PACKAGE}FILES idiom I've sprinkled around the tree on the branch Also, in plain/cp_test.sh, use file3 in the second test instead of file2. Using file2 worked previously because the files' permissions were reset when the files were truncated, but since the environment for both the `force` and `simple` testcases are the same, it would fail when `force` followed `simple`, as file2 existed when `force` was run, but had incorrect permissions, thus resulting in a permission died error from cp(1). Modified: user/ngie/release-pkg-fix-tests/share/examples/tests/tests/atf/Makefile user/ngie/release-pkg-fix-tests/share/examples/tests/tests/atf/cp_test.sh user/ngie/release-pkg-fix-tests/share/examples/tests/tests/plain/Makefile user/ngie/release-pkg-fix-tests/share/examples/tests/tests/plain/cp_test.sh Modified: user/ngie/release-pkg-fix-tests/share/examples/tests/tests/atf/Makefile ============================================================================== --- user/ngie/release-pkg-fix-tests/share/examples/tests/tests/atf/Makefile Wed May 4 06:53:02 2016 (r299053) +++ user/ngie/release-pkg-fix-tests/share/examples/tests/tests/atf/Makefile Wed May 4 06:58:08 2016 (r299054) @@ -2,6 +2,12 @@ .include +# The release package to use for the tests contained within the directory +# +# This applies to components which rely on ^/projects/release-pkg support +# (see UPDATING XXXXXXXXX / svn revision r298107). +PACKAGE= tests + # Directory into which the Kyuafile provided by this directory will be # installed. # @@ -27,4 +33,19 @@ ATF_TESTS_SH= cp_test # definitions from above. KYUAFILE= yes +# Install file1 and file2 as files via bsd.prog.mk. Please note the intentional +# ${PACKAGE} namespace of files. +# +# The basic semantics of this are the same as FILES in bsd.prog.mk, e.g. the +# installation of the files can be manipulated via ${PACKAGE}FILESDIR, +# ${PACKAGE}FILESMODE, etc. +# +# Please see comment above about ${PACKAGE}. Feel free to omit the ${PACKAGE} +# namespace if release package support isn't needed. +${PACKAGE}FILES+= file1 +CLEANFILES+= file1 + +file1: + @echo "File 1" > ${.TARGET} + .include Modified: user/ngie/release-pkg-fix-tests/share/examples/tests/tests/atf/cp_test.sh ============================================================================== --- user/ngie/release-pkg-fix-tests/share/examples/tests/tests/atf/cp_test.sh Wed May 4 06:53:02 2016 (r299053) +++ user/ngie/release-pkg-fix-tests/share/examples/tests/tests/atf/cp_test.sh Wed May 4 06:58:08 2016 (r299054) @@ -61,7 +61,7 @@ verify_copy() { # atf_test_case simple simple_body() { - echo 'File 1' >file1 + cp $(atf_get_srcdir)/file1 . # The atf_check function is a very powerful function of atf-sh. # It allows you to define checkers for the exit status, the @@ -102,7 +102,7 @@ force_head() { "override the destination file" } force_body() { - echo 'File 1' >file1 + cp $(atf_get_srcdir)/file1 . echo 'File 2' >file2 chmod 400 file2 atf_check cp -f file1 file2 Modified: user/ngie/release-pkg-fix-tests/share/examples/tests/tests/plain/Makefile ============================================================================== --- user/ngie/release-pkg-fix-tests/share/examples/tests/tests/plain/Makefile Wed May 4 06:53:02 2016 (r299053) +++ user/ngie/release-pkg-fix-tests/share/examples/tests/tests/plain/Makefile Wed May 4 06:58:08 2016 (r299054) @@ -2,6 +2,12 @@ .include +# The release package to use for the tests contained within the directory +# +# This applies to components which rely on ^/projects/release-pkg support +# (see UPDATING XXXXXXXXX / svn revision r298107). +PACKAGE= tests + # Directory into which the Kyuafile provided by this directory will be # installed. # @@ -27,4 +33,19 @@ PLAIN_TESTS_SH= cp_test # definitions from above. KYUAFILE= yes +# Install file1 and file2 as files via bsd.prog.mk. Please note the intentional +# ${PACKAGE} namespace of files. +# +# The basic semantics of this are the same as FILES in bsd.prog.mk, e.g. the +# installation of the files can be manipulated via ${PACKAGE}FILESDIR, +# ${PACKAGE}FILESMODE, etc. +# +# Please see comment above about ${PACKAGE}. Feel free to omit the ${PACKAGE} +# namespace if release package support isn't needed. +${PACKAGE}FILES+= file1 +CLEANFILES+= file1 + +file1: + @echo "File 1" > ${.TARGET} + .include Modified: user/ngie/release-pkg-fix-tests/share/examples/tests/tests/plain/cp_test.sh ============================================================================== --- user/ngie/release-pkg-fix-tests/share/examples/tests/tests/plain/cp_test.sh Wed May 4 06:53:02 2016 (r299053) +++ user/ngie/release-pkg-fix-tests/share/examples/tests/tests/plain/cp_test.sh Wed May 4 06:58:08 2016 (r299054) @@ -57,17 +57,16 @@ verify_copy() { } simple_test() { - echo 'File 1' >file1 + cp "$(dirname "${0}")/file1" . cp file1 file2 || err "cp failed" verify_copy file1 file2 } force_test() { - echo 'File 1' >file1 - echo 'File 2' >file2 - chmod 400 file2 - cp -f file1 file2 || err "cp failed" - verify_copy file1 file2 + echo 'File 3' >file3 + chmod 400 file3 + cp -f file1 file3 || err "cp failed" + verify_copy file1 file3 } # If you have read the cp_test.sh counterpart in the atf/ directory, you