1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00
freebsd/share/mk/bsd.test.mk

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

105 lines
3.1 KiB
Makefile
Raw Normal View History

# $FreeBSD$
#
# 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 <bsd.init.mk>
__<bsd.test.mk>__:
# Third-party software (kyua, etc) prefix.
LOCALBASE?= /usr/local
# Tests install directory
TESTSDIR?= ${TESTSBASE}/${RELDIR:H}
Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division
2016-05-04 23:20:53 +00:00
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
2018-07-27 10:44:38 +00:00
# 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 <googletest.test.mk>
.include <plain.test.mk>
.include <tap.test.mk>
# Include atf last to let other test framework use it
.include <atf.test.mk>
# 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 <suite.test.mk>
.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 <bsd.progs.mk>