aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2015-10-12 08:16:03 +0000
committerEnji Cooper <ngie@FreeBSD.org>2015-10-12 08:16:03 +0000
commitb2d48be1bc7df45ddd13b143a160d0acb5a383c5 (patch)
tree67a85c5694bcdbbc7b1839be795cd25ef318ed91
parent4f4a7a03cea15a671284f9c06ada80755c994df6 (diff)
downloadsrc-b2d48be1bc7df45ddd13b143a160d0acb5a383c5.tar.gz
src-b2d48be1bc7df45ddd13b143a160d0acb5a383c5.zip
Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151) - Eliminate explicit OBJTOP/SRCTOP setting - Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk - Remove unnecessary TESTSDIR setting - Use SRCTOP where possible for clarity MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Divison
Notes
Notes: svn path=/head/; revision=289172
-rw-r--r--bin/cat/tests/Makefile6
-rw-r--r--bin/date/tests/Makefile2
-rw-r--r--bin/expr/tests/Makefile6
-rw-r--r--bin/ls/tests/Makefile2
-rw-r--r--bin/mv/tests/Makefile2
-rw-r--r--bin/pax/tests/Makefile2
-rw-r--r--bin/pkill/tests/Makefile2
-rw-r--r--bin/sh/tests/Makefile2
-rw-r--r--bin/sleep/tests/Makefile7
-rw-r--r--bin/test/tests/Makefile2
-rw-r--r--bin/tests/Makefile4
-rw-r--r--cddl/lib/tests/Makefile4
-rw-r--r--cddl/sbin/tests/Makefile4
-rw-r--r--cddl/tests/Makefile4
-rw-r--r--cddl/usr.bin/tests/Makefile4
-rw-r--r--cddl/usr.sbin/dtrace/tests/Makefile3
-rw-r--r--cddl/usr.sbin/tests/Makefile4
-rw-r--r--gnu/lib/tests/Makefile4
-rw-r--r--gnu/tests/Makefile4
-rw-r--r--gnu/usr.bin/diff/tests/Makefile11
-rw-r--r--gnu/usr.bin/tests/Makefile4
-rw-r--r--lib/atf/libatf-c++/tests/Makefile3
-rw-r--r--lib/atf/libatf-c++/tests/detail/Makefile2
-rw-r--r--lib/atf/libatf-c/tests/Makefile3
-rw-r--r--lib/atf/libatf-c/tests/detail/Makefile2
-rw-r--r--lib/atf/tests/Makefile2
-rw-r--r--lib/atf/tests/test-programs/Makefile2
-rw-r--r--lib/libc/tests/Makefile2
-rw-r--r--lib/libc/tests/Makefile.netbsd-tests6
-rw-r--r--lib/libc/tests/c063/Makefile2
-rw-r--r--lib/libc/tests/db/Makefile2
-rw-r--r--lib/libc/tests/gen/Makefile2
-rw-r--r--lib/libc/tests/gen/execve/Makefile6
-rw-r--r--lib/libc/tests/gen/posix_spawn/Makefile6
-rw-r--r--lib/libc/tests/hash/Makefile6
-rw-r--r--lib/libc/tests/inet/Makefile2
-rw-r--r--lib/libc/tests/locale/Makefile2
-rw-r--r--lib/libc/tests/net/Makefile2
-rw-r--r--lib/libc/tests/net/getaddrinfo/Makefile4
-rw-r--r--lib/libc/tests/regex/Makefile2
-rw-r--r--lib/libc/tests/rpc/Makefile1
-rw-r--r--lib/libc/tests/setjmp/Makefile4
-rw-r--r--lib/libc/tests/ssp/Makefile2
-rw-r--r--lib/libc/tests/stdio/Makefile2
-rw-r--r--lib/libc/tests/stdlib/Makefile2
-rw-r--r--lib/libc/tests/string/Makefile2
-rw-r--r--lib/libc/tests/sys/Makefile2
-rw-r--r--lib/libc/tests/termios/Makefile2
-rw-r--r--lib/libc/tests/time/Makefile2
-rw-r--r--lib/libc/tests/tls/Makefile1
-rw-r--r--lib/libc/tests/tls/dso/Makefile1
-rw-r--r--lib/libc/tests/tls_dso/Makefile2
-rw-r--r--lib/libc/tests/ttyio/Makefile2
-rw-r--r--lib/libcrypt/tests/Makefile2
-rw-r--r--lib/libmp/tests/Makefile2
-rw-r--r--lib/libnv/tests/Makefile2
-rw-r--r--lib/libpam/libpam/tests/Makefile2
-rw-r--r--lib/libproc/tests/Makefile3
-rw-r--r--lib/librt/tests/Makefile6
-rw-r--r--lib/libthr/tests/Makefile4
-rw-r--r--lib/libthr/tests/dlopen/Makefile2
-rw-r--r--lib/libthr/tests/dlopen/dso/Makefile1
-rw-r--r--lib/libutil/tests/Makefile2
-rw-r--r--lib/msun/tests/Makefile4
-rw-r--r--lib/tests/Makefile4
-rw-r--r--libexec/atf/atf-check/tests/Makefile4
-rw-r--r--libexec/atf/atf-sh/tests/Makefile4
-rw-r--r--libexec/atf/tests/Makefile4
-rw-r--r--libexec/rtld-elf/tests/Makefile1
-rw-r--r--libexec/tests/Makefile4
-rw-r--r--sbin/devd/tests/Makefile2
-rw-r--r--sbin/dhclient/tests/Makefile2
-rw-r--r--sbin/growfs/tests/Makefile2
-rw-r--r--sbin/ifconfig/tests/Makefile6
-rw-r--r--sbin/mdconfig/tests/Makefile3
-rw-r--r--sbin/tests/Makefile4
-rw-r--r--secure/lib/tests/Makefile4
-rw-r--r--secure/libexec/tests/Makefile4
-rw-r--r--secure/tests/Makefile4
-rw-r--r--secure/usr.bin/tests/Makefile4
-rw-r--r--secure/usr.sbin/tests/Makefile4
-rw-r--r--share/examples/tests/Makefile4
-rw-r--r--share/tests/Makefile2
-rw-r--r--tests/etc/Makefile2
-rw-r--r--tests/sys/mqueue/Makefile2
-rw-r--r--tests/sys/pjdfstest/tests/Makefile2
-rw-r--r--usr.bin/apply/tests/Makefile2
-rw-r--r--usr.bin/basename/tests/Makefile9
-rw-r--r--usr.bin/calendar/tests/Makefile2
-rw-r--r--usr.bin/cmp/tests/Makefile9
-rw-r--r--usr.bin/col/tests/Makefile2
-rw-r--r--usr.bin/comm/tests/Makefile2
-rw-r--r--usr.bin/cut/tests/Makefile9
-rw-r--r--usr.bin/dirname/tests/Makefile9
-rw-r--r--usr.bin/file2c/tests/Makefile2
-rw-r--r--usr.bin/grep/tests/Makefile10
-rw-r--r--usr.bin/gzip/tests/Makefile9
-rw-r--r--usr.bin/ident/tests/Makefile2
-rw-r--r--usr.bin/join/tests/Makefile2
-rw-r--r--usr.bin/jot/tests/Makefile2
-rw-r--r--usr.bin/lastcomm/tests/Makefile2
-rw-r--r--usr.bin/m4/tests/Makefile2
-rw-r--r--usr.bin/mkimg/tests/Makefile2
-rw-r--r--usr.bin/ncal/tests/Makefile2
-rw-r--r--usr.bin/printf/tests/Makefile2
-rw-r--r--usr.bin/sed/tests/Makefile2
-rw-r--r--usr.bin/soelim/tests/Makefile2
-rw-r--r--usr.bin/tests/Makefile4
-rw-r--r--usr.bin/truncate/tests/Makefile3
-rw-r--r--usr.bin/units/tests/Makefile2
-rw-r--r--usr.bin/uudecode/tests/Makefile2
-rw-r--r--usr.bin/uuencode/tests/Makefile2
-rw-r--r--usr.bin/xargs/tests/Makefile2
-rw-r--r--usr.bin/yacc/tests/Makefile4
-rw-r--r--usr.sbin/etcupdate/tests/Makefile2
-rw-r--r--usr.sbin/fstyp/tests/Makefile2
-rw-r--r--usr.sbin/newsyslog/tests/Makefile2
-rw-r--r--usr.sbin/nmtree/tests/Makefile4
-rw-r--r--usr.sbin/pw/tests/Makefile2
-rw-r--r--usr.sbin/sa/tests/Makefile2
-rw-r--r--usr.sbin/tests/Makefile4
121 files changed, 69 insertions, 321 deletions
diff --git a/bin/cat/tests/Makefile b/bin/cat/tests/Makefile
index 73f82e125d6f..f68513ce683b 100644
--- a/bin/cat/tests/Makefile
+++ b/bin/cat/tests/Makefile
@@ -1,11 +1,5 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR}/../../..
-SRCTOP= ${.CURDIR}/../../..
-TESTSRC= ${SRCTOP}/contrib/netbsd-tests/bin/cat
-
-TESTSDIR= ${TESTSBASE}/bin/cat
-
NETBSD_ATF_TESTS_SH= cat_test
FILESDIR= ${TESTSDIR}
diff --git a/bin/date/tests/Makefile b/bin/date/tests/Makefile
index d023195b3289..ecce803e247d 100644
--- a/bin/date/tests/Makefile
+++ b/bin/date/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/date
-
ATF_TESTS_SH= format_string_test
.include <bsd.test.mk>
diff --git a/bin/expr/tests/Makefile b/bin/expr/tests/Makefile
index 80c130c3df20..21b0e993fedc 100644
--- a/bin/expr/tests/Makefile
+++ b/bin/expr/tests/Makefile
@@ -1,11 +1,5 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR}/../../..
-SRCTOP= ${.CURDIR}/../../..
-TESTSRC= ${SRCTOP}/contrib/netbsd-tests/bin/expr
-
-TESTSDIR= ${TESTSBASE}/bin/expr
-
NETBSD_ATF_TESTS_SH= expr_test
ATF_TESTS_SH_SED_expr_test+= -e 's/eval expr/eval expr --/g'
diff --git a/bin/ls/tests/Makefile b/bin/ls/tests/Makefile
index ba8038c1ce93..89a2e8cf1dca 100644
--- a/bin/ls/tests/Makefile
+++ b/bin/ls/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/bin/ls
-
ATF_TESTS_SH+= ls_tests
# This seems like overkill, but the idea in mind is that all of the testcases
# should be runnable as !root
diff --git a/bin/mv/tests/Makefile b/bin/mv/tests/Makefile
index 3d437ef916a6..229d96e5766a 100644
--- a/bin/mv/tests/Makefile
+++ b/bin/mv/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/mv
-
TAP_TESTS_SH= legacy_test
.include <bsd.test.mk>
diff --git a/bin/pax/tests/Makefile b/bin/pax/tests/Makefile
index 1f27c184130a..8334fea3c747 100644
--- a/bin/pax/tests/Makefile
+++ b/bin/pax/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/pax
-
TAP_TESTS_PERL= legacy_test
.include <bsd.test.mk>
diff --git a/bin/pkill/tests/Makefile b/bin/pkill/tests/Makefile
index a4a2c915182f..be467074651f 100644
--- a/bin/pkill/tests/Makefile
+++ b/bin/pkill/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/pkill
-
TAP_TESTS_SH= pgrep-F_test
TAP_TESTS_SH+= pgrep-LF_test
TAP_TESTS_SH+= pgrep-P_test
diff --git a/bin/sh/tests/Makefile b/bin/sh/tests/Makefile
index c092962ae303..d93e19aea7e1 100644
--- a/bin/sh/tests/Makefile
+++ b/bin/sh/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/sh
-
TESTS_SUBDIRS+= builtins
TESTS_SUBDIRS+= errors
TESTS_SUBDIRS+= execution
diff --git a/bin/sleep/tests/Makefile b/bin/sleep/tests/Makefile
index 9b286e6ba967..6fc95f39ccb1 100644
--- a/bin/sleep/tests/Makefile
+++ b/bin/sleep/tests/Makefile
@@ -1,12 +1,7 @@
# $FreeBSD$
-TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/bin/sleep
-.PATH: ${TESTSRC}
-
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/sleep
-ATF_TESTS_SH= sleep_test
-ATF_TESTS_SH_SRC_sleep_test= t_sleep.sh
+NETBSD_ATF_TESTS_SH= sleep_test
.include <bsd.test.mk>
diff --git a/bin/test/tests/Makefile b/bin/test/tests/Makefile
index 5ee337a213fb..a1a5d4f02fa7 100644
--- a/bin/test/tests/Makefile
+++ b/bin/test/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/test
-
TAP_TESTS_SH= legacy_test
# Some tests in here are silently not run when the tests are executed as
# root. Explicitly tell Kyua to drop privileges.
diff --git a/bin/tests/Makefile b/bin/tests/Makefile
index 7a59b1029513..a0e63e5da42a 100644
--- a/bin/tests/Makefile
+++ b/bin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin
-
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/cddl/lib/tests/Makefile b/cddl/lib/tests/Makefile
index 4a49d9fee849..a0e63e5da42a 100644
--- a/cddl/lib/tests/Makefile
+++ b/cddl/lib/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/cddl/lib
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/cddl/sbin/tests/Makefile b/cddl/sbin/tests/Makefile
index 91bbaee271f4..a0e63e5da42a 100644
--- a/cddl/sbin/tests/Makefile
+++ b/cddl/sbin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/cddl/sbin
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/cddl/tests/Makefile b/cddl/tests/Makefile
index 34a27ea636a0..a0e63e5da42a 100644
--- a/cddl/tests/Makefile
+++ b/cddl/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/cddl
-
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/cddl/usr.bin/tests/Makefile b/cddl/usr.bin/tests/Makefile
index c94d5910a210..a0e63e5da42a 100644
--- a/cddl/usr.bin/tests/Makefile
+++ b/cddl/usr.bin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/cddl/usr.bin
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/cddl/usr.sbin/dtrace/tests/Makefile b/cddl/usr.sbin/dtrace/tests/Makefile
index dfd2b54e1e2c..7db6f2fc0f76 100644
--- a/cddl/usr.sbin/dtrace/tests/Makefile
+++ b/cddl/usr.sbin/dtrace/tests/Makefile
@@ -2,10 +2,9 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/cddl/usr.sbin/dtrace
TESTS_SUBDIRS+= common
-.PATH: ${.CURDIR:H:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= YES
.PATH: ${.CURDIR}/tools
diff --git a/cddl/usr.sbin/tests/Makefile b/cddl/usr.sbin/tests/Makefile
index 0305aeef1d3b..a0e63e5da42a 100644
--- a/cddl/usr.sbin/tests/Makefile
+++ b/cddl/usr.sbin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/cddl/usr.sbin
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/gnu/lib/tests/Makefile b/gnu/lib/tests/Makefile
index 256e24512e30..a0e63e5da42a 100644
--- a/gnu/lib/tests/Makefile
+++ b/gnu/lib/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/gnu/lib
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/gnu/tests/Makefile b/gnu/tests/Makefile
index de42fae1ec00..a0e63e5da42a 100644
--- a/gnu/tests/Makefile
+++ b/gnu/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/gnu
-
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/gnu/usr.bin/diff/tests/Makefile b/gnu/usr.bin/diff/tests/Makefile
index aa1629d33f53..16439b3b61fe 100644
--- a/gnu/usr.bin/diff/tests/Makefile
+++ b/gnu/usr.bin/diff/tests/Makefile
@@ -1,17 +1,14 @@
# $FreeBSD$
-TESTSRC= ${.CURDIR}/../../../../contrib/netbsd-tests/usr.bin/diff
-.PATH: ${TESTSRC}
+TESTSRC= ${SRCTOP}/contrib/netbsd-tests/usr.bin/diff
-.include <bsd.own.mk>
-
-TESTSDIR= ${TESTSBASE}/gnu/usr.bin/diff
-ATF_TESTS_SH= diff_test
+NETBSD_ATF_TESTS_SH= diff_test
ATF_TESTS_SH_SED_diff_test= -e 's/t_diff/`basename $$0`/g'
-ATF_TESTS_SH_SRC_diff_test= t_diff.sh
FILESDIR= ${TESTSDIR}
FILES+= d_mallocv1.in
FILES+= d_mallocv2.in
+.include <netbsd-tests.test.mk>
+
.include <bsd.test.mk>
diff --git a/gnu/usr.bin/tests/Makefile b/gnu/usr.bin/tests/Makefile
index eebbff675d2e..a0e63e5da42a 100644
--- a/gnu/usr.bin/tests/Makefile
+++ b/gnu/usr.bin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/gnu/usr.bin
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/lib/atf/libatf-c++/tests/Makefile b/lib/atf/libatf-c++/tests/Makefile
index 5f5a57515bb2..a069bb19d1e6 100644
--- a/lib/atf/libatf-c++/tests/Makefile
+++ b/lib/atf/libatf-c++/tests/Makefile
@@ -2,10 +2,9 @@
.include <bsd.init.mk>
-TESTSDIR= ${TESTSBASE}/lib/atf/libatf-c++
TESTS_SUBDIRS= detail
-ATF= ${.CURDIR:H:H:H:H}/contrib/atf
+ATF= ${SRCTOP}/contrib/atf
.PATH: ${ATF}/atf-c++
.PATH: ${ATF}/atf-c++/detail
diff --git a/lib/atf/libatf-c++/tests/detail/Makefile b/lib/atf/libatf-c++/tests/detail/Makefile
index 69c3e7bac0d0..f7d672e792fb 100644
--- a/lib/atf/libatf-c++/tests/detail/Makefile
+++ b/lib/atf/libatf-c++/tests/detail/Makefile
@@ -4,7 +4,7 @@
TESTSDIR= ${TESTSBASE}/lib/atf/libatf-c++/detail
-ATF= ${.CURDIR:H:H:H:H:H}/contrib/atf
+ATF= ${SRCTOP}/contrib/atf
.PATH: ${ATF}/atf-c++/detail
CFLAGS+= -DATF_C_TESTS_BASE='"${TESTSBASE}/lib/atf/libatf-c"'
diff --git a/lib/atf/libatf-c/tests/Makefile b/lib/atf/libatf-c/tests/Makefile
index d5b6dc07520c..e864c2e8bafc 100644
--- a/lib/atf/libatf-c/tests/Makefile
+++ b/lib/atf/libatf-c/tests/Makefile
@@ -2,10 +2,9 @@
.include <bsd.init.mk>
-TESTSDIR= ${TESTSBASE}/lib/atf/libatf-c
TESTS_SUBDIRS= detail
-ATF= ${.CURDIR:H:H:H:H}/contrib/atf
+ATF= ${SRCTOP}/contrib/atf
.PATH: ${ATF}/atf-c
.PATH: ${ATF}/atf-c/detail
diff --git a/lib/atf/libatf-c/tests/detail/Makefile b/lib/atf/libatf-c/tests/detail/Makefile
index 02c1f2b444d3..e47fd566ec01 100644
--- a/lib/atf/libatf-c/tests/detail/Makefile
+++ b/lib/atf/libatf-c/tests/detail/Makefile
@@ -4,7 +4,7 @@
TESTSDIR= ${TESTSBASE}/lib/atf/libatf-c/detail
-ATF= ${.CURDIR:H:H:H:H:H}/contrib/atf
+ATF= ${SRCTOP}/contrib/atf
.PATH: ${ATF}/atf-c/detail
CFLAGS+= -DATF_INCLUDEDIR='"${INCLUDEDIR}"'
diff --git a/lib/atf/tests/Makefile b/lib/atf/tests/Makefile
index 7bc96c94b039..dc79bb3491f5 100644
--- a/lib/atf/tests/Makefile
+++ b/lib/atf/tests/Makefile
@@ -4,7 +4,7 @@
TESTSDIR= ${TESTSBASE}/lib/atf
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
SUBDIR= test-programs
diff --git a/lib/atf/tests/test-programs/Makefile b/lib/atf/tests/test-programs/Makefile
index b0c1c2376481..aa308268a043 100644
--- a/lib/atf/tests/test-programs/Makefile
+++ b/lib/atf/tests/test-programs/Makefile
@@ -5,7 +5,7 @@
TESTSDIR= ${TESTSBASE}/lib/atf/test-programs
KYUAFILE= yes
-ATF= ${.CURDIR:H:H:H:H}/contrib/atf
+ATF= ${SRCTOP}/contrib/atf
.PATH: ${ATF}/test-programs
CFLAGS+= -I${ATF}
diff --git a/lib/libc/tests/Makefile b/lib/libc/tests/Makefile
index 3036ce93f8ef..2e9715183649 100644
--- a/lib/libc/tests/Makefile
+++ b/lib/libc/tests/Makefile
@@ -2,8 +2,6 @@
.include <src.opts.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc
-
SUBDIR= tls_dso
TESTS_SUBDIRS= c063
diff --git a/lib/libc/tests/Makefile.netbsd-tests b/lib/libc/tests/Makefile.netbsd-tests
index f364b1c1b486..32385186425f 100644
--- a/lib/libc/tests/Makefile.netbsd-tests
+++ b/lib/libc/tests/Makefile.netbsd-tests
@@ -1,7 +1,7 @@
# $FreeBSD$
-OBJTOP?= ${.OBJDIR:H:H:H:H}
-SRCTOP?= ${.CURDIR:H:H:H:H}
-TESTSRC?= ${SRCTOP}/contrib/netbsd-tests/lib/libc/${.CURDIR:T}
+TESTSRC:= ${SRCTOP}/contrib/netbsd-tests/${RELDIR:C/libc\/tests/libc/}
+
+TESTSDIR:= ${TESTSBASE}/${RELDIR:C/libc\/tests/libc/}
.include <netbsd-tests.test.mk>
diff --git a/lib/libc/tests/c063/Makefile b/lib/libc/tests/c063/Makefile
index 5f4e1ca9c31f..2e4565cdf318 100644
--- a/lib/libc/tests/c063/Makefile
+++ b/lib/libc/tests/c063/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/lib/libc/c063
-
#TODO: t_o_search
NETBSD_ATF_TESTS_C= faccessat
diff --git a/lib/libc/tests/db/Makefile b/lib/libc/tests/db/Makefile
index ed1d6caadbf2..eb0ce395e28a 100644
--- a/lib/libc/tests/db/Makefile
+++ b/lib/libc/tests/db/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/lib/libc/db
-
BINDIR= ${TESTSDIR}
PROGS= h_db
diff --git a/lib/libc/tests/gen/Makefile b/lib/libc/tests/gen/Makefile
index f9a0bd42b6dd..90f65736c508 100644
--- a/lib/libc/tests/gen/Makefile
+++ b/lib/libc/tests/gen/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/gen
-
ATF_TESTS_C= arc4random_test
ATF_TESTS_C+= fpclassify2_test
diff --git a/lib/libc/tests/gen/execve/Makefile b/lib/libc/tests/gen/execve/Makefile
index 2106a1582358..5e8bc6fb7640 100644
--- a/lib/libc/tests/gen/execve/Makefile
+++ b/lib/libc/tests/gen/execve/Makefile
@@ -1,13 +1,7 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR:H:H:H:H:H}
-SRCTOP= ${.CURDIR:H:H:H:H:H}
-TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/gen/${.CURDIR:T}
-
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/gen/execve
-
NETBSD_ATF_TESTS_C= execve_test
.include "../../Makefile.netbsd-tests"
diff --git a/lib/libc/tests/gen/posix_spawn/Makefile b/lib/libc/tests/gen/posix_spawn/Makefile
index f20bbd7c3e5f..9bb2cf1cbd57 100644
--- a/lib/libc/tests/gen/posix_spawn/Makefile
+++ b/lib/libc/tests/gen/posix_spawn/Makefile
@@ -1,13 +1,7 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR:H:H:H:H:H}
-SRCTOP= ${.CURDIR:H:H:H:H:H}
-TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/gen/${.CURDIR:T}
-
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/gen/posix_spawn
-
BINDIR= ${TESTSDIR}
NETBSD_ATF_TESTS_C= fileactions_test
diff --git a/lib/libc/tests/hash/Makefile b/lib/libc/tests/hash/Makefile
index 52fd569dfaaf..688725345fe6 100644
--- a/lib/libc/tests/hash/Makefile
+++ b/lib/libc/tests/hash/Makefile
@@ -2,8 +2,6 @@
.include <src.opts.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/hash
-
NETBSD_ATF_TESTS_C=
.if ${MK_OPENSSL} != "no"
@@ -29,8 +27,8 @@ LDADD+= -lmd
DPADD.sha2_test+= ${LIBCRYPTO}
LDADD.sha2_test+= -lcrypto
-CFLAGS.sha2_test+= -I${.CURDIR}/../../../../crypto/openssh/openbsd-compat
-CFLAGS.sha2_test+= -I${.CURDIR}/../../../../crypto/openssh
+CFLAGS.sha2_test+= -I${SRCTOP}/crypto/openssh/openbsd-compat
+CFLAGS.sha2_test+= -I${SRCTOP}/crypto/openssh
.include "../Makefile.netbsd-tests"
diff --git a/lib/libc/tests/inet/Makefile b/lib/libc/tests/inet/Makefile
index a15b96ae35af..ee6f98e2f71f 100644
--- a/lib/libc/tests/inet/Makefile
+++ b/lib/libc/tests/inet/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/inet
-
NETBSD_ATF_TESTS_C= inet_network_test
.include "../Makefile.netbsd-tests"
diff --git a/lib/libc/tests/locale/Makefile b/lib/libc/tests/locale/Makefile
index e4dc553c46ae..c0e037857d4c 100644
--- a/lib/libc/tests/locale/Makefile
+++ b/lib/libc/tests/locale/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/locale
-
NETBSD_ATF_TESTS_C= io_test
NETBSD_ATF_TESTS_C+= mbrtowc_test
NETBSD_ATF_TESTS_C+= mbstowcs_test
diff --git a/lib/libc/tests/net/Makefile b/lib/libc/tests/net/Makefile
index eb199f09b8d7..5a0d77546752 100644
--- a/lib/libc/tests/net/Makefile
+++ b/lib/libc/tests/net/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/net
-
BINDIR= ${TESTSDIR}
NETBSD_ATF_TESTS_C= getprotoent_test
diff --git a/lib/libc/tests/net/getaddrinfo/Makefile b/lib/libc/tests/net/getaddrinfo/Makefile
index a6b9eb197e99..d21d33655942 100644
--- a/lib/libc/tests/net/getaddrinfo/Makefile
+++ b/lib/libc/tests/net/getaddrinfo/Makefile
@@ -1,13 +1,9 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR:H:H:H:H:H}
-SRCTOP= ${.CURDIR:H:H:H:H:H}
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/net/${.CURDIR:T}
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/net/getaddrinfo
-
BINDIR= ${TESTSDIR}
.error "This testcase needs to be ported to FreeBSD (the output from getaddrinfo_test differs from NetBSD)"
diff --git a/lib/libc/tests/regex/Makefile b/lib/libc/tests/regex/Makefile
index 37b3277e57c4..fa60f6ec4cc8 100644
--- a/lib/libc/tests/regex/Makefile
+++ b/lib/libc/tests/regex/Makefile
@@ -4,8 +4,6 @@
BINDIR= ${TESTSDIR}
-TESTSDIR= ${TESTSBASE}/lib/libc/regex
-
IMPLEMENTATION?= -DREGEX_SPENCER
CFLAGS.h_regex+=-I${TESTSRC} -I${.CURDIR:H:H}/regex
diff --git a/lib/libc/tests/rpc/Makefile b/lib/libc/tests/rpc/Makefile
index 03802945cc68..e6e58e76b905 100644
--- a/lib/libc/tests/rpc/Makefile
+++ b/lib/libc/tests/rpc/Makefile
@@ -1,6 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/lib/libc/rpc
SRCS.xdr_test= ${RPCSRC:.x=_xdr.c} t_xdr.c ${RPCSRC:.x=.h}
NETBSD_ATF_TESTS_C= rpc_test
diff --git a/lib/libc/tests/setjmp/Makefile b/lib/libc/tests/setjmp/Makefile
index e4c7ae5144a6..0ca25774beef 100644
--- a/lib/libc/tests/setjmp/Makefile
+++ b/lib/libc/tests/setjmp/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/lib/libc/setjmp
-
NETBSD_ATF_TESTS_C= t_setjmp
NETBSD_ATF_TESTS_C+= t_threadjmp
@@ -10,4 +8,6 @@ LDADD.t_threadjmp+= -lpthread
WARNS?= 4
+.include "../Makefile.netbsd-tests"
+
.include <bsd.test.mk>
diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile
index 7bc866035be0..ec7a82a48885 100644
--- a/lib/libc/tests/ssp/Makefile
+++ b/lib/libc/tests/ssp/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/ssp
-
NO_WERROR=
WARNS?= 2
diff --git a/lib/libc/tests/stdio/Makefile b/lib/libc/tests/stdio/Makefile
index 23d5c1ef8664..f2d686b52027 100644
--- a/lib/libc/tests/stdio/Makefile
+++ b/lib/libc/tests/stdio/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/lib/libc/stdio
-
ATF_TESTS_C= fmemopen2_test
NETBSD_ATF_TESTS_C= clearerr_test
diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile
index 917160112f6a..187ca5be9669 100644
--- a/lib/libc/tests/stdlib/Makefile
+++ b/lib/libc/tests/stdlib/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/stdlib
-
# TODO: t_getenv_thread, t_mi_vector_hash
NETBSD_ATF_TESTS_C= abs_test
NETBSD_ATF_TESTS_C+= atoi_test
diff --git a/lib/libc/tests/string/Makefile b/lib/libc/tests/string/Makefile
index 3c30ab67ec73..d91af08a27f1 100644
--- a/lib/libc/tests/string/Makefile
+++ b/lib/libc/tests/string/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/string
-
# TODO: popcount, stresep
NETBSD_ATF_TESTS_C+= memchr
diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile
index 89431bced322..5cd596d077fb 100644
--- a/lib/libc/tests/sys/Makefile
+++ b/lib/libc/tests/sys/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/sys
-
# TODO: clone, lwp_create, lwp_ctl, posix_fadvise, recvmmsg,
# swapcontext
NETBSD_ATF_TESTS_C+= access_test
diff --git a/lib/libc/tests/termios/Makefile b/lib/libc/tests/termios/Makefile
index 9a3fd66a5aac..0495d684b505 100644
--- a/lib/libc/tests/termios/Makefile
+++ b/lib/libc/tests/termios/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/termios
-
NETBSD_ATF_TESTS_C= tcsetpgrp_test
.include "../Makefile.netbsd-tests"
diff --git a/lib/libc/tests/time/Makefile b/lib/libc/tests/time/Makefile
index c2a55df15be5..feb543dad243 100644
--- a/lib/libc/tests/time/Makefile
+++ b/lib/libc/tests/time/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/time
-
NETBSD_ATF_TESTS_C= mktime_test
NETBSD_ATF_TESTS_C+= strptime_test
diff --git a/lib/libc/tests/tls/Makefile b/lib/libc/tests/tls/Makefile
index e2248959ab14..b6b671914e79 100644
--- a/lib/libc/tests/tls/Makefile
+++ b/lib/libc/tests/tls/Makefile
@@ -2,7 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/tls
.if !defined(NO_PIC)
SUBDIR+= dso
.endif
diff --git a/lib/libc/tests/tls/dso/Makefile b/lib/libc/tests/tls/dso/Makefile
index 466f950061f8..9b698cd5f5c2 100644
--- a/lib/libc/tests/tls/dso/Makefile
+++ b/lib/libc/tests/tls/dso/Makefile
@@ -1,7 +1,6 @@
# $FreeBSD$
OBJTOP= ${.OBJDIR:H:H:H:H:H}
-SRCTOP= ${.CURDIR:H:H:H:H:H}
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/tls/${.CURDIR:T}
LIB= h_tls_dlopen
diff --git a/lib/libc/tests/tls_dso/Makefile b/lib/libc/tests/tls_dso/Makefile
index 5449799de96c..b37ffec76659 100644
--- a/lib/libc/tests/tls_dso/Makefile
+++ b/lib/libc/tests/tls_dso/Makefile
@@ -1,5 +1,7 @@
# $FreeBSD$
+SRCDIR= ${SRCTOP}/contrib/netbsd/
+
.include <bsd.own.mk>
LIB= h_tls_dynamic
diff --git a/lib/libc/tests/ttyio/Makefile b/lib/libc/tests/ttyio/Makefile
index a1f320d6fd4d..242f33258e41 100644
--- a/lib/libc/tests/ttyio/Makefile
+++ b/lib/libc/tests/ttyio/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib/libc/ttyio
-
# TODO: ptm_test
NETBSD_ATF_TESTS_C= ttyio_test
diff --git a/lib/libcrypt/tests/Makefile b/lib/libcrypt/tests/Makefile
index 6f98b53a3437..2591a3bf1014 100644
--- a/lib/libcrypt/tests/Makefile
+++ b/lib/libcrypt/tests/Makefile
@@ -2,8 +2,6 @@
# exercise libcrypt
-TESTSDIR= ${TESTSBASE}/lib/libcrypt
-
ATF_TESTS_C= crypt_tests
CFLAGS+= -I${.CURDIR:H}
diff --git a/lib/libmp/tests/Makefile b/lib/libmp/tests/Makefile
index e74e80640e20..42749d00a039 100644
--- a/lib/libmp/tests/Makefile
+++ b/lib/libmp/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/lib/libmp
-
TAP_TESTS_C+= legacy_test
LIBADD+= mp
diff --git a/lib/libnv/tests/Makefile b/lib/libnv/tests/Makefile
index 38e7f13219a6..cce0b5e8f1a7 100644
--- a/lib/libnv/tests/Makefile
+++ b/lib/libnv/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/lib/libnv
-
ATF_TESTS_CXX= \
dnv_tests \
nv_array_tests \
diff --git a/lib/libpam/libpam/tests/Makefile b/lib/libpam/libpam/tests/Makefile
index 4532aceee393..e40936a883db 100644
--- a/lib/libpam/libpam/tests/Makefile
+++ b/lib/libpam/libpam/tests/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-OPENPAM = ${.CURDIR}/../../../../contrib/openpam
+OPENPAM= ${SRCTOP}/contrib/openpam
.PATH: ${OPENPAM}/t
TESTSDIR = ${TESTSBASE}/lib/libpam
diff --git a/lib/libproc/tests/Makefile b/lib/libproc/tests/Makefile
index 1f98467df24f..326481d572a9 100644
--- a/lib/libproc/tests/Makefile
+++ b/lib/libproc/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/lib/libproc
-
ATF_TESTS_C+= proc_test
PROGS= target_prog
@@ -15,7 +13,6 @@ DPADD+= ${LIBELF} ${LIBPROC} ${LIBRTLD_DB} ${LIBUTIL}
# for testing symbol lookup.
STRIP=
-MAN=
WARNS?= 6
.include <bsd.test.mk>
diff --git a/lib/librt/tests/Makefile b/lib/librt/tests/Makefile
index 95c525997e3b..c4817ecfad76 100644
--- a/lib/librt/tests/Makefile
+++ b/lib/librt/tests/Makefile
@@ -1,11 +1,5 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR:H:H:H}
-SRCTOP= ${.CURDIR:H:H:H}
-TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/librt
-
-TESTSDIR= ${TESTSBASE}/lib/librt
-
LIBADD= rt
NETBSD_ATF_TESTS_C= sched_test
diff --git a/lib/libthr/tests/Makefile b/lib/libthr/tests/Makefile
index 11cf0e791e69..a5fc85eb67d1 100644
--- a/lib/libthr/tests/Makefile
+++ b/lib/libthr/tests/Makefile
@@ -1,11 +1,7 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR:H:H:H}
-SRCTOP= ${.CURDIR:H:H:H}
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread
-TESTSDIR= ${TESTSBASE}/lib/libthr
-
# TODO: t_name (missing pthread_getname_np support in FreeBSD)
NETBSD_ATF_TESTS_C= barrier_test
NETBSD_ATF_TESTS_C+= cond_test
diff --git a/lib/libthr/tests/dlopen/Makefile b/lib/libthr/tests/dlopen/Makefile
index 0764bfa15936..08931924f21d 100644
--- a/lib/libthr/tests/dlopen/Makefile
+++ b/lib/libthr/tests/dlopen/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR:H:H:H:H}
-SRCTOP= ${.CURDIR:H:H:H:H}
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread/dlopen
.include <bsd.own.mk>
diff --git a/lib/libthr/tests/dlopen/dso/Makefile b/lib/libthr/tests/dlopen/dso/Makefile
index 080dec941a8c..533568766715 100644
--- a/lib/libthr/tests/dlopen/dso/Makefile
+++ b/lib/libthr/tests/dlopen/dso/Makefile
@@ -1,7 +1,6 @@
# $FreeBSD$
OBJTOP= ${.OBJDIR:H:H:H:H:H}
-SRCTOP= ${.CURDIR:H:H:H:H:H}
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread/dlopen/dso
SHLIB= h_pthread_dlopen
diff --git a/lib/libutil/tests/Makefile b/lib/libutil/tests/Makefile
index 4a675b0cc18f..81b2a494eaae 100644
--- a/lib/libutil/tests/Makefile
+++ b/lib/libutil/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/lib/libutil
-
TAP_TESTS_C+= flopen_test
TAP_TESTS_C+= grp_test
TAP_TESTS_C+= humanize_number_test
diff --git a/lib/msun/tests/Makefile b/lib/msun/tests/Makefile
index 0479cfb63801..7888c3c789f8 100644
--- a/lib/msun/tests/Makefile
+++ b/lib/msun/tests/Makefile
@@ -1,11 +1,7 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR:H:H:H}
-SRCTOP= ${.CURDIR:H:H:H}
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libm
-TESTSDIR= ${TESTSBASE}/lib/msun
-
# All architectures on FreeBSD have fenv.h
CFLAGS+= -DHAVE_FENV_H
diff --git a/lib/tests/Makefile b/lib/tests/Makefile
index 935fd709df02..a0e63e5da42a 100644
--- a/lib/tests/Makefile
+++ b/lib/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/lib
-
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/libexec/atf/atf-check/tests/Makefile b/libexec/atf/atf-check/tests/Makefile
index 43a74988a27b..87b26cb4a823 100644
--- a/libexec/atf/atf-check/tests/Makefile
+++ b/libexec/atf/atf-check/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.init.mk>
-TESTSDIR= ${TESTSBASE}/libexec/atf/atf-check
-
-ATF= ${.CURDIR:H:H:H:H}/contrib/atf
+ATF= ${SRCTOP}/contrib/atf
.PATH: ${ATF}/atf-sh
ATF_TESTS_SH= atf-check_test
diff --git a/libexec/atf/atf-sh/tests/Makefile b/libexec/atf/atf-sh/tests/Makefile
index 3360b974f9ee..9ccd6a7a44f1 100644
--- a/libexec/atf/atf-sh/tests/Makefile
+++ b/libexec/atf/atf-sh/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.init.mk>
-TESTSDIR= ${TESTSBASE}/libexec/atf/atf-sh
-
-ATF= ${.CURDIR:H:H:H:H}/contrib/atf
+ATF= ${SRCTOP}/contrib/atf
.PATH: ${ATF}/atf-sh
ATF_TESTS_SH+= atf_check_test
diff --git a/libexec/atf/tests/Makefile b/libexec/atf/tests/Makefile
index 7aa96019367e..a0e63e5da42a 100644
--- a/libexec/atf/tests/Makefile
+++ b/libexec/atf/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/libexec/atf
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/libexec/rtld-elf/tests/Makefile b/libexec/rtld-elf/tests/Makefile
index f384218b1a59..7d3be6837dcb 100644
--- a/libexec/rtld-elf/tests/Makefile
+++ b/libexec/rtld-elf/tests/Makefile
@@ -2,7 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/libexec/rtld-elf
SUBDIR+= libpythagoras target
ATF_TESTS_C= ld_library_pathfds
diff --git a/libexec/tests/Makefile b/libexec/tests/Makefile
index 665efab4275e..a0e63e5da42a 100644
--- a/libexec/tests/Makefile
+++ b/libexec/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/libexec
-
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/sbin/devd/tests/Makefile b/sbin/devd/tests/Makefile
index ee679ce722ae..e06928c5571c 100644
--- a/sbin/devd/tests/Makefile
+++ b/sbin/devd/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/sbin/devd
-
ATF_TESTS_C= client_test
TEST_METADATA.client_test= required_programs="devd"
TEST_METADATA.client_test+= required_user="root"
diff --git a/sbin/dhclient/tests/Makefile b/sbin/dhclient/tests/Makefile
index a460f7f9be11..45cc8c28d443 100644
--- a/sbin/dhclient/tests/Makefile
+++ b/sbin/dhclient/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/sbin/dhclient
-
.PATH: ${.CURDIR}/..
PLAIN_TESTS_C= option-domain-search_test
diff --git a/sbin/growfs/tests/Makefile b/sbin/growfs/tests/Makefile
index 7a6a831f2037..6a3208d9c441 100644
--- a/sbin/growfs/tests/Makefile
+++ b/sbin/growfs/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/sbin/growfs
-
TAP_TESTS_PERL= legacy_test
.include <bsd.test.mk>
diff --git a/sbin/ifconfig/tests/Makefile b/sbin/ifconfig/tests/Makefile
index 044e9792d352..93967c705175 100644
--- a/sbin/ifconfig/tests/Makefile
+++ b/sbin/ifconfig/tests/Makefile
@@ -1,11 +1,5 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR}/../../..
-SRCTOP= ${.CURDIR}/../../..
-TESTSRC= ${SRCTOP}/contrib/netbsd-tests/sbin/ifconfig
-
-TESTSDIR= ${TESTSBASE}/sbin/ifconfig
-
NETBSD_ATF_TESTS_SH= nonexistent_test
.include <netbsd-tests.test.mk>
diff --git a/sbin/mdconfig/tests/Makefile b/sbin/mdconfig/tests/Makefile
index 08a9e47e90dc..6c179fcf59ad 100644
--- a/sbin/mdconfig/tests/Makefile
+++ b/sbin/mdconfig/tests/Makefile
@@ -1,10 +1,7 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/sbin/mdconfig
-
ATF_TESTS_SH= mdconfig_test
-
TEST_METADATA.mdconfig_test+= required_user="root"
.include <bsd.test.mk>
diff --git a/sbin/tests/Makefile b/sbin/tests/Makefile
index a298f87ab432..a0e63e5da42a 100644
--- a/sbin/tests/Makefile
+++ b/sbin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/sbin
-
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/secure/lib/tests/Makefile b/secure/lib/tests/Makefile
index cd6bcff5f3c9..a0e63e5da42a 100644
--- a/secure/lib/tests/Makefile
+++ b/secure/lib/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/secure/lib
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/secure/libexec/tests/Makefile b/secure/libexec/tests/Makefile
index 6debef892a59..a0e63e5da42a 100644
--- a/secure/libexec/tests/Makefile
+++ b/secure/libexec/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/secure/libexec
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/secure/tests/Makefile b/secure/tests/Makefile
index 2e6dbc487fdc..a0e63e5da42a 100644
--- a/secure/tests/Makefile
+++ b/secure/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/secure
-
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/secure/usr.bin/tests/Makefile b/secure/usr.bin/tests/Makefile
index 1c06699c587a..a0e63e5da42a 100644
--- a/secure/usr.bin/tests/Makefile
+++ b/secure/usr.bin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/secure/usr.bin
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/secure/usr.sbin/tests/Makefile b/secure/usr.sbin/tests/Makefile
index 25e95f03cdea..a0e63e5da42a 100644
--- a/secure/usr.sbin/tests/Makefile
+++ b/secure/usr.sbin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/secure/usr.sbin
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/share/examples/tests/Makefile b/share/examples/tests/Makefile
index 387b8068b1f7..a091b2d2f68e 100644
--- a/share/examples/tests/Makefile
+++ b/share/examples/tests/Makefile
@@ -2,11 +2,9 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/share/examples
-
SUBDIR= tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
-.PATH: ${.CURDIR:H:H:H}/tests
.include <bsd.test.mk>
diff --git a/share/tests/Makefile b/share/tests/Makefile
index 2c6362193ab7..e070571ecb4b 100644
--- a/share/tests/Makefile
+++ b/share/tests/Makefile
@@ -4,7 +4,7 @@
TESTSDIR= ${TESTSBASE}/share
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/tests/etc/Makefile b/tests/etc/Makefile
index 9aad25c06395..1e49666767c0 100644
--- a/tests/etc/Makefile
+++ b/tests/etc/Makefile
@@ -4,7 +4,7 @@
TESTSDIR= ${TESTSBASE}/etc
-.PATH: ${.CURDIR:H}
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
SUBDIR+= rc.d
diff --git a/tests/sys/mqueue/Makefile b/tests/sys/mqueue/Makefile
index 5af8b2546a09..63741d26b77e 100644
--- a/tests/sys/mqueue/Makefile
+++ b/tests/sys/mqueue/Makefile
@@ -6,7 +6,7 @@ ATF_TESTS_SH= mqueue_test
BINDIR= ${TESTSDIR}
-CFLAGS+= -I${.CURDIR:H:H}
+CFLAGS+= -I${SRCTOP}/tests
PROGS+= mqtest1
PROGS+= mqtest2
diff --git a/tests/sys/pjdfstest/tests/Makefile b/tests/sys/pjdfstest/tests/Makefile
index 248b2095a6b7..95b4bbe29b41 100644
--- a/tests/sys/pjdfstest/tests/Makefile
+++ b/tests/sys/pjdfstest/tests/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-PJDFSTEST_SRCDIR= ${.CURDIR:H:H:H:H}/contrib/pjdfstest
+PJDFSTEST_SRCDIR= ${SRCTOP}/contrib/pjdfstest
TESTSDIR= ${TESTSBASE}/sys/pjdfstest
diff --git a/usr.bin/apply/tests/Makefile b/usr.bin/apply/tests/Makefile
index 332bf7db169c..5ff6c28e968e 100644
--- a/usr.bin/apply/tests/Makefile
+++ b/usr.bin/apply/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/apply
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/basename/tests/Makefile b/usr.bin/basename/tests/Makefile
index 32dedabc5f4d..bad7b2890432 100644
--- a/usr.bin/basename/tests/Makefile
+++ b/usr.bin/basename/tests/Makefile
@@ -1,12 +1,7 @@
# $FreeBSD$
-TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/basename
-.PATH: ${TESTSRC}
+NETBSD_ATF_TESTS_SH= basename_test
-.include <bsd.own.mk>
-
-TESTSDIR= ${TESTSBASE}/usr.bin/basename
-ATF_TESTS_SH= basename_test
-ATF_TESTS_SH_SRC_basename_test= t_basename.sh
+.include <netbsd-tests.test.mk>
.include <bsd.test.mk>
diff --git a/usr.bin/calendar/tests/Makefile b/usr.bin/calendar/tests/Makefile
index f3d592e42802..b9b0607f20b8 100644
--- a/usr.bin/calendar/tests/Makefile
+++ b/usr.bin/calendar/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/calendar
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/cmp/tests/Makefile b/usr.bin/cmp/tests/Makefile
index 1c054c6888f8..bfae46c8a2a4 100644
--- a/usr.bin/cmp/tests/Makefile
+++ b/usr.bin/cmp/tests/Makefile
@@ -1,12 +1,9 @@
# $FreeBSD$
-TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/cmp
-.PATH: ${TESTSRC}
-
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/usr.bin/cmp
-ATF_TESTS_SH= cmp_test
-ATF_TESTS_SH_SRC_cmp_test= t_cmp.sh
+NETBSD_ATF_TESTS_SH= cmp_test
+
+.include <netbsd-tests.test.mk>
.include <bsd.test.mk>
diff --git a/usr.bin/col/tests/Makefile b/usr.bin/col/tests/Makefile
index 43838e9c5eab..cf02083d7f01 100644
--- a/usr.bin/col/tests/Makefile
+++ b/usr.bin/col/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/col
-
ATF_TESTS_SH= col
FILES= rlf.in \
diff --git a/usr.bin/comm/tests/Makefile b/usr.bin/comm/tests/Makefile
index 172943d1247c..065b3b4f6020 100644
--- a/usr.bin/comm/tests/Makefile
+++ b/usr.bin/comm/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/comm
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/cut/tests/Makefile b/usr.bin/cut/tests/Makefile
index b324a7804196..7d8707d0e79c 100644
--- a/usr.bin/cut/tests/Makefile
+++ b/usr.bin/cut/tests/Makefile
@@ -1,13 +1,8 @@
# $FreeBSD$
-TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/cut
-.PATH: ${TESTSRC}
-
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/usr.bin/cut
-ATF_TESTS_SH= cut_test
-ATF_TESTS_SH_SRC_cut_test= t_cut.sh
+NETBSD_ATF_TESTS_SH= cut_test
FILESDIR= ${TESTSDIR}
FILES= d_basic.out
@@ -18,4 +13,6 @@ FILES+= d_latin1.in
FILES+= d_sflag.out
FILES+= d_utf8.in
+.include <netbsd-tests.test.mk>
+
.include <bsd.test.mk>
diff --git a/usr.bin/dirname/tests/Makefile b/usr.bin/dirname/tests/Makefile
index 5b84c57092fe..6688e0d18ecd 100644
--- a/usr.bin/dirname/tests/Makefile
+++ b/usr.bin/dirname/tests/Makefile
@@ -1,12 +1,9 @@
# $FreeBSD$
-TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/dirname
-.PATH: ${TESTSRC}
-
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/usr.bin/dirname
-ATF_TESTS_SH= dirname_test
-ATF_TESTS_SH_SRC_dirname_test= t_dirname.sh
+NETBSD_ATF_TESTS_SH= dirname_test
+
+.include <netbsd-tests.test.mk>
.include <bsd.test.mk>
diff --git a/usr.bin/file2c/tests/Makefile b/usr.bin/file2c/tests/Makefile
index 8854eb4da477..50267f0fa5c3 100644
--- a/usr.bin/file2c/tests/Makefile
+++ b/usr.bin/file2c/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/file2c
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/grep/tests/Makefile b/usr.bin/grep/tests/Makefile
index 59b948c98e5a..7744fcbd2e49 100644
--- a/usr.bin/grep/tests/Makefile
+++ b/usr.bin/grep/tests/Makefile
@@ -1,14 +1,8 @@
# $FreeBSD$
-TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/grep
-.PATH: ${TESTSRC}
-
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/usr.bin/grep
-
-ATF_TESTS_SH= grep_test
-ATF_TESTS_SH_SRC_grep_test= t_grep.sh
+NETBSD_ATF_TESTS_SH= grep_test
FILESDIR= ${TESTSDIR}
FILES= d_basic.out
@@ -38,4 +32,6 @@ FILES+= d_whole_line.out
FILES+= d_word_regexps.out
FILES+= d_zgrep.out
+.include <netbsd-tests.test.mk>
+
.include <bsd.test.mk>
diff --git a/usr.bin/gzip/tests/Makefile b/usr.bin/gzip/tests/Makefile
index 155d739f17bd..03a5852b3ff0 100644
--- a/usr.bin/gzip/tests/Makefile
+++ b/usr.bin/gzip/tests/Makefile
@@ -1,12 +1,9 @@
# $FreeBSD$
-TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/gzip
-.PATH: ${TESTSRC}
-
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/usr.bin/gzip
-ATF_TESTS_SH= gzip_test
-ATF_TESTS_SH_SRC_gzip_test= t_gzip.sh
+NETBSD_ATF_TESTS_SH= gzip_test
+
+.include <netbsd-tests.test.mk>
.include <bsd.test.mk>
diff --git a/usr.bin/ident/tests/Makefile b/usr.bin/ident/tests/Makefile
index cc29bb8c6f8e..2ae27cf13cdf 100644
--- a/usr.bin/ident/tests/Makefile
+++ b/usr.bin/ident/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/ident
-
ATF_TESTS_SH= ident
FILES= test.in \
test.out \
diff --git a/usr.bin/join/tests/Makefile b/usr.bin/join/tests/Makefile
index 2d5580ff76d6..16f522fa4ca2 100644
--- a/usr.bin/join/tests/Makefile
+++ b/usr.bin/join/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/join
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/jot/tests/Makefile b/usr.bin/jot/tests/Makefile
index ef20eb24c755..63f76313ab8b 100644
--- a/usr.bin/jot/tests/Makefile
+++ b/usr.bin/jot/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/jot
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/lastcomm/tests/Makefile b/usr.bin/lastcomm/tests/Makefile
index b0fac0e4aa16..55ce574f6794 100644
--- a/usr.bin/lastcomm/tests/Makefile
+++ b/usr.bin/lastcomm/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/lastcomm
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/m4/tests/Makefile b/usr.bin/m4/tests/Makefile
index 2eebc07894b9..6a48677894fa 100644
--- a/usr.bin/m4/tests/Makefile
+++ b/usr.bin/m4/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/m4
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/mkimg/tests/Makefile b/usr.bin/mkimg/tests/Makefile
index 144b4fc83ae3..c2c6d5134750 100644
--- a/usr.bin/mkimg/tests/Makefile
+++ b/usr.bin/mkimg/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/mkimg
-
ATF_TESTS_SH= mkimg
SOURCES!= cd ${.CURDIR}; echo *.uu
diff --git a/usr.bin/ncal/tests/Makefile b/usr.bin/ncal/tests/Makefile
index 170caacf8a97..23b235fc7770 100644
--- a/usr.bin/ncal/tests/Makefile
+++ b/usr.bin/ncal/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/ncal
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/printf/tests/Makefile b/usr.bin/printf/tests/Makefile
index 5e212efb40f1..58c80c7a222d 100644
--- a/usr.bin/printf/tests/Makefile
+++ b/usr.bin/printf/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/printf
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/sed/tests/Makefile b/usr.bin/sed/tests/Makefile
index 02d2b89404bf..a23d4a9b858d 100644
--- a/usr.bin/sed/tests/Makefile
+++ b/usr.bin/sed/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/sed
-
TAP_TESTS_SH= legacy_test
TAP_TESTS_SH+= multi_test
TEST_METADATA.multi_test+= required_files="/usr/share/dict/words"
diff --git a/usr.bin/soelim/tests/Makefile b/usr.bin/soelim/tests/Makefile
index 4d787cfadc35..7c44d080ac5c 100644
--- a/usr.bin/soelim/tests/Makefile
+++ b/usr.bin/soelim/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/soelim
-
ATF_TESTS_SH= soelim
FILES= nonexisting.in \
diff --git a/usr.bin/tests/Makefile b/usr.bin/tests/Makefile
index af7a8bf9544d..08b47bca0f1a 100644
--- a/usr.bin/tests/Makefile
+++ b/usr.bin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/usr.bin
-
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/truncate/tests/Makefile b/usr.bin/truncate/tests/Makefile
index bfa15db114bc..82cd606e6d1b 100644
--- a/usr.bin/truncate/tests/Makefile
+++ b/usr.bin/truncate/tests/Makefile
@@ -1,6 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/truncate
-ATF_TESTS_SH= truncate_test
+ATF_TESTS_SH= truncate_test
.include <bsd.test.mk>
diff --git a/usr.bin/units/tests/Makefile b/usr.bin/units/tests/Makefile
index 0694effd12a8..5b135f7dbf1f 100644
--- a/usr.bin/units/tests/Makefile
+++ b/usr.bin/units/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/usr.bin/units
-
TAP_TESTS_SH= basics_test
.include <bsd.test.mk>
diff --git a/usr.bin/uudecode/tests/Makefile b/usr.bin/uudecode/tests/Makefile
index 5fda16bc49ea..efd3f9277845 100644
--- a/usr.bin/uudecode/tests/Makefile
+++ b/usr.bin/uudecode/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/uudecode
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/uuencode/tests/Makefile b/usr.bin/uuencode/tests/Makefile
index ca7088e34c63..a36ef6c9b088 100644
--- a/usr.bin/uuencode/tests/Makefile
+++ b/usr.bin/uuencode/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/uuencode
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/xargs/tests/Makefile b/usr.bin/xargs/tests/Makefile
index cd14813aedc9..c8ef2c951ae9 100644
--- a/usr.bin/xargs/tests/Makefile
+++ b/usr.bin/xargs/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/xargs
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.bin/yacc/tests/Makefile b/usr.bin/yacc/tests/Makefile
index 2e157ec61319..ad3abaac20d8 100644
--- a/usr.bin/yacc/tests/Makefile
+++ b/usr.bin/yacc/tests/Makefile
@@ -2,12 +2,10 @@
.include <bsd.own.mk>
-TEST_DIR= ${.CURDIR}/../../../contrib/byacc/test
+TEST_DIR= ${SRCTOP}/contrib/byacc/test
.PATH: ${TEST_DIR} ${TEST_DIR}/yacc
-TESTSDIR= ${TESTSBASE}/usr.bin/yacc
-
PLAIN_TESTS_SH= yacc_tests
# NOTE: due to caveats with how permissions are handled on FreeBSD
# with root, this must be run as a non-privileged user; otherwise
diff --git a/usr.sbin/etcupdate/tests/Makefile b/usr.sbin/etcupdate/tests/Makefile
index da83397e61ff..45b12b7bb75d 100644
--- a/usr.sbin/etcupdate/tests/Makefile
+++ b/usr.sbin/etcupdate/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.sbin/etcupdate
-
PLAIN_TESTS_SH=
.for test in always_test \
conflicts_test \
diff --git a/usr.sbin/fstyp/tests/Makefile b/usr.sbin/fstyp/tests/Makefile
index db686b59c314..01c98699e2a0 100644
--- a/usr.sbin/fstyp/tests/Makefile
+++ b/usr.sbin/fstyp/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.sbin/fstyp
-
ATF_TESTS_SH= fstyp_test
FILES= ext2.img.bz2
diff --git a/usr.sbin/newsyslog/tests/Makefile b/usr.sbin/newsyslog/tests/Makefile
index f8ad2739cd78..802a44c01012 100644
--- a/usr.sbin/newsyslog/tests/Makefile
+++ b/usr.sbin/newsyslog/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.sbin/newsyslog
-
TAP_TESTS_SH= legacy_test
.include <bsd.test.mk>
diff --git a/usr.sbin/nmtree/tests/Makefile b/usr.sbin/nmtree/tests/Makefile
index 1df81d0f0a44..0b6312723162 100644
--- a/usr.sbin/nmtree/tests/Makefile
+++ b/usr.sbin/nmtree/tests/Makefile
@@ -1,10 +1,8 @@
# $FreeBSD$
-TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.sbin/mtree
+TESTSRC= ${SRCTOP}/contrib/netbsd-tests/usr.sbin/mtree
.PATH: ${TESTSRC}
-TESTSDIR= ${TESTSBASE}/usr.sbin/nmtree
-
ATF_TESTS_SH= nmtree_test
ATF_TESTS_SH_SRC_nmtree_test= t_mtree.sh
diff --git a/usr.sbin/pw/tests/Makefile b/usr.sbin/pw/tests/Makefile
index a1605aadaf57..27f0ac44eca0 100644
--- a/usr.sbin/pw/tests/Makefile
+++ b/usr.sbin/pw/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.sbin/pw
-
ATF_TESTS_SH= pw_etcdir \
pw_lock \
pw_config \
diff --git a/usr.sbin/sa/tests/Makefile b/usr.sbin/sa/tests/Makefile
index 204b51094515..3c74ba97d673 100644
--- a/usr.sbin/sa/tests/Makefile
+++ b/usr.sbin/sa/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.sbin/sa
-
TAP_TESTS_SH= legacy_test
FILESDIR= ${TESTSDIR}
diff --git a/usr.sbin/tests/Makefile b/usr.sbin/tests/Makefile
index a7e9c7140f70..a0e63e5da42a 100644
--- a/usr.sbin/tests/Makefile
+++ b/usr.sbin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/usr.sbin
-
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>