aboutsummaryrefslogtreecommitdiff
path: root/share/examples
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2016-05-04 23:20:53 +0000
committerEnji Cooper <ngie@FreeBSD.org>2016-05-04 23:20:53 +0000
commit430f7286a566b1407c7b32ce13585caf5aa59b92 (patch)
treea3a2f2051c05cb9a95c4a94f6c5bbcd7a12cdfea /share/examples
parente45163b2162def698a0320716097091257c39dea (diff)
downloadsrc-430f7286a566b1407c7b32ce13585caf5aa59b92.tar.gz
src-430f7286a566b1407c7b32ce13585caf5aa59b92.zip
Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed
after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division
Notes
Notes: svn path=/head/; revision=299094
Diffstat (limited to 'share/examples')
-rw-r--r--share/examples/tests/Makefile8
-rw-r--r--share/examples/tests/tests/Makefile5
-rw-r--r--share/examples/tests/tests/atf/Makefile23
-rw-r--r--share/examples/tests/tests/atf/cp_test.sh4
-rw-r--r--share/examples/tests/tests/plain/Makefile23
-rw-r--r--share/examples/tests/tests/plain/cp_test.sh11
6 files changed, 45 insertions, 29 deletions
diff --git a/share/examples/tests/Makefile b/share/examples/tests/Makefile
index 77d89a4880ad..df273c982648 100644
--- a/share/examples/tests/Makefile
+++ b/share/examples/tests/Makefile
@@ -1,13 +1,5 @@
# $FreeBSD$
-.include <bsd.own.mk>
-
-FILESGROUPS= FILES
-PACKAGE= tests
-FILESGROUPS+= TESTS
-TESTSPACKAGE= ${PACKAGE}
-TESTS+= Kyuafile
-
SUBDIR= tests
.PATH: ${SRCTOP}/tests
diff --git a/share/examples/tests/tests/Makefile b/share/examples/tests/tests/Makefile
index 08b60493afb4..9f7b5a4729c4 100644
--- a/share/examples/tests/tests/Makefile
+++ b/share/examples/tests/tests/Makefile
@@ -2,11 +2,6 @@
.include <bsd.own.mk>
-FILESGROUPS= FILES
-PACKAGE= tests
-FILESGROUPS+= TESTS
-TESTSPACKAGE= ${PACKAGE}
-
# Directory into which the Kyuafile provided by this directory will be
# installed.
#
diff --git a/share/examples/tests/tests/atf/Makefile b/share/examples/tests/tests/atf/Makefile
index 6628a21775ba..c846d67aeadb 100644
--- a/share/examples/tests/tests/atf/Makefile
+++ b/share/examples/tests/tests/atf/Makefile
@@ -2,11 +2,11 @@
.include <bsd.own.mk>
-FILESGROUPS= FILES
+# 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
-FILESGROUPS+= TESTS
-TESTSPACKAGE= ${PACKAGE}
-TESTS+= Kyuafile
# Directory into which the Kyuafile provided by this directory will be
# installed.
@@ -33,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 <bsd.test.mk>
diff --git a/share/examples/tests/tests/atf/cp_test.sh b/share/examples/tests/tests/atf/cp_test.sh
index 83d691460d0f..befec0911ba3 100644
--- a/share/examples/tests/tests/atf/cp_test.sh
+++ b/share/examples/tests/tests/atf/cp_test.sh
@@ -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
diff --git a/share/examples/tests/tests/plain/Makefile b/share/examples/tests/tests/plain/Makefile
index e01de619654d..d9807aa46a7d 100644
--- a/share/examples/tests/tests/plain/Makefile
+++ b/share/examples/tests/tests/plain/Makefile
@@ -2,11 +2,11 @@
.include <bsd.own.mk>
-FILESGROUPS= FILES
+# 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
-FILESGROUPS+= TESTS
-TESTSPACKAGE= ${PACKAGE}
-TESTS+= Kyuafile
# Directory into which the Kyuafile provided by this directory will be
# installed.
@@ -33,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 <bsd.test.mk>
diff --git a/share/examples/tests/tests/plain/cp_test.sh b/share/examples/tests/tests/plain/cp_test.sh
index c45d68490db6..b47d33d0a02c 100644
--- a/share/examples/tests/tests/plain/cp_test.sh
+++ b/share/examples/tests/tests/plain/cp_test.sh
@@ -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