diff --git a/share/mk/Makefile b/share/mk/Makefile index 29de04f89670..837f7da68b4b 100644 --- a/share/mk/Makefile +++ b/share/mk/Makefile @@ -1,99 +1,100 @@ # Only parse this if executing make in this directory, not in other places # in src that lack a Makefile, such as sys/dev/*. Otherwise the MAKESYSPATH # will read this Makefile since it auto includes it into -I. .if ${.CURDIR} == ${.PARSEDIR} # Avoid creating a Makefile.depend here as it would get included anywhere # in the build, similar to the problem above. It would cause dirdeps.mk # to be included more times than desired. UPDATE_DEPENDFILE= no .include FILES= \ auto.obj.mk \ bsd.README \ bsd.arch.inc.mk \ bsd.clang-analyze.mk \ bsd.compiler.mk \ bsd.compat.mk \ bsd.compat.pre.mk \ bsd.confs.mk \ bsd.cpu.mk \ bsd.crunchgen.mk \ bsd.dep.mk \ bsd.dirs.mk \ bsd.doc.mk \ bsd.dtb.mk \ bsd.endian.mk \ bsd.files.mk \ bsd.incs.mk \ bsd.info.mk \ bsd.init.mk \ bsd.kmod.mk \ bsd.lib.mk \ bsd.libnames.mk \ bsd.linker.mk \ bsd.links.mk \ bsd.man.mk \ bsd.mkopt.mk \ bsd.nls.mk \ bsd.obj.mk \ bsd.opts.mk \ bsd.own.mk \ bsd.port.mk \ bsd.port.options.mk \ bsd.port.post.mk \ bsd.port.pre.mk \ bsd.port.subdir.mk \ bsd.prog.mk \ bsd.progs.mk \ bsd.snmpmod.mk \ bsd.subdir.mk \ bsd.suffixes-extra.mk \ bsd.suffixes-posix.mk \ bsd.suffixes.mk \ bsd.symver.mk \ bsd.sys.mk \ bsd.sysdir.mk \ bsd.test.mk \ dirdeps.mk \ dirdeps-options.mk \ dirdeps-targets.mk \ gendirdeps.mk \ host-target.mk \ + host.test.mk \ install-new.mk \ jobs.mk \ meta.autodep.mk \ meta.stage.mk \ meta.subdir.mk \ meta.sys.mk \ meta2deps.py \ meta2deps.sh \ ${SRCTOP}/contrib/bmake/mk/newlog.sh \ ${SRCTOP}/contrib/bmake/mk/posix.mk \ stage-install.sh \ ${SRCTOP}/contrib/bmake/mk/setopts.sh \ sys.mk \ sys.dependfile.mk \ sys.dirdeps.mk \ version_gen.awk FILESDIR= ${BINDIR}/mk # make sure scripts are executable .for file in ${FILES:M*.sh} ${FILES:M*.py} FILESMODE_${file} = 555 .endfor .if ${MK_TESTS} != "no" FILES+= atf.test.mk FILES+= googletest.test.inc.mk FILES+= googletest.test.mk FILES+= plain.test.mk FILES+= suite.test.mk FILES+= tap.test.mk .endif .include .endif # CURDIR == PARSEDIR diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index a9400186f78a..85247d733a14 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -1,124 +1,125 @@ # # Option file for bmake builds. These options are available to all users of # bmake (including the source tree userland and kernel builds). They generally # control how binaries are made, shared vs dynamic, etc and some general options # relevant for all build environments. # # Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf # and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no} # with (usually) sensible defaults. # # Makefiles must include bsd.opts.mk after defining specific MK_FOO options that # are applicable for that Makefile (typically there are none, but sometimes there # are exceptions). Recursive makes usually add MK_FOO=no for options that they wish # to omit from that make. # # Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO # variable. # # Makefiles may also assume that this file is included by bsd.own.mk should it # need variables defined there prior to the end of the Makefile where # bsd.{subdir,lib.bin}.mk is traditionally included. # # The old-style YES_FOO and NO_FOO are being phased out. No new instances of them # should be added. Old instances should be removed since they were just to # bridge the gap between FreeBSD 4 and FreeBSD 5. # # Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an # exception is made for _WITHOUT_SRCONF which turns off this mechanism # completely). # .if !target(____) ____: .NOTMAIN .if !defined(_WITHOUT_SRCCONF) # # Define MK_* variables (which are either "yes" or "no") for users # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the # make(1) environment. # These should be tested with `== "no"' or `!= "no"' in makefiles. # The NO_* variables should only be set by makefiles for variables # that haven't been converted over. # # Only these options are used by bsd.*.mk. KERBEROS and OPENSSH are # unfortunately needed to support statically linking the entire # tree. su(1) wouldn't link since it depends on PAM which depends on # ssh libraries when building with OPENSSH, and likewise for KERBEROS. # All other variables used to build /usr/src live in src.opts.mk # and variables from both files are documented in src.conf(5). __DEFAULT_YES_OPTIONS = \ ASSERT_DEBUG \ DEBUG_FILES \ DOCCOMPRESS \ INCLUDES \ INSTALLLIB \ KERBEROS \ MAKE_CHECK_USE_SANDBOX \ MAN \ MANCOMPRESS \ MANSPLITPKG \ NIS \ NLS \ OPENSSH \ RELRO \ SSP \ TESTS \ TOOLCHAIN \ WARNS \ WERROR __DEFAULT_NO_OPTIONS = \ ASAN \ BIND_NOW \ BRANCH_PROTECTION \ CCACHE_BUILD \ CTF \ INSTALL_AS_USER \ RETPOLINE \ + RUN_TESTS \ STALE_STAGED \ UBSAN \ UNDEFINED_VERSION \ ZEROREGS __DEFAULT_DEPENDENT_OPTIONS = \ MAKE_CHECK_USE_SANDBOX/TESTS \ STAGING_MAN/STAGING \ STAGING_PROG/STAGING \ STALE_STAGED/STAGING \ # # Default to disabling PIE on 32-bit architectures. The small address space # means that ASLR is of limited effectiveness, and it may cause issues with # some memory-hungry workloads. # .if ${MACHINE_ARCH} == "armv7" \ || ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" \ || ${MACHINE_ARCH} == "powerpcspe" __DEFAULT_NO_OPTIONS+= PIE .else __DEFAULT_YES_OPTIONS+=PIE .endif .if ${MACHINE_CPUARCH} != "aarch64" BROKEN_OPTIONS+= BRANCH_PROTECTION .endif __SINGLE_OPTIONS = \ INIT_ALL __INIT_ALL_OPTIONS= none pattern zero __INIT_ALL_DEFAULT= none .-include .include .include .endif # !_WITHOUT_SRCCONF .endif diff --git a/share/mk/bsd.test.mk b/share/mk/bsd.test.mk index b324ac173335..a2e15c840e02 100644 --- a/share/mk/bsd.test.mk +++ b/share/mk/bsd.test.mk @@ -1,103 +1,108 @@ # # Generic build infrastructure for test programs. # # This is the only public file that should be included by Makefiles when # tests are to be built. All other *.test.mk files are internal and not # to be included directly. .include ____: .NOTMAIN # Third-party software (kyua, etc) prefix. LOCALBASE?= /usr/local # Tests install directory TESTSDIR?= ${TESTSBASE}/${RELDIR:H} PACKAGE?= tests FILESGROUPS+= ${PACKAGE}FILES ${PACKAGE}FILESPACKAGE= ${PACKAGE} ${PACKAGE}FILESDIR= ${TESTSDIR} # List of subdirectories containing tests into which to recurse. This has the # same semantics as SUBDIR at build-time. However, the directories listed here # get registered into the run-time test suite definitions so that the test # engines know to recurse into these directories. # # In other words: list here any directories that contain test programs but use # SUBDIR for directories that may contain helper binaries and/or data files. TESTS_SUBDIRS?= # If defined, indicates that the tests built by the Makefile are not part of # the FreeBSD Test Suite. The implication of this is that the tests won't be # installed under /usr/tests/ and that Kyua won't be able to run them. #NOT_FOR_TEST_SUITE= # List of variables to pass to the tests at run-time via the environment. TESTS_ENV?= # Force all tests in a separate distribution file. # # We want this to be the case even when the distribution name is already # overridden. For example: we want the tests for programs in the 'games' # distribution to end up in the 'tests' distribution; the test programs # themselves have all the necessary logic to detect that the games are not # installed and thus won't cause false negatives. DISTRIBUTION:= tests # Ordered list of directories to construct the PATH for the tests. TESTS_PATH+= ${DESTDIR}/bin ${DESTDIR}/sbin \ ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin TESTS_ENV+= PATH=${TESTS_PATH:tW:C/ +/:/g} # Ordered list of directories to construct the LD_LIBRARY_PATH for the tests. TESTS_LD_LIBRARY_PATH+= ${DESTDIR}/lib ${DESTDIR}/usr/lib TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:C/ +/:/g} # List of all tests being built. The various *.test.mk modules extend this # variable as needed. _TESTS= # Pull in the definitions of all supported test interfaces. .include .include .include # Include atf last to let other test framework use it .include # Sort the tests alphabetically, so the results are deterministically formed # across runs. _TESTS:= ${_TESTS:O} # kyua automatically descends directories; only run make check on the # top-level directory .if !make(check) .for ts in ${TESTS_SUBDIRS} .if empty(SUBDIR:M${ts}) SUBDIR+= ${ts} .endif .endfor SUBDIR_PARALLEL= t .endif # it is rare for test cases to have man pages .if !defined(MAN) MAN= .endif .if !defined(NOT_FOR_TEST_SUITE) .include .endif +.if ${MK_RUN_TESTS} == "yes" +# Run tests as part of the build +.include +.endif + .if !target(realcheck) realcheck: .PHONY @echo "$@ not defined; skipping" .endif beforecheck realcheck aftercheck check: .PHONY .ORDER: beforecheck realcheck aftercheck check: beforecheck realcheck aftercheck .include diff --git a/share/mk/host.test.mk b/share/mk/host.test.mk new file mode 100644 index 000000000000..17bb00a0b28b --- /dev/null +++ b/share/mk/host.test.mk @@ -0,0 +1,89 @@ +# +# If MK_RUN_TESTS is "yes"; we want to run tests for "host" +# during the build - and fail the build if any test fails. +# +# HOST_RUN_TESTS can be used to filter which tests should be built and +# run. It should be a list of glob patterns to apply to RELDIR, +# so "*" would mean all. +# +# For the DIRDEPS_BUILD, HOST_RUN_TESTS defaults to "*" as the +# selection of tests to build and run is taken controlled at level 0 +# in local.dirdeps.mk +# + +.if !target(____) +.error ${.PARSEFILE} cannot be included directly. +.endif + +all: + +.if ${.MAKE.LEVEL} > 0 && !empty(_TESTS) && ${MACHINE:Nhost*} == "" + +# allow for customization +.-include + +.if ${MK_DIRDEPS_BUILD} == "yes" +# orchestration choices are already made +HOST_RUN_TESTS ?= * +.else +.if empty(RELDIR) +RELDIR:= ${.CURDIR:S,${SRCTOP}/,,:S,${OBJTOP}/,,} +.endif +.endif + +.if ${HOST_RUN_TESTS:Uno:@x@${RELDIR:M$x}@} != "" +all: run-tests +.endif + +KYUA?= kyua + +# we need to make sure kyua-report can find the results +KYUA_RESULTS?= ${.OBJDIR}/kyua.results +KYUA_ARGS?= --results-file=${KYUA_RESULTS} +KYUA_ENV?= HOME=${KYUA_HOME} TMPDIR=${.OBJDIR} +KYUA_FLAGS?= --config none --loglevel=${KYUA_LOGLEVEL:Uinfo} +KYUA_HOME?= ${OBJTOP} + +.if make(debug*) +KYUA_LOGLEVEL?= debug +.endif + +# some tests have files they need +.if ${${PACKAGE}FILES:U:NKyuafile} != "" +run-tests run-tests.log: link-test-files +link-test-files: ${${PACKAGE}FILES:NKyuafile} + @for f in ${.ALLSRC:N*Kyuafile:M*/*}; do \ + ln -sf $$f .; \ + done +.endif + +# we do not want to stage any of this +RUN_TESTS_LOG= run-tests.log +MK_STAGING= no +META_XTRAS+= ${RUN_TESTS_LOG} + +run-tests: ${RUN_TESTS_LOG} + +# This is the main event. +# Run kyua-test followed by kyua-report. +# If we have any test failues we want to run kyua-report --verbose +# Also on fail, we rename run-tests.log to run-tests.err so we save the +# output but the target will be out-of-date. +# We prepend ${.OBJDIR}:${.OBJDIR:H}: to PATH seen by kyua +# so tests for things like cat, cp, cmp etc can find the one we just built +# rather than the one from the host. +${RUN_TESTS_LOG}: ${_TESTS} Kyuafile + @( export PATH=${.OBJDIR}:${.OBJDIR:H}:${PATH}; \ + rm -f ${KYUA_RESULTS}; \ + ${KYUA_ENV} ${KYUA} ${KYUA_FLAGS} test ${KYUA_ARGS} -k ${.OBJDIR}/Kyuafile --build-root=${.OBJDIR} && \ + ${KYUA_ENV} ${KYUA} ${KYUA_FLAGS} report ${KYUA_ARGS} ) > ${.TARGET} || \ + { mv ${.TARGET} ${.TARGET:R}.err; \ + ${KYUA_ENV} ${KYUA} ${KYUA_FLAGS} report ${KYUA_ARGS} --verbose --results-filter broken,failed; echo See ${.TARGET:R:tA}.err; \ + exit 1; } + +# make kyua-debug KYUA_DEBUG_ARGS=app:test +kyua-debug: + @(export PATH=${.OBJDIR}:${.OBJDIR:H}:${PATH}; \ + ${KYUA_ENV} ${KYUA} ${KYUA_FLAGS} debug ${KYUA_DEBUG_ARGS}) || true + +.endif diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk index f34a4542e534..2173ea0be446 100644 --- a/share/mk/local.dirdeps.mk +++ b/share/mk/local.dirdeps.mk @@ -1,252 +1,308 @@ .if !target(_DIRDEP_USE) # we are the 1st makefile .if !defined(MK_CLANG) .include "${SRCTOP}/share/mk/src.opts.mk" .endif # Machine-specific MK settings needed for Makefile.dirdeps.options usage MK_FDT.i386 = no MK_FDT.amd64 = no # making universe is special .if defined(UNIVERSE_GUARD) # these should be done by now DIRDEPS_FILTER+= N*.host .endif # pseudo machines get no qualification .for m in ${PSEUDO_MACHINE_LIST:Nhost*} M_dep_qual_fixes += C;($m),[^/.,]*$$;\1; .endfor #.info M_dep_qual_fixes=${M_dep_qual_fixes} # Some things we never want to build for host DIRDEPS_FILTER.host = \ Ninclude* \ Nlib/csu* \ Nlib/libc \ Nlib/libcompiler_rt \ Nlib/[mn]* \ Nlib/lib[t]* \ Ngnu/lib/lib[a-r]* \ Nsecure/lib* \ Nusr.bin/xinstall* \ .if ${.MAKE.OS} == "FreeBSD" # Host libraries should mostly be excluded from the build so the # host version in /usr/lib is used. # Internal libraries need to be allowed to be built though # since they are never installed. # Cheat for including src.libnames.mk ____: .NOTMAIN # Pull in _INTERNALLIBS .include _need_host_libs= .for lib in ${_INTERNALLIBS} _need_host_libs+= ${LIB${lib:tu}DIR:S,^${OBJTOP}/,,} .endfor .if ${MK_host_egacy} == "yes" _need_host_libs+= lib/libmd .endif N_host_libs:= ${cd ${SRCTOP} && echo lib/lib*:L:sh:${_need_host_libs:${M_ListToSkip}}:${M_ListToSkip}} DIRDEPS_FILTER.host+= ${N_host_libs} .endif DIRDEPS_FILTER.host32 = ${DIRDEPS_FILTER.host} DIRDEPS_FILTER+= \ Nbin/cat.host \ ${DIRDEPS_FILTER.xtras:U} # Cleanup a buildworld's WORLDTMP so that any files generated from it # or using it will rebuild with the DIRDEPS SYSROOT. Otherwise existing # object .meta files may still reference those directories and not be # rebuilt and lead to incorrect Makefile.depend files due to lack of # .dirdep files. .if !defined(NO_CLEANUP_WORLDTMP) && exists(${OBJTOP}/tmp/_worldtmp) cleanup_worldtmp: .PHONY .NOMETA @echo "Cleaning leftover WORLDTMP from buildworld." -rm -rf ${OBJTOP}/tmp/* -chflags -R 0 ${OBJTOP}/tmp/* rm -rf ${OBJTOP}/tmp beforedirdeps: cleanup_worldtmp .endif # pseudo option for building host tools on old or non-FreeBSD host # allows us to leverage Makefile.depend.options with # DIRDEPS_OPTIONS = host_egacy # dirdeps-options.mk will qualify with ${DEP_MACHINE} (and others) # before looking at the bare option. MK_host_egacy.host= ${MK_host_egacy} .endif # !target(_DIRDEP_USE) # reset this each time DIRDEPS_FILTER.xtras= .if ${DEP_MACHINE:Npkgs*} != "" DIRDEPS_FILTER.xtras+= Nusr.bin/clang/clang.host .endif .if ${DEP_MACHINE:Nhost*} == "" .if ${MK_host_egacy} == "yes" && ${DEP_RELDIR:Ntools/build:Ntargets/*:N*/stage} != "" DIRDEPS += tools/build .endif .else MK_host_egacy.${DEP_MACHINE}= no # this is how we can handle optional dependencies .if ${DEP_RELDIR} == "lib/libc" DIRDEPS += lib/libc_nonshared .if ${MK_SSP:Uno} != "no" DIRDEPS += lib/libssp_nonshared .endif .else DIRDEPS_FILTER.xtras+= Nlib/libc_nonshared .endif # some optional things .if ${MK_CTF} == "yes" && ${DEP_RELDIR:Mcddl/usr.bin/ctf*} == "" DIRDEPS += \ cddl/usr.bin/ctfconvert.host \ cddl/usr.bin/ctfmerge.host .endif .if ${DEP_MACHINE:Nhost*} != "" # Add in proper libgcc (gnu or LLVM) if not building libcc and libc is needed. # Add both gcc_s and gcc_eh as dependencies as the decision to build # -static or not is not known here. .if ${DEP_RELDIR:M*libgcc*} == "" && ${DIRDEPS:U:Mlib/libc} != "" DIRDEPS+= \ lib/libgcc_eh \ lib/libgcc_s .endif .endif # Bootstrap support. Give hints to DIRDEPS if there is no Makefile.depend* # generated yet. This can be based on things such as SRC files and LIBADD. # These hints will not factor into the final Makefile.depend as only what is # used will be added in and handled via [local.]gendirdeps.mk. This is not # done for MACHINE=host builds. # XXX: Include this in local.autodep.mk as well for gendirdeps without filemon. # Only do this for main build target .if ${RELDIR} == ${DEP_RELDIR} && !defined(_RECURSING_PROGS) .for _depfile in ${.MAKE.DEPENDFILE_PREFERENCE:T} .if !defined(_have_depfile) && exists(${.CURDIR}/${_depfile}) _have_depfile= .endif .endfor .if !defined(_have_depfile) # KMOD does not use any stdlibs. .if !defined(KMOD) # Gather PROGS dependencies first .if !empty(PROGS) _PROGS_LIBADD= _PROGS_DPADD= _PROGS_SRCS= .for _prog in ${PROGS} .for s in . _ .if !empty(LIBADD${s}${_prog}) _PROGS_LIBADD+= ${LIBADD${s}${_prog}} .endif .if !empty(DPADD${s}${_prog}) _PROGS_DPADD+= ${DPADD${s}${_prog}} .endif .if !empty(SRCS${s}${_prog}) _PROGS_SRCS+= ${SRCS${s}${_prog}} .endif .endfor # .for s in . _ # Add in assumed source (bsd.prog.mk) .if !target(${_prog}) .if defined(PROG_CXX) _PROGS_SRCS+= ${_prog}.cc .else _PROGS_SRCS+= ${_prog}.c .endif .endif # !target(${_prog}) .endfor # .for _prog in ${PROGS} .endif # !empty(PROGS) _SRCS= ${SRCS} ${_PROGS_SRCS} # Has C files. The C_DIRDEPS are shared with C++ files as well. C_DIRDEPS= \ include \ include/arpa \ include/protocols \ include/rpc \ include/rpcsvc \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ lib/libcompiler_rt \ # libgcc is needed as well but is added later. .if ${MK_GSSAPI} != "no" C_DIRDEPS+= include/gssapi .endif .if !empty(_SRCS:M*.c) DIRDEPS+= ${C_DIRDEPS} .endif # Has C++ files .if !empty(_SRCS:M*.cc) || !empty(_SRCS:M*.C) || !empty(_SRCS:M*.cpp) || \ !empty(_SRCS:M*.cxx) DIRDEPS+= ${C_DIRDEPS} .if ${MK_CLANG} == "yes" DIRDEPS+= lib/libc++ lib/libcxxrt .endif # XXX: Clang and GCC always adds -lm currently, even when not needed. DIRDEPS+= lib/msun .endif # CXX .endif # !defined(KMOD) # Has yacc files. .if !empty(_SRCS:M*.y) DIRDEPS+= usr.bin/yacc.host .endif _DPADD= ${DPADD} ${_PROGS_DPADD} .if !empty(_DPADD) # This only works for DPADD with full OBJ/SRC paths, which is mostly just # _INTERNALLIBS. _DP_DIRDEPS= \ ${_DPADD:O:u:M${OBJTOP}*:H:N.:tA:C,${OBJTOP}[^/]*/,,:N.:O:u} \ ${_DPADD:O:u:M${OBJROOT}*:N${OBJTOP}*:N${STAGE_ROOT}/*:H:S,${OBJROOT},,:C,^([^/]+)/(.*),\2.\1,:S,${HOST_TARGET}$,host,:N.*:O:u} # Resolve the paths to RELDIRs .if !empty(_DP_DIRDEPS) DIRDEPS+= ${_DP_DIRDEPS:C,^,${SRCTOP}/,:tA:C,^${SRCTOP}/,,} .endif .endif # !empty(DPADD) _ALL_LIBADD= ${LIBADD} ${_PROGS_LIBADD} .if !empty(_ALL_LIBADD) # Also handle LIBADD for non-internal libraries. .for _lib in ${_ALL_LIBADD:O:u} _lib${_lib}reldir= ${LIB${_lib:tu}DIR:C,${OBJTOP}/,,} .if defined(LIB${_lib:tu}DIR) && ${DIRDEPS:M${_lib${_lib}reldir}} == "" && \ exists(${SRCTOP}/${_lib${_lib}reldir}) DIRDEPS+= ${_lib${_lib}reldir} .endif .endfor .endif # !empty(LIBADD) .endif # no Makefile.depend* .endif # ${RELDIR} == ${DEP_RELDIR} .endif # ${DEP_MACHINE} != "host" .if ${MK_STAGING} == "yes" # we need targets/pseudo/stage to prep the stage tree .if ${DEP_RELDIR:N.:N${SRCTOP}:N*pseudo/stage} != "" DIRDEPS += targets/pseudo/stage .endif .endif DEP_MACHINE_ARCH = ${MACHINE_ARCH.${DEP_MACHINE}} DEP_MACHINE_CPUARCH = ${DEP_MACHINE_ARCH:${__TO_CPUARCH}} CSU_DIR.${DEP_MACHINE_ARCH} ?= csu/${DEP_MACHINE_ARCH} CSU_DIR := ${CSU_DIR.${DEP_MACHINE_ARCH}} BOOT_MACHINE_DIR:= ${BOOT_MACHINE_DIR.${DEP_MACHINE}} KERNEL_NAME:= ${KERNEL_NAME.${DEP_MACHINE}} .-include + +.if ${MK_RUN_TESTS} == "yes" +# some the tests below will not run correctly on the host +# as they require support files not present in .CURDIR +BROKEN_HOST_TESTS += \ + ${BROKEN_HOST_DEP_TESTS} \ + bin/cp/tests \ + lib/atf/libatf-c++/tests \ + lib/atf/libatf-c/tests \ + lib/libarchive/tests \ + lib/libnv/tests \ + libexec/rtld-elf/tests \ + sbin/devd/tests \ + usr.bin/comm/tests \ + usr.bin/du/tests \ + usr.bin/procstat/tests \ + usr.bin/sed/tests \ + usr.bin/tar/tests \ + usr.bin/tr/tests \ + usr.bin/xargs/tests \ + usr.bin/yacc/tests \ + usr.sbin/makefs/tests \ + usr.sbin/rpcbind/tests \ + +# these all have broken dependencies which we choose not to fix for host +BROKEN_HOST_DEP_TESTS += \ + lib/msun/tests \ + usr.bin/cut/tests \ + usr.bin/diff/tests \ + usr.bin/grep/tests \ + usr.bin/gzip/tests \ + usr.bin/printf/tests \ + +.endif + +TESTS_DIR_LIST += tests +# most of the tree only has Makefile.depend +# by default we only want to run host tests for Makefile.depend.host +TESTS_DEPENDFILE_PREFERENCE ?= Makefile.depend.host +EXCLUDE_TESTS_FILTER += . \ + lib/libcasper/services/cap_* \ + +.for t in ${TESTS_DIR_LIST:O:u} +.if !target(${DEP_RELDIR}/$t.test) +.if ${BROKEN_HOST_TESTS:U:M${DEP_RELDIR}/$t} == "" && \ + ${RUN_TESTS_FILTER:U*:@m@${DEP_RELDIR:M$m}@} != "" && \ + ${DEP_RELDIR:${EXCLUDE_TESTS_FILTER:Uno:${M_ListToSkip}}} != "" && \ + ${TESTS_DEPENDFILE_PREFERENCE:@m@${exists(${SRCTOP}/${DEP_RELDIR}/$t/$m):?$m:}@} != "" +# build but not via DIRDEPS to avoid circular dependencies +_build_xtra_dirs += ${SRCTOP}/${DEP_RELDIR}/$t.host +# mark it done +${DEP_RELDIR}/$t.test: +.endif +.endif +.endfor +.endif