From ea75327a3c561042b30c5fb79537614d1b6f0089 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 02:56:48 +0000 Subject: [PATCH 01/16] Add _FILESMKDIR _FILESMKDIR is an internal knob for creating directories It's by no means a substitute for mtrees since the semantics for using install are a bit rudimentary -- it's meant purely to simplify automatic directory creation without having to invoke "make hier[archy]" from ${SRCTOP} in order to populate a directory tree. --- share/mk/bsd.files.mk | 10 ++++++++++ share/mk/bsd.prog.mk | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk index 2eac6221406f..f6d4220bbcb2 100644 --- a/share/mk/bsd.files.mk +++ b/share/mk/bsd.files.mk @@ -69,6 +69,10 @@ stage_as.${file:T}: ${file} installfiles-${group}: _${group}INS_${file:T} _${group}INS_${file:T}: ${file} +.ifdef _FILESMKDIR + ${INSTALL} -d \ + ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}:H} +.endif ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN_${.ALLSRC:T}} \ -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ ${.ALLSRC} \ @@ -83,10 +87,16 @@ stage_files.${group}: ${_${group}FILES} installfiles-${group}: _${group}INS _${group}INS: ${_${group}FILES} .if defined(${group}NAME) +.ifdef _FILESMKDIR + ${INSTALL} -d ${DESTDIR}${${${group}DIR}/${${group}NAME} +.endif ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN} -g ${${group}GRP} \ -m ${${group}MODE} ${.ALLSRC} \ ${DESTDIR}${${group}DIR}/${${group}NAME} .else +.ifdef _FILESMKDIR + ${INSTALL} -d ${DESTDIR}${${group}DIR}/ +.endif ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN} -g ${${group}GRP} \ -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}/ .endif diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 43cfb1271a5a..b107ad7d2198 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -268,6 +268,10 @@ SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE} STAGE_AS_${script:T}= ${SCRIPTSDIR_${script:T}}/${SCRIPTSNAME_${script:T}} _scriptsinstall: _SCRIPTSINS_${script:T} _SCRIPTSINS_${script:T}: ${script} +.ifdef _FILESMKDIR + ${INSTALL} -d \ + ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}:H} +.endif ${INSTALL} ${TAG_ARGS} -o ${SCRIPTSOWN_${.ALLSRC:T}} \ -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \ ${.ALLSRC} \ From 63c10f414b524687286026e0162c168d4d6f5ffb Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 03:06:08 +0000 Subject: [PATCH 02/16] Make "make check" smarter when run from a root directory If the user decides to specify HAS_TESTS in the upper directory, "make check" will now iterate down the "test" directory, running the tests with an assumably sane default value for $LD_LIBRARY_PATH, $PATH, etc. The purpose of this work is to simplify "make check" -- in particular, to increase dev-test velocity and get me (and others who pay attention, like me) out of the business of paying attention to Jenkins runs and get other developers to (hopefully) test their code more often prior to commit. Huge caveat: Obviously, this will fail miserably when the host can't run the target architecture/code. Necessary compat layer or qemu usermode will be required to make this possible, which is outside the scope of this work (batteries not included). --- share/mk/suite.test.mk | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/share/mk/suite.test.mk b/share/mk/suite.test.mk index 9e7dc9e99ae7..f8ad44a84087 100644 --- a/share/mk/suite.test.mk +++ b/share/mk/suite.test.mk @@ -99,4 +99,30 @@ realcheck: .PHONY echo "LOCALBASE=\"${LOCALBASE}\""; \ false; \ fi - @${KYUA} test -k ${CHECKDIR}/Kyuafile + @env ${TESTS_ENV:Q} ${KYUA} test -k ${CHECKDIR}/Kyuafile + +.ifdef _TESTS_USE_OBJDIR +DESTDIR= ${.OBJDIR}/checkdir +CLEANDIRS+= ${CHECKDIR} + +# XXX (ngie): use daemon(1) and a pidfile to lock the directory? +beforecheck: + @if [ -d "${DESTDIR}" ]; then \ + echo "${DESTDIR} already exists"; \ + echo "Aborting to avoid false positives with potentially" \ + "parallel instances of '${MAKE} check'"; \ + false; \ + fi +.for t in clean all + @cd ${.CURDIR} && ${MAKE} $t +.endfor + @cd ${.CURDIR} && ${MAKE} install \ + -D_FILESMKDIR \ + DESTDIR=${DESTDIR} + +# NOTE: this is intentional to ensure that "make check" can be run multiple +# times. It won't be run if "make check" fails or is interrupted +aftercheck: + @cd ${.CURDIR} && ${MAKE} clean + +.endif From fee25c68476f9120a2ce612722dcf024ab41effd Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 03:09:55 +0000 Subject: [PATCH 03/16] Clean up DESTDIR, not CHECKDIR While here, make the variable immediate to avoid silly mistakes that might result in wiping out / by accident if the variable is evaluated in a delayed manner due to poor use of $DESTDIR. --- share/mk/suite.test.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/mk/suite.test.mk b/share/mk/suite.test.mk index f8ad44a84087..a2068fe9e328 100644 --- a/share/mk/suite.test.mk +++ b/share/mk/suite.test.mk @@ -102,8 +102,8 @@ realcheck: .PHONY @env ${TESTS_ENV:Q} ${KYUA} test -k ${CHECKDIR}/Kyuafile .ifdef _TESTS_USE_OBJDIR -DESTDIR= ${.OBJDIR}/checkdir -CLEANDIRS+= ${CHECKDIR} +DESTDIR:= ${.OBJDIR}/checkdir +CLEANDIRS+= ${DESTDIR} # XXX (ngie): use daemon(1) and a pidfile to lock the directory? beforecheck: From 5e291c3faf37cc6fa065555c34041e5e67838a83 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 03:18:24 +0000 Subject: [PATCH 04/16] Hook HAS_TESTS (r321901) in to bsd.lib.mk and bsd.prog.mk Apply the required sugar to make "make check" just work (tm) when invoked from a subdirectory where HAS_TESTS is defined in the relevant Makefile. Adjust $LD_LIBRARY_PATH and $PATH appropriately from bsd.lib.mk and bsd.prog.mk to make the "user experience" more out of the box/seamless. --- share/mk/bsd.lib.mk | 6 ++++++ share/mk/bsd.prog.mk | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 67a5630996be..6005d8c1651d 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -442,6 +442,12 @@ OBJS_DEPEND_GUESS.${_S:R}.pico+= ${_S} .endfor .endif +.if defined(HAS_TESTS) +MAKE+= -D_TESTS_USE_OBJDIR +SUBDIR_TARGETS+= check +TESTS_LD_LIBRARY_PATH+= ${.OBJDIR} +.endif + .include .include .include diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index b107ad7d2198..3894b369e6c5 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -305,6 +305,13 @@ lint: ${SRCS:M*.c} .include .endif +.if defined(HAS_TESTS) +MAKE+= -D_TESTS_USE_OBJDIR +SUBDIR_TARGETS+= check +TESTS_LD_LIBRARY_PATH+= ${.OBJDIR} +TESTS_PATH+= ${.OBJDIR} +.endif + .if defined(PROG) OBJS_DEPEND_GUESS+= ${SRCS:M*.h} .endif From 8c09935728787235a761b6104c91ad6885ed4cd8 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 08:14:06 +0000 Subject: [PATCH 05/16] Add HAS_TESTS to all Makefiles that use the SUBDIR.${MK_TESTS}+= tests idiom --- bin/chmod/Makefile | 1 + bin/pwait/Makefile | 1 + bin/sh/Makefile | 5 ++--- lib/libcam/Makefile | 1 + lib/libkvm/Makefile | 1 + lib/libsbuf/Makefile | 1 + usr.bin/du/Makefile | 1 + usr.bin/stat/Makefile | 1 + 8 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/chmod/Makefile b/bin/chmod/Makefile index 3b2c2d1ecac6..ffb3352ba553 100644 --- a/bin/chmod/Makefile +++ b/bin/chmod/Makefile @@ -6,6 +6,7 @@ PACKAGE=runtime PROG= chmod +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/pwait/Makefile b/bin/pwait/Makefile index ab9f3ae73565..210ae3cdb918 100644 --- a/bin/pwait/Makefile +++ b/bin/pwait/Makefile @@ -5,6 +5,7 @@ PACKAGE=runtime PROG= pwait +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/sh/Makefile b/bin/sh/Makefile index 65856de36491..62a74f80f79c 100644 --- a/bin/sh/Makefile +++ b/bin/sh/Makefile @@ -64,8 +64,7 @@ syntax.c syntax.h: mksyntax token.h: mktokens sh ${.CURDIR}/mktokens -.if ${MK_TESTS} != "no" -SUBDIR+= tests -.endif +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libcam/Makefile b/lib/libcam/Makefile index 4ea82681a071..47280e22c270 100644 --- a/lib/libcam/Makefile +++ b/lib/libcam/Makefile @@ -47,6 +47,7 @@ SHLIB_MAJOR= 7 .include +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libkvm/Makefile b/lib/libkvm/Makefile index 38f997ae370d..3d3d6041da2b 100644 --- a/lib/libkvm/Makefile +++ b/lib/libkvm/Makefile @@ -38,6 +38,7 @@ MLINKS+=kvm_read.3 kvm_read2.3 kvm_read.3 kvm_write.3 .include +HAS_TESTS= SUBDIR.${MK_TESTS}= tests .include diff --git a/lib/libsbuf/Makefile b/lib/libsbuf/Makefile index 3e89f11c1b6c..ac8be92c8dbd 100644 --- a/lib/libsbuf/Makefile +++ b/lib/libsbuf/Makefile @@ -14,6 +14,7 @@ VERSION_DEF= ${.CURDIR}/Version.def .PATH: ${SRCTOP}/sys/kern +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/du/Makefile b/usr.bin/du/Makefile index 4340812457d8..b9256f3cec30 100644 --- a/usr.bin/du/Makefile +++ b/usr.bin/du/Makefile @@ -6,6 +6,7 @@ PROG= du LIBADD= util +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/stat/Makefile b/usr.bin/stat/Makefile index bc560a4243d0..e0a5a10bcf58 100644 --- a/usr.bin/stat/Makefile +++ b/usr.bin/stat/Makefile @@ -7,6 +7,7 @@ PROG= stat LINKS= ${BINDIR}/stat ${BINDIR}/readlink MLINKS= stat.1 readlink.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include From d511b20a693d77c1dc2491a62124471361eddd8e Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 08:50:42 +0000 Subject: [PATCH 06/16] Add HAS_TESTS to all Makefiles that are currently using the `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. --- bin/cat/Makefile | 1 + bin/date/Makefile | 1 + bin/dd/Makefile | 1 + bin/echo/Makefile | 1 + bin/expr/Makefile | 1 + bin/ln/Makefile | 1 + bin/ls/Makefile | 1 + bin/mv/Makefile | 1 + bin/pax/Makefile | 1 + bin/pkill/Makefile | 1 + bin/sleep/Makefile | 1 + bin/test/Makefile | 1 + lib/atf/libatf-c++/Makefile | 1 + lib/atf/libatf-c/Makefile | 1 + lib/libarchive/Makefile | 1 + lib/libc/Makefile | 1 + lib/libcasper/services/cap_dns/Makefile | 1 + lib/libcasper/services/cap_grp/Makefile | 1 + lib/libcasper/services/cap_pwd/Makefile | 1 + lib/libcasper/services/cap_sysctl/Makefile | 1 + lib/libcrypt/Makefile | 1 + lib/libmp/Makefile | 1 + lib/libnv/Makefile | 1 + lib/libpathconv/Makefile | 1 + lib/libproc/Makefile | 1 + lib/librt/Makefile | 1 + lib/libthr/Makefile | 1 + lib/libutil/Makefile | 1 + lib/libxo/Makefile | 1 + lib/msun/Makefile | 1 + libexec/atf/atf-check/Makefile | 1 + libexec/atf/atf-sh/Makefile | 1 + libexec/rtld-elf/Makefile | 1 + sbin/devd/Makefile | 1 + sbin/dhclient/Makefile | 1 + sbin/growfs/Makefile | 1 + sbin/ifconfig/Makefile | 1 + sbin/mdconfig/Makefile | 1 + sbin/pfctl/Makefile | 1 + share/examples/Makefile | 1 + share/zoneinfo/Makefile | 1 + usr.bin/apply/Makefile | 1 + usr.bin/basename/Makefile | 1 + usr.bin/bsdcat/Makefile | 1 + usr.bin/calendar/Makefile | 1 + usr.bin/cmp/Makefile | 1 + usr.bin/col/Makefile | 1 + usr.bin/comm/Makefile | 1 + usr.bin/compress/Makefile | 1 + usr.bin/cpio/Makefile | 1 + usr.bin/csplit/Makefile | 1 + usr.bin/cut/Makefile | 1 + usr.bin/diff/Makefile | 1 + usr.bin/diff3/Makefile | 1 + usr.bin/dirname/Makefile | 1 + usr.bin/file2c/Makefile | 1 + usr.bin/getconf/Makefile | 1 + usr.bin/grep/Makefile | 1 + usr.bin/gzip/Makefile | 1 + usr.bin/hexdump/Makefile | 1 + usr.bin/ident/Makefile | 1 + usr.bin/indent/Makefile | 1 + usr.bin/join/Makefile | 1 + usr.bin/jot/Makefile | 1 + usr.bin/lastcomm/Makefile | 1 + usr.bin/limits/Makefile | 1 + usr.bin/m4/Makefile | 1 + usr.bin/mkimg/Makefile | 1 + usr.bin/ncal/Makefile | 1 + usr.bin/pr/Makefile | 1 + usr.bin/printf/Makefile | 1 + usr.bin/procstat/Makefile | 1 + usr.bin/sdiff/Makefile | 1 + usr.bin/sed/Makefile | 1 + usr.bin/soelim/Makefile | 1 + usr.bin/tail/Makefile | 1 + usr.bin/tar/Makefile | 1 + usr.bin/timeout/Makefile | 1 + usr.bin/tr/Makefile | 1 + usr.bin/truncate/Makefile | 1 + usr.bin/uniq/Makefile | 1 + usr.bin/units/Makefile | 1 + usr.bin/uudecode/Makefile | 1 + usr.bin/uuencode/Makefile | 1 + usr.bin/xargs/Makefile | 1 + usr.bin/xinstall/Makefile | 1 + usr.bin/xo/Makefile | 1 + usr.bin/yacc/Makefile | 1 + usr.sbin/chown/Makefile | 1 + usr.sbin/etcupdate/Makefile | 1 + usr.sbin/extattr/Makefile | 1 + usr.sbin/fstyp/Makefile | 1 + usr.sbin/makefs/Makefile | 1 + usr.sbin/newsyslog/Makefile | 1 + usr.sbin/nmtree/Makefile | 1 + usr.sbin/pw/Makefile | 1 + usr.sbin/rpcbind/Makefile | 1 + usr.sbin/sa/Makefile | 1 + 98 files changed, 98 insertions(+) diff --git a/bin/cat/Makefile b/bin/cat/Makefile index 328692b30cd8..8d0a6e20c349 100644 --- a/bin/cat/Makefile +++ b/bin/cat/Makefile @@ -6,6 +6,7 @@ PACKAGE=runtime PROG= cat +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/date/Makefile b/bin/date/Makefile index 5e17c5826155..5e2e3d261536 100644 --- a/bin/date/Makefile +++ b/bin/date/Makefile @@ -7,6 +7,7 @@ PACKAGE=runtime PROG= date SRCS= date.c netdate.c vary.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/dd/Makefile b/bin/dd/Makefile index d845951616ac..2a9ff1f788f7 100644 --- a/bin/dd/Makefile +++ b/bin/dd/Makefile @@ -38,6 +38,7 @@ test: ${PROG} gen @rm -f gen 1M_zeroes* obs_zeroes +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/echo/Makefile b/bin/echo/Makefile index 2f97ea6e97e1..bd4455395ac4 100644 --- a/bin/echo/Makefile +++ b/bin/echo/Makefile @@ -6,6 +6,7 @@ PACKAGE=runtime PROG= echo +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/expr/Makefile b/bin/expr/Makefile index 622f420c32e1..dd74272e97b2 100644 --- a/bin/expr/Makefile +++ b/bin/expr/Makefile @@ -12,6 +12,7 @@ CFLAGS+= -fwrapv NO_WMISSING_VARIABLE_DECLARATIONS= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/ln/Makefile b/bin/ln/Makefile index 36afc57d8612..dfabafa09a5c 100644 --- a/bin/ln/Makefile +++ b/bin/ln/Makefile @@ -10,6 +10,7 @@ MAN= ln.1 symlink.7 LINKS= ${BINDIR}/ln ${BINDIR}/link MLINKS= ln.1 link.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/ls/Makefile b/bin/ls/Makefile index 1653d21b0d3e..607c6ad061ed 100644 --- a/bin/ls/Makefile +++ b/bin/ls/Makefile @@ -14,6 +14,7 @@ CFLAGS+= -DCOLORLS LIBADD+= termcapw .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/mv/Makefile b/bin/mv/Makefile index f51e96c498ed..e16243f06c3b 100644 --- a/bin/mv/Makefile +++ b/bin/mv/Makefile @@ -6,6 +6,7 @@ PACKAGE=runtime PROG= mv +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/pax/Makefile b/bin/pax/Makefile index 03ff95de3344..d0772ee49766 100644 --- a/bin/pax/Makefile +++ b/bin/pax/Makefile @@ -33,6 +33,7 @@ SRCS= ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c \ gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c \ tables.c tar.c tty_subs.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/pkill/Makefile b/bin/pkill/Makefile index 59ad1561f13f..bd755b822b7e 100644 --- a/bin/pkill/Makefile +++ b/bin/pkill/Makefile @@ -19,6 +19,7 @@ MLINKS= pkill.1 pgrep.1 SYMLINKS= ../..${BINDIR}/pkill /usr/bin/pkill SYMLINKS+= ../..${BINDIR}/pgrep /usr/bin/pgrep +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/sleep/Makefile b/bin/sleep/Makefile index 20a609a44054..8521a918f9c5 100644 --- a/bin/sleep/Makefile +++ b/bin/sleep/Makefile @@ -6,6 +6,7 @@ PACKAGE=runtime PROG= sleep +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/bin/test/Makefile b/bin/test/Makefile index 001b811c00c9..59ea2be99539 100644 --- a/bin/test/Makefile +++ b/bin/test/Makefile @@ -8,6 +8,7 @@ PROG= test LINKS= ${BINDIR}/test ${BINDIR}/[ MLINKS= test.1 [.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/atf/libatf-c++/Makefile b/lib/atf/libatf-c++/Makefile index 08fa39bac893..03e7d19c4440 100644 --- a/lib/atf/libatf-c++/Makefile +++ b/lib/atf/libatf-c++/Makefile @@ -72,6 +72,7 @@ INCSDIR_atf-c++.hpp= ${INCLUDEDIR} MAN= atf-c++.3 MLINKS+= atf-c++.3 atf-c-api++.3 # Backwards compatibility. +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include "../common.mk" diff --git a/lib/atf/libatf-c/Makefile b/lib/atf/libatf-c/Makefile index 4bb48694e817..e269839db8c1 100644 --- a/lib/atf/libatf-c/Makefile +++ b/lib/atf/libatf-c/Makefile @@ -97,6 +97,7 @@ INCSDIR_atf-c.h= ${INCLUDEDIR} MAN= atf-c.3 MLINKS+= atf-c.3 atf-c-api.3 # Backwards compatibility. +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include "../common.mk" diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile index 228854eeb3de..9935d927a03f 100644 --- a/lib/libarchive/Makefile +++ b/lib/libarchive/Makefile @@ -413,6 +413,7 @@ MLINKS+= archive_write_set_options.3 archive_write_set_format_option.3 MLINKS+= archive_write_set_options.3 archive_write_set_option.3 MLINKS+= libarchive.3 archive.3 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 2d4de5c0dfa6..1fcb7108d690 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -173,6 +173,7 @@ libkern.${LIBC_ARCH}:: ${KMSRCS} ${CP} ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH} .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libcasper/services/cap_dns/Makefile b/lib/libcasper/services/cap_dns/Makefile index 1317b317f5d7..4f89b0270ca3 100644 --- a/lib/libcasper/services/cap_dns/Makefile +++ b/lib/libcasper/services/cap_dns/Makefile @@ -18,6 +18,7 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libcasper/services/cap_grp/Makefile b/lib/libcasper/services/cap_grp/Makefile index 2363fa06eb18..5fba3d2ba7b0 100644 --- a/lib/libcasper/services/cap_grp/Makefile +++ b/lib/libcasper/services/cap_grp/Makefile @@ -18,6 +18,7 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libcasper/services/cap_pwd/Makefile b/lib/libcasper/services/cap_pwd/Makefile index 11c37bcd1bdd..e8c87d47b923 100644 --- a/lib/libcasper/services/cap_pwd/Makefile +++ b/lib/libcasper/services/cap_pwd/Makefile @@ -18,6 +18,7 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libcasper/services/cap_sysctl/Makefile b/lib/libcasper/services/cap_sysctl/Makefile index 32e1bef0f4f1..5b9960161932 100644 --- a/lib/libcasper/services/cap_sysctl/Makefile +++ b/lib/libcasper/services/cap_sysctl/Makefile @@ -18,6 +18,7 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libcrypt/Makefile b/lib/libcrypt/Makefile index 7842c49e7491..19a7ccb143d3 100644 --- a/lib/libcrypt/Makefile +++ b/lib/libcrypt/Makefile @@ -43,6 +43,7 @@ WARNS?= 2 PRECIOUSLIB= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libmp/Makefile b/lib/libmp/Makefile index 496c6839da60..9f001f521519 100644 --- a/lib/libmp/Makefile +++ b/lib/libmp/Makefile @@ -15,6 +15,7 @@ CFLAGS+= -I${SRCTOP}/crypto VERSION_DEF= ${SRCTOP}/lib/libc/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile index 9e4e7f1e20ca..6bba1f78a713 100644 --- a/lib/libnv/Makefile +++ b/lib/libnv/Makefile @@ -17,6 +17,7 @@ SRCS+= msgio.c SRCS+= nvlist.c SRCS+= nvpair.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libpathconv/Makefile b/lib/libpathconv/Makefile index 10da9bb08d6d..fd9924e686e3 100644 --- a/lib/libpathconv/Makefile +++ b/lib/libpathconv/Makefile @@ -13,6 +13,7 @@ SRCS= abs2rel.c rel2abs.c #VERSION_DEF= ${SRCTOP/lib/libc/Versions.def #SYMBOL_MAPS= ${.CURDIR}/Symbol.map +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile index e487cd207604..ed37b8acb3c0 100644 --- a/lib/libproc/Makefile +++ b/lib/libproc/Makefile @@ -41,6 +41,7 @@ SHLIB_MAJOR= 4 MAN= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/librt/Makefile b/lib/librt/Makefile index 97306ae59cff..3c0973db1d70 100644 --- a/lib/librt/Makefile +++ b/lib/librt/Makefile @@ -21,6 +21,7 @@ PRECIOUSLIB= VERSION_DEF=${SRCTOP}/lib/libc/Versions.def SYMBOL_MAPS=${.CURDIR}/Symbol.map +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile index 05c67fac087a..1843bce2539d 100644 --- a/lib/libthr/Makefile +++ b/lib/libthr/Makefile @@ -69,6 +69,7 @@ SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile index 176360c656f0..ae716352b1d5 100644 --- a/lib/libutil/Makefile +++ b/lib/libutil/Makefile @@ -84,6 +84,7 @@ MLINKS+=pw_util.3 pw_copy.3 \ pw_util.3 pw_tempname.3 \ pw_util.3 pw_tmp.3 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/libxo/Makefile b/lib/libxo/Makefile index 3bea6ebef71c..7844332862ad 100644 --- a/lib/libxo/Makefile +++ b/lib/libxo/Makefile @@ -110,6 +110,7 @@ MLINKS= xo_attr.3 xo_attr_h.3 \ xo_syslog.3 xo_set_logmask.3 \ xo_syslog.3 xo_vsyslog.3 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/lib/msun/Makefile b/lib/msun/Makefile index ced343d0d01c..ed9f96e61ae9 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -228,6 +228,7 @@ MLINKS+=trunc.3 truncf.3 trunc.3 truncl.3 .include +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/libexec/atf/atf-check/Makefile b/libexec/atf/atf-check/Makefile index 2533db4e7646..4fe6e4e7dbb9 100644 --- a/libexec/atf/atf-check/Makefile +++ b/libexec/atf/atf-check/Makefile @@ -40,6 +40,7 @@ CFLAGS+= -DATF_SHELL='"/bin/sh"' LIBADD= atf_cxx +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/libexec/atf/atf-sh/Makefile b/libexec/atf/atf-sh/Makefile index 17728677c335..dd8cfaf1775d 100644 --- a/libexec/atf/atf-sh/Makefile +++ b/libexec/atf/atf-sh/Makefile @@ -72,6 +72,7 @@ FILESGROUPS= SUBR SUBRDIR= ${SHAREDIR}/atf SUBR= libatf-sh.subr +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include "../../../lib/atf/common.mk" diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index fc535ce6f99a..5c4ecb4fe956 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -85,6 +85,7 @@ beforeinstall: .PATH: ${.CURDIR}/${RTLD_ARCH} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/sbin/devd/Makefile b/sbin/devd/Makefile index 3701e6e9457d..a035c92151b4 100644 --- a/sbin/devd/Makefile +++ b/sbin/devd/Makefile @@ -18,6 +18,7 @@ CFLAGS+=-I. -I${.CURDIR} CLEANFILES= y.output +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/sbin/dhclient/Makefile b/sbin/dhclient/Makefile index f4a9a331ca66..98beb6e44634 100644 --- a/sbin/dhclient/Makefile +++ b/sbin/dhclient/Makefile @@ -46,6 +46,7 @@ LIBADD= util WARNS?= 2 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/sbin/growfs/Makefile b/sbin/growfs/Makefile index 1adb0199e735..01a209849789 100644 --- a/sbin/growfs/Makefile +++ b/sbin/growfs/Makefile @@ -22,6 +22,7 @@ NO_WCAST_ALIGN= yes LIBADD= util +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile index 567734781b35..ae5b01682404 100644 --- a/sbin/ifconfig/Makefile +++ b/sbin/ifconfig/Makefile @@ -67,6 +67,7 @@ MAN= ifconfig.8 CFLAGS+= -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wnested-externs WARNS?= 2 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/sbin/mdconfig/Makefile b/sbin/mdconfig/Makefile index eeb2a93d2023..1cf610cb5939 100644 --- a/sbin/mdconfig/Makefile +++ b/sbin/mdconfig/Makefile @@ -8,6 +8,7 @@ MAN= mdconfig.8 LIBADD= util geom +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index f182dde1790e..de1f64dd0269 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -31,6 +31,7 @@ YFLAGS= LIBADD= m md +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/share/examples/Makefile b/share/examples/Makefile index 40c0ce549701..7e3bfe6c5684 100644 --- a/share/examples/Makefile +++ b/share/examples/Makefile @@ -266,6 +266,7 @@ SUBDIR+=pf .endif .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests SUBDIR_PARALLEL= diff --git a/share/zoneinfo/Makefile b/share/zoneinfo/Makefile index a1e1aa223cca..fbe47ff570a6 100644 --- a/share/zoneinfo/Makefile +++ b/share/zoneinfo/Makefile @@ -131,6 +131,7 @@ afterinstall: echo "Run tzsetup(8) manually to update /etc/localtime."; \ fi +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/apply/Makefile b/usr.bin/apply/Makefile index 9234077aaf18..7af4395be78f 100644 --- a/usr.bin/apply/Makefile +++ b/usr.bin/apply/Makefile @@ -7,6 +7,7 @@ PROG= apply LIBADD= sbuf +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/basename/Makefile b/usr.bin/basename/Makefile index 2fbb26488bf6..1849181a6ef9 100644 --- a/usr.bin/basename/Makefile +++ b/usr.bin/basename/Makefile @@ -6,6 +6,7 @@ PROG= basename MLINKS= basename.1 dirname.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/bsdcat/Makefile b/usr.bin/bsdcat/Makefile index 8ea5dee7398e..78780effd700 100644 --- a/usr.bin/bsdcat/Makefile +++ b/usr.bin/bsdcat/Makefile @@ -24,6 +24,7 @@ LIBADD= archive CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/calendar/Makefile b/usr.bin/calendar/Makefile index 53bd4675b948..8df56c42ff9d 100644 --- a/usr.bin/calendar/Makefile +++ b/usr.bin/calendar/Makefile @@ -33,6 +33,7 @@ beforeinstall: ${DESTDIR}${SHAREDIR}/calendar/${link} .endfor +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/cmp/Makefile b/usr.bin/cmp/Makefile index 0f515f4af5f5..bcde84f0255a 100644 --- a/usr.bin/cmp/Makefile +++ b/usr.bin/cmp/Makefile @@ -6,6 +6,7 @@ PROG= cmp SRCS= cmp.c link.c misc.c regular.c special.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/col/Makefile b/usr.bin/col/Makefile index 8773b5dc58ba..f0cf7f76d25d 100644 --- a/usr.bin/col/Makefile +++ b/usr.bin/col/Makefile @@ -5,6 +5,7 @@ PROG= col +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/comm/Makefile b/usr.bin/comm/Makefile index 2392035e6c39..b28260f1b6ff 100644 --- a/usr.bin/comm/Makefile +++ b/usr.bin/comm/Makefile @@ -5,6 +5,7 @@ PROG= comm +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/compress/Makefile b/usr.bin/compress/Makefile index bfe46b5da868..1443b96b1abc 100644 --- a/usr.bin/compress/Makefile +++ b/usr.bin/compress/Makefile @@ -11,6 +11,7 @@ MLINKS= compress.1 uncompress.1 # XXX zopen is not part of libc # MAN=zopen.3 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/cpio/Makefile b/usr.bin/cpio/Makefile index 46cf06e871c1..666bb88ffb19 100644 --- a/usr.bin/cpio/Makefile +++ b/usr.bin/cpio/Makefile @@ -32,6 +32,7 @@ CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const SYMLINKS=bsdcpio ${BINDIR}/cpio MLINKS= bsdcpio.1 cpio.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/csplit/Makefile b/usr.bin/csplit/Makefile index af23872b969d..1c455c3bc033 100644 --- a/usr.bin/csplit/Makefile +++ b/usr.bin/csplit/Makefile @@ -4,6 +4,7 @@ PROG= csplit +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/cut/Makefile b/usr.bin/cut/Makefile index 9321756aae86..40a12d53cba8 100644 --- a/usr.bin/cut/Makefile +++ b/usr.bin/cut/Makefile @@ -5,6 +5,7 @@ PROG= cut +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/diff/Makefile b/usr.bin/diff/Makefile index 0293d167a6b7..18c4495cf1c7 100644 --- a/usr.bin/diff/Makefile +++ b/usr.bin/diff/Makefile @@ -5,6 +5,7 @@ PROG= diff SRCS= diff.c diffdir.c diffreg.c xmalloc.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/diff3/Makefile b/usr.bin/diff3/Makefile index 03cf52ad9876..fb56e8861955 100644 --- a/usr.bin/diff3/Makefile +++ b/usr.bin/diff3/Makefile @@ -4,6 +4,7 @@ PROG= diff3 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/dirname/Makefile b/usr.bin/dirname/Makefile index 3353371c8963..ad16e032fbfb 100644 --- a/usr.bin/dirname/Makefile +++ b/usr.bin/dirname/Makefile @@ -6,6 +6,7 @@ PROG= dirname MAN= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/file2c/Makefile b/usr.bin/file2c/Makefile index 0f0f8af595c5..f8216adc660b 100644 --- a/usr.bin/file2c/Makefile +++ b/usr.bin/file2c/Makefile @@ -4,6 +4,7 @@ PROG= file2c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/getconf/Makefile b/usr.bin/getconf/Makefile index 46e999c86258..a5cdc0423a25 100644 --- a/usr.bin/getconf/Makefile +++ b/usr.bin/getconf/Makefile @@ -37,6 +37,7 @@ conflicting.names: confstr.names limits.names sysconf.names unique.names: conflicting.names LC_ALL=C sort -u ${.ALLSRC} >${.TARGET} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/grep/Makefile b/usr.bin/grep/Makefile index c6d4c2f5cdf9..5166303c09eb 100644 --- a/usr.bin/grep/Makefile +++ b/usr.bin/grep/Makefile @@ -92,6 +92,7 @@ LIBADD+= gnuregex CFLAGS+= -DWITHOUT_NLS .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/gzip/Makefile b/usr.bin/gzip/Makefile index 2a69ac139fa5..ef78508140a7 100644 --- a/usr.bin/gzip/Makefile +++ b/usr.bin/gzip/Makefile @@ -27,6 +27,7 @@ LINKS+= ${BINDIR}/gzip ${BINDIR}/gunzip \ ${BINDIR}/gzip ${BINDIR}/zcat \ ${BINDIR}/zdiff ${BINDIR}/zcmp +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/hexdump/Makefile b/usr.bin/hexdump/Makefile index fd8494c74ed5..276234d1e613 100644 --- a/usr.bin/hexdump/Makefile +++ b/usr.bin/hexdump/Makefile @@ -10,6 +10,7 @@ MLINKS= hexdump.1 hd.1 LINKS= ${BINDIR}/hexdump ${BINDIR}/od LINKS+= ${BINDIR}/hexdump ${BINDIR}/hd +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/ident/Makefile b/usr.bin/ident/Makefile index e8c58c4e93d9..e0a3a80f7b09 100644 --- a/usr.bin/ident/Makefile +++ b/usr.bin/ident/Makefile @@ -6,6 +6,7 @@ PROG= ident LIBADD= sbuf +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/indent/Makefile b/usr.bin/indent/Makefile index 6ab3b2b3831a..0847a2f9fb9c 100644 --- a/usr.bin/indent/Makefile +++ b/usr.bin/indent/Makefile @@ -8,6 +8,7 @@ SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c NO_WMISSING_VARIABLE_DECLARATIONS= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/join/Makefile b/usr.bin/join/Makefile index 575f7abedef8..a0998ad441ce 100644 --- a/usr.bin/join/Makefile +++ b/usr.bin/join/Makefile @@ -5,6 +5,7 @@ PROG= join +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/jot/Makefile b/usr.bin/jot/Makefile index cc802676fb23..81035c335886 100644 --- a/usr.bin/jot/Makefile +++ b/usr.bin/jot/Makefile @@ -5,6 +5,7 @@ PROG= jot +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/lastcomm/Makefile b/usr.bin/lastcomm/Makefile index 83a4f96a4c87..61731b8746d2 100644 --- a/usr.bin/lastcomm/Makefile +++ b/usr.bin/lastcomm/Makefile @@ -8,6 +8,7 @@ PACKAGE=acct PROG= lastcomm SRCS= lastcomm.c readrec.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/limits/Makefile b/usr.bin/limits/Makefile index 5a5af98f3023..68e540df3a49 100644 --- a/usr.bin/limits/Makefile +++ b/usr.bin/limits/Makefile @@ -5,6 +5,7 @@ PROG= limits LIBADD= util +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile index ffd13d0fdba2..a25995cb9fd6 100644 --- a/usr.bin/m4/Makefile +++ b/usr.bin/m4/Makefile @@ -20,6 +20,7 @@ tokenizer.o: parser.h CLEANFILES+= parser.c parser.h tokenizer.o +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/mkimg/Makefile b/usr.bin/mkimg/Makefile index 68274a4b3763..451abe378bfe 100644 --- a/usr.bin/mkimg/Makefile +++ b/usr.bin/mkimg/Makefile @@ -35,6 +35,7 @@ LIBADD= util WARNS?= 6 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/ncal/Makefile b/usr.bin/ncal/Makefile index c42ed905b11a..8cfd9b1c62e0 100644 --- a/usr.bin/ncal/Makefile +++ b/usr.bin/ncal/Makefile @@ -9,6 +9,7 @@ LIBADD= calendar ncursesw LINKS= ${BINDIR}/ncal ${BINDIR}/cal MLINKS= ncal.1 cal.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/pr/Makefile b/usr.bin/pr/Makefile index 6796ea8a8157..15ffee098160 100644 --- a/usr.bin/pr/Makefile +++ b/usr.bin/pr/Makefile @@ -6,6 +6,7 @@ PROG= pr SRCS= pr.c egetopt.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/printf/Makefile b/usr.bin/printf/Makefile index b1b39308e969..54d6f5c8ed39 100644 --- a/usr.bin/printf/Makefile +++ b/usr.bin/printf/Makefile @@ -5,6 +5,7 @@ PROG= printf +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/procstat/Makefile b/usr.bin/procstat/Makefile index ed07e634fcc1..03b6cdf933ba 100644 --- a/usr.bin/procstat/Makefile +++ b/usr.bin/procstat/Makefile @@ -22,6 +22,7 @@ SRCS= procstat.c \ LIBADD+= procstat xo util sbuf +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/sdiff/Makefile b/usr.bin/sdiff/Makefile index 0fa5985c66fe..bc25ac883106 100644 --- a/usr.bin/sdiff/Makefile +++ b/usr.bin/sdiff/Makefile @@ -8,6 +8,7 @@ WARNS= 3 MAN1= sdiff.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/sed/Makefile b/usr.bin/sed/Makefile index 803de6db23c4..e36feb94c7a5 100644 --- a/usr.bin/sed/Makefile +++ b/usr.bin/sed/Makefile @@ -8,6 +8,7 @@ SRCS= compile.c main.c misc.c process.c WARNS?= 2 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/soelim/Makefile b/usr.bin/soelim/Makefile index eda319b1f967..5e9734d0fb82 100644 --- a/usr.bin/soelim/Makefile +++ b/usr.bin/soelim/Makefile @@ -4,6 +4,7 @@ PROG= soelim +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/tail/Makefile b/usr.bin/tail/Makefile index 8012419affb5..d586afe01c18 100644 --- a/usr.bin/tail/Makefile +++ b/usr.bin/tail/Makefile @@ -6,6 +6,7 @@ PROG= tail SRCS= forward.c misc.c read.c reverse.c tail.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/tar/Makefile b/usr.bin/tar/Makefile index 91e51a4b394e..ad50f7d475e1 100644 --- a/usr.bin/tar/Makefile +++ b/usr.bin/tar/Makefile @@ -33,6 +33,7 @@ CFLAGS+= -I${_LIBARCHIVEDIR}/libarchive_fe SYMLINKS= bsdtar ${BINDIR}/tar MLINKS= bsdtar.1 tar.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/timeout/Makefile b/usr.bin/timeout/Makefile index 72c855813982..fc1c87edfb7a 100644 --- a/usr.bin/timeout/Makefile +++ b/usr.bin/timeout/Makefile @@ -4,6 +4,7 @@ PROG= timeout +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/tr/Makefile b/usr.bin/tr/Makefile index 0cd24502e991..abe032ba266d 100644 --- a/usr.bin/tr/Makefile +++ b/usr.bin/tr/Makefile @@ -6,6 +6,7 @@ PROG= tr SRCS= cmap.c cset.c str.c tr.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/truncate/Makefile b/usr.bin/truncate/Makefile index 2f607d440830..72deb0dd4e77 100644 --- a/usr.bin/truncate/Makefile +++ b/usr.bin/truncate/Makefile @@ -5,6 +5,7 @@ PROG= truncate LIBADD= util +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/uniq/Makefile b/usr.bin/uniq/Makefile index ab811d458022..5ad8a8e6b4d9 100644 --- a/usr.bin/uniq/Makefile +++ b/usr.bin/uniq/Makefile @@ -5,6 +5,7 @@ PROG= uniq +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/units/Makefile b/usr.bin/units/Makefile index 78d843e7794f..7bc1ac89c296 100644 --- a/usr.bin/units/Makefile +++ b/usr.bin/units/Makefile @@ -8,6 +8,7 @@ FILESDIR= ${SHAREDIR}/misc LIBADD= edit +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/uudecode/Makefile b/usr.bin/uudecode/Makefile index 83fbd64fee87..dbcbe8d93b8a 100644 --- a/usr.bin/uudecode/Makefile +++ b/usr.bin/uudecode/Makefile @@ -7,6 +7,7 @@ PROG= uudecode LINKS= ${BINDIR}/uudecode ${BINDIR}/b64decode MAN= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/uuencode/Makefile b/usr.bin/uuencode/Makefile index fac6ef83f8b0..5897d89dc057 100644 --- a/usr.bin/uuencode/Makefile +++ b/usr.bin/uuencode/Makefile @@ -11,6 +11,7 @@ MLINKS= uuencode.1 uudecode.1 \ uuencode.1 b64encode.1 \ b64encode.1 b64decode.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/xargs/Makefile b/usr.bin/xargs/Makefile index caf6d9dd9df6..04cc44840a63 100644 --- a/usr.bin/xargs/Makefile +++ b/usr.bin/xargs/Makefile @@ -6,6 +6,7 @@ PROG= xargs SRCS= xargs.c strnsubst.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/xinstall/Makefile b/usr.bin/xinstall/Makefile index 3fffb2f7d97b..4bc0d006cb98 100644 --- a/usr.bin/xinstall/Makefile +++ b/usr.bin/xinstall/Makefile @@ -14,6 +14,7 @@ CFLAGS+= -I${SRCTOP}/lib/libnetbsd LIBADD= md +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/xo/Makefile b/usr.bin/xo/Makefile index e4a765120e97..6a60768b2fd6 100644 --- a/usr.bin/xo/Makefile +++ b/usr.bin/xo/Makefile @@ -18,6 +18,7 @@ CFLAGS+=-I${SRCTOP}/lib/libxo LIBADD= xo util +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.bin/yacc/Makefile b/usr.bin/yacc/Makefile index 455c4b93b230..026a6ccc43fe 100644 --- a/usr.bin/yacc/Makefile +++ b/usr.bin/yacc/Makefile @@ -21,6 +21,7 @@ CFLAGS+= -DYYPATCH=${YYPATCH} LINKS= ${BINDIR}/yacc ${BINDIR}/byacc MLINKS= yacc.1 byacc.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.sbin/chown/Makefile b/usr.sbin/chown/Makefile index 8c15ade02e53..b9dff0785363 100644 --- a/usr.sbin/chown/Makefile +++ b/usr.sbin/chown/Makefile @@ -7,6 +7,7 @@ PROG= chown LINKS= ${BINDIR}/chown /usr/bin/chgrp MAN= chgrp.1 chown.8 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.sbin/etcupdate/Makefile b/usr.sbin/etcupdate/Makefile index bfdf1953b265..46edaf03baf1 100644 --- a/usr.sbin/etcupdate/Makefile +++ b/usr.sbin/etcupdate/Makefile @@ -5,6 +5,7 @@ SCRIPTS=etcupdate.sh MAN= etcupdate.8 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.sbin/extattr/Makefile b/usr.sbin/extattr/Makefile index 3d72c219024d..253b61b5a9ac 100644 --- a/usr.sbin/extattr/Makefile +++ b/usr.sbin/extattr/Makefile @@ -15,6 +15,7 @@ MLINKS+= rmextattr.8 lsextattr.8 .include +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.sbin/fstyp/Makefile b/usr.sbin/fstyp/Makefile index f852ff7ccb53..34be663fc362 100644 --- a/usr.sbin/fstyp/Makefile +++ b/usr.sbin/fstyp/Makefile @@ -16,6 +16,7 @@ WARNS?= 2 .include .if ${TARGET_ENDIANNESS} == 1234 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .endif diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile index 79a2e767c742..8eb19256e479 100644 --- a/usr.sbin/makefs/Makefile +++ b/usr.sbin/makefs/Makefile @@ -35,6 +35,7 @@ SRCS+= ffs_tables.c CFLAGS+= -I${SRCTOP}/lib/libnetbsd LIBADD= netbsd util sbuf +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.sbin/newsyslog/Makefile b/usr.sbin/newsyslog/Makefile index 77f40c23123b..6a06941eb497 100644 --- a/usr.sbin/newsyslog/Makefile +++ b/usr.sbin/newsyslog/Makefile @@ -6,6 +6,7 @@ PROG= newsyslog MAN= newsyslog.8 newsyslog.conf.5 SRCS= newsyslog.c ptimes.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.sbin/nmtree/Makefile b/usr.sbin/nmtree/Makefile index 1f88ba6f5662..c29974ff7fcc 100644 --- a/usr.sbin/nmtree/Makefile +++ b/usr.sbin/nmtree/Makefile @@ -19,6 +19,7 @@ LIBADD= netbsd md util LINKS= ${BINDIR}/mtree ${BINDIR}/nmtree MLINKS= mtree.8 nmtree.8 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.sbin/pw/Makefile b/usr.sbin/pw/Makefile index bdb4384d1cc5..8db96d90f6e2 100644 --- a/usr.sbin/pw/Makefile +++ b/usr.sbin/pw/Makefile @@ -12,6 +12,7 @@ LIBADD= crypt util sbuf .include +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include diff --git a/usr.sbin/rpcbind/Makefile b/usr.sbin/rpcbind/Makefile index 1e9e5f705479..eb7baa7fbcfc 100644 --- a/usr.sbin/rpcbind/Makefile +++ b/usr.sbin/rpcbind/Makefile @@ -23,6 +23,7 @@ CFLAGS+= -DLIBWRAP LIBADD+= wrap .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests WARNS?= 1 diff --git a/usr.sbin/sa/Makefile b/usr.sbin/sa/Makefile index a7ffccf03c44..375b8045e81f 100644 --- a/usr.sbin/sa/Makefile +++ b/usr.sbin/sa/Makefile @@ -10,6 +10,7 @@ SRCS= main.c db.c pdb.c usrdb.c readrec.c PACKAGE=acct +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include From fa895917d30d3a497cbb177a173caf8071f99e98 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 20:23:25 +0000 Subject: [PATCH 07/16] Only tweak DESTDIR, etc if actively invoking "make check" This fixes "make installworld"/"make install" (standard use). --- share/mk/suite.test.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/suite.test.mk b/share/mk/suite.test.mk index a2068fe9e328..5bc13f6b7642 100644 --- a/share/mk/suite.test.mk +++ b/share/mk/suite.test.mk @@ -101,7 +101,7 @@ realcheck: .PHONY fi @env ${TESTS_ENV:Q} ${KYUA} test -k ${CHECKDIR}/Kyuafile -.ifdef _TESTS_USE_OBJDIR +.if defined(_TESTS_USE_OBJDIR) && make(check) DESTDIR:= ${.OBJDIR}/checkdir CLEANDIRS+= ${DESTDIR} From a1c2413d526b9f8092ce51d25a1ef9b599e831a9 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 21:52:59 +0000 Subject: [PATCH 08/16] Promote MK_TESTS from src.opts.mk to bsd.opts.mk This knob is needed here to avoid polluting suite.tests.mk with src.opts.mk for a knob that will be introduced in the following commit. --- share/mk/bsd.opts.mk | 1 + share/mk/src.opts.mk | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index bdfff5acc5ba..4f619a1dc3d7 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -63,6 +63,7 @@ __DEFAULT_YES_OPTIONS = \ PROFILE \ SSP \ SYMVER \ + TESTS \ TOOLCHAIN \ WARNS diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 925b23d14e80..73ec2aff0c3d 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -160,7 +160,6 @@ __DEFAULT_YES_OPTIONS = \ TCP_WRAPPERS \ TCSH \ TELNET \ - TESTS \ TEXTPROC \ TFTP \ TIMED \ From 2b2566c4c4bf0b06549e9c70d4c0b23d2a197992 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 22:01:06 +0000 Subject: [PATCH 09/16] Expose _TESTS_USE_OBJDIR as MK_MAKE_CHECK_USE_SANDBOX and anchor the default value on MK_TESTS. Use bsd.opts.mk in suite.test.mk to toggle the behavior. --- share/mk/bsd.lib.mk | 2 +- share/mk/bsd.opts.mk | 2 ++ share/mk/bsd.prog.mk | 2 +- share/mk/suite.test.mk | 4 +++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 6005d8c1651d..d3ad574f7295 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -443,7 +443,7 @@ OBJS_DEPEND_GUESS.${_S:R}.pico+= ${_S} .endif .if defined(HAS_TESTS) -MAKE+= -D_TESTS_USE_OBJDIR +MAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes SUBDIR_TARGETS+= check TESTS_LD_LIBRARY_PATH+= ${.OBJDIR} .endif diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index 4f619a1dc3d7..ba7cbca6db84 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -55,6 +55,7 @@ __DEFAULT_YES_OPTIONS = \ INCLUDES \ INSTALLLIB \ KERBEROS \ + MAKE_CHECK_USE_SANDBOX \ MAN \ MANCOMPRESS \ NIS \ @@ -75,6 +76,7 @@ __DEFAULT_NO_OPTIONS = \ # meta mode related __DEFAULT_DEPENDENT_OPTIONS = \ + MAKE_CHECK_USE_SANDBOX/TESTS STAGING_MAN/STAGING \ STAGING_PROG/STAGING \ STALE_STAGED/STAGING \ diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 3894b369e6c5..960499e30dd8 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -306,7 +306,7 @@ lint: ${SRCS:M*.c} .endif .if defined(HAS_TESTS) -MAKE+= -D_TESTS_USE_OBJDIR +MAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes SUBDIR_TARGETS+= check TESTS_LD_LIBRARY_PATH+= ${.OBJDIR} TESTS_PATH+= ${.OBJDIR} diff --git a/share/mk/suite.test.mk b/share/mk/suite.test.mk index 5bc13f6b7642..e0a854297ef0 100644 --- a/share/mk/suite.test.mk +++ b/share/mk/suite.test.mk @@ -8,6 +8,8 @@ .error suite.test.mk cannot be included directly. .endif +.include + # Name of the test suite these tests belong to. Should rarely be changed for # Makefiles built into the FreeBSD src tree. TESTSUITE?= FreeBSD @@ -101,7 +103,7 @@ realcheck: .PHONY fi @env ${TESTS_ENV:Q} ${KYUA} test -k ${CHECKDIR}/Kyuafile -.if defined(_TESTS_USE_OBJDIR) && make(check) +.if ${MK_MAKE_CHECK_USE_SANDBOX} && make(check) DESTDIR:= ${.OBJDIR}/checkdir CLEANDIRS+= ${DESTDIR} From 927b89d07b5234a83a5f0341d03ca83804960249 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 22:02:33 +0000 Subject: [PATCH 10/16] Fix typo with missing line continuation added in r321956 --- share/mk/bsd.opts.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index ba7cbca6db84..5ecddeac957c 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -76,7 +76,7 @@ __DEFAULT_NO_OPTIONS = \ # meta mode related __DEFAULT_DEPENDENT_OPTIONS = \ - MAKE_CHECK_USE_SANDBOX/TESTS + MAKE_CHECK_USE_SANDBOX/TESTS \ STAGING_MAN/STAGING \ STAGING_PROG/STAGING \ STALE_STAGED/STAGING \ From eb51cdee612cda60747fb8e0d8eb8808ec54330d Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 22:08:49 +0000 Subject: [PATCH 11/16] Extend r321900 (_FILESMKDIR) support to ${PROG} --- share/mk/bsd.prog.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 960499e30dd8..b002b49f2457 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -229,6 +229,9 @@ _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} realinstall: _proginstall .ORDER: beforeinstall _proginstall _proginstall: +.ifdef _FILESMKDIR + ${INSTALL} -d ${DESTDIR}${BINDIR} +.endif .if defined(PROG) ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME} From 47606b869eb149ebb7135d6594c3b9b9f05b9aed Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 2 Aug 2017 22:24:08 +0000 Subject: [PATCH 12/16] Use MK_CHECK_USE_SANDBOX in tests/..., to deal with the fact that tests/... is a special snowflake directory and using HAS_TESTS would result in a nasty layering violation between bsd.tests.mk and bsd.prog.mk. Add reachover Makefile.inc's which get the default value from Makefile.inc0 (inspired by gnu/usr.bin/binutils/Makefile.inc0). --- tests/Makefile | 1 + tests/Makefile.inc0 | 9 +++++++++ tests/etc/Makefile.inc | 3 +++ tests/sys/Makefile.inc | 2 ++ tests/sys/geom/class/Makefile.inc | 3 +++ tests/sys/pjdfstest/Makefile.inc | 3 +++ tests/sys/pjdfstest/tests/Makefile.inc | 3 +++ 7 files changed, 24 insertions(+) create mode 100644 tests/Makefile.inc0 create mode 100644 tests/etc/Makefile.inc create mode 100644 tests/sys/geom/class/Makefile.inc create mode 100644 tests/sys/pjdfstest/Makefile.inc create mode 100644 tests/sys/pjdfstest/tests/Makefile.inc diff --git a/tests/Makefile b/tests/Makefile index 0aed9cfb1b83..a8491fcb937d 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -17,4 +17,5 @@ afterinstall: install-tests-local install-tests-local: .PHONY ${INSTALL_SYMLINK} ../local/tests ${DESTDIR}${TESTSDIR}/local +.include "Makefile.inc0" .include diff --git a/tests/Makefile.inc0 b/tests/Makefile.inc0 new file mode 100644 index 000000000000..84e1307a2386 --- /dev/null +++ b/tests/Makefile.inc0 @@ -0,0 +1,9 @@ +# $FreeBSD$ + +# tests/... doesn't conform to bsd.lib.mk and bsd.prog.mk, so specify a sane +# default for MK_CHECK_USE_SANDBOX. src.opts.mk will override the value if the +# user sets it to no. +MK_CHECK_USE_SANDBOX= yes + +.include + diff --git a/tests/etc/Makefile.inc b/tests/etc/Makefile.inc new file mode 100644 index 000000000000..2cba822015ae --- /dev/null +++ b/tests/etc/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "${SRCTOP}/tests/Makefile.inc0" diff --git a/tests/sys/Makefile.inc b/tests/sys/Makefile.inc index f3418421919d..0b336d3f3ef3 100644 --- a/tests/sys/Makefile.inc +++ b/tests/sys/Makefile.inc @@ -1,3 +1,5 @@ # $FreeBSD$ WARNS?= 6 + +.include "${SRCTOP}/tests/Makefile.inc0" diff --git a/tests/sys/geom/class/Makefile.inc b/tests/sys/geom/class/Makefile.inc new file mode 100644 index 000000000000..2cba822015ae --- /dev/null +++ b/tests/sys/geom/class/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "${SRCTOP}/tests/Makefile.inc0" diff --git a/tests/sys/pjdfstest/Makefile.inc b/tests/sys/pjdfstest/Makefile.inc new file mode 100644 index 000000000000..2cba822015ae --- /dev/null +++ b/tests/sys/pjdfstest/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "${SRCTOP}/tests/Makefile.inc0" diff --git a/tests/sys/pjdfstest/tests/Makefile.inc b/tests/sys/pjdfstest/tests/Makefile.inc new file mode 100644 index 000000000000..265f86d1ed55 --- /dev/null +++ b/tests/sys/pjdfstest/tests/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" From 341d6b357972eaf78e8f0ef4222ad1c19f464916 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 3 Aug 2017 00:35:35 +0000 Subject: [PATCH 13/16] Use bsd.opts.mk, not src.opts.mk --- tests/Makefile.inc0 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Makefile.inc0 b/tests/Makefile.inc0 index 84e1307a2386..4ba8992bda93 100644 --- a/tests/Makefile.inc0 +++ b/tests/Makefile.inc0 @@ -5,5 +5,4 @@ # user sets it to no. MK_CHECK_USE_SANDBOX= yes -.include - +.include From df282f08bd18da2f0401392bd2de7c575645d3fd Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 3 Aug 2017 14:08:39 +0000 Subject: [PATCH 14/16] Fix last minute change I made for checking ${MK_MAKE_CHECK_USE_SANDBOX} It needs to be compared against == "yes", not evaluated for its existence, i.e., as a boolean sentinel. --- share/mk/suite.test.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/suite.test.mk b/share/mk/suite.test.mk index e0a854297ef0..6b09d59a7867 100644 --- a/share/mk/suite.test.mk +++ b/share/mk/suite.test.mk @@ -103,7 +103,7 @@ realcheck: .PHONY fi @env ${TESTS_ENV:Q} ${KYUA} test -k ${CHECKDIR}/Kyuafile -.if ${MK_MAKE_CHECK_USE_SANDBOX} && make(check) +.if ${MK_MAKE_CHECK_USE_SANDBOX} != "no" && make(check) DESTDIR:= ${.OBJDIR}/checkdir CLEANDIRS+= ${DESTDIR} From 8b4f2f919e0aef524d0e37c76d75ce8450073100 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 3 Aug 2017 17:33:59 +0000 Subject: [PATCH 15/16] Expand _FILESMKDIR to bsd.lib.mk I think I really need to rename this internal variable.. --- share/mk/bsd.lib.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index d3ad574f7295..e89c6a0acf25 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -343,14 +343,23 @@ realinstall: _libinstall .ORDER: beforeinstall _libinstall _libinstall: .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no" +.ifdef _FILESMKDIR + ${INSTALL} -d ${DESTDIR}${_LIBDIR}/ +.endif ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}.a ${DESTDIR}${_LIBDIR}/ .endif .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) +.ifdef _FILESMKDIR + ${INSTALL} -d ${DESTDIR}${_LIBDIR}/ +.endif ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},profile} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}_p.a ${DESTDIR}${_LIBDIR}/ .endif .if defined(SHLIB_NAME) +.ifdef _FILESMKDIR + ${INSTALL} -d ${DESTDIR}${_SHLIBDIR}/ +.endif ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/ From 9dd275b507e51c1221c997c0ec90c02d234298ba Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 3 Aug 2017 17:42:13 +0000 Subject: [PATCH 16/16] Always expose DESTDIR as MAKE_CHECK_SANDBOX_DIR and always add it to CLEANDIRS This removes a need for passing CLEANDIRS in to "make clean" in a slightly convoluted way. Also, remove the ${MAKE_CHECK_SANDBOX_DIR} is already present -> bail logic. It was incredibly annoying dealing with false positives/failures (of which there are a handful in the tree with tests). It's better to just assume that the user is smart enough to do the right thing and not invoke "make check" (sandboxed) multiple times, keeping ${MAKE_CHECK_SANDBOX_DIR}. --- share/mk/suite.test.mk | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/share/mk/suite.test.mk b/share/mk/suite.test.mk index 6b09d59a7867..194b9f422b70 100644 --- a/share/mk/suite.test.mk +++ b/share/mk/suite.test.mk @@ -103,18 +103,13 @@ realcheck: .PHONY fi @env ${TESTS_ENV:Q} ${KYUA} test -k ${CHECKDIR}/Kyuafile -.if ${MK_MAKE_CHECK_USE_SANDBOX} != "no" && make(check) -DESTDIR:= ${.OBJDIR}/checkdir -CLEANDIRS+= ${DESTDIR} +MAKE_CHECK_SANDBOX_DIR= ${.OBJDIR}/checkdir +CLEANDIRS+= ${MAKE_CHECK_SANDBOX_DIR} + +.if ${MK_MAKE_CHECK_USE_SANDBOX} != "no" && make(check) +DESTDIR:= ${MAKE_CHECK_SANDBOX_DIR} -# XXX (ngie): use daemon(1) and a pidfile to lock the directory? beforecheck: - @if [ -d "${DESTDIR}" ]; then \ - echo "${DESTDIR} already exists"; \ - echo "Aborting to avoid false positives with potentially" \ - "parallel instances of '${MAKE} check'"; \ - false; \ - fi .for t in clean all @cd ${.CURDIR} && ${MAKE} $t .endfor