2012-11-07 22:02:02 +00:00
|
|
|
# $FreeBSD$
|
2013-10-19 06:48:49 +00:00
|
|
|
#
|
|
|
|
# Generic build infrastructure for test programs.
|
|
|
|
#
|
2014-03-14 08:56:19 +00:00
|
|
|
# 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.
|
2012-11-07 22:02:02 +00:00
|
|
|
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
|
2014-03-14 08:56:19 +00:00
|
|
|
__<bsd.test.mk>__:
|
|
|
|
|
2015-12-20 06:26:15 +00:00
|
|
|
# Third-party software (kyua, etc) prefix.
|
|
|
|
LOCALBASE?= /usr/local
|
|
|
|
|
2015-10-11 21:29:24 +00:00
|
|
|
# Tests install directory
|
|
|
|
TESTSDIR?= ${TESTSBASE}/${RELDIR:H}
|
2016-05-04 23:20:53 +00:00
|
|
|
|
|
|
|
PACKAGE?= tests
|
|
|
|
|
|
|
|
FILESGROUPS+= ${PACKAGE}FILES
|
|
|
|
${PACKAGE}FILESPACKAGE= ${PACKAGE}
|
|
|
|
${PACKAGE}FILESDIR= ${TESTSDIR}
|
2015-06-15 07:13:23 +00:00
|
|
|
|
2013-10-19 06:48:49 +00:00
|
|
|
# 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?=
|
2012-11-07 22:02:02 +00:00
|
|
|
|
2014-03-14 12:52:55 +00:00
|
|
|
# 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=
|
2014-01-14 18:32:47 +00:00
|
|
|
|
2013-10-19 06:51:34 +00:00
|
|
|
# List of variables to pass to the tests at run-time via the environment.
|
|
|
|
TESTS_ENV?=
|
|
|
|
|
2014-06-10 17:04:30 +00:00
|
|
|
# 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'
|
2014-06-10 17:04:30 +00:00
|
|
|
# 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
|
|
|
|
|
2013-10-19 06:51:34 +00:00
|
|
|
# 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}
|
|
|
|
|
2014-03-14 08:56:19 +00:00
|
|
|
# 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.
|
2019-02-20 01:09:03 +00:00
|
|
|
.include <googletest.test.mk>
|
2014-03-14 08:56:19 +00:00
|
|
|
.include <plain.test.mk>
|
|
|
|
.include <tap.test.mk>
|
2020-10-06 06:45:52 +00:00
|
|
|
# Include atf last to let other test framework use it
|
|
|
|
.include <atf.test.mk>
|
2014-03-14 08:56:19 +00:00
|
|
|
|
2017-07-17 18:20:54 +00:00
|
|
|
# Sort the tests alphabetically, so the results are deterministically formed
|
|
|
|
# across runs.
|
|
|
|
_TESTS:= ${_TESTS:O}
|
|
|
|
|
2016-02-07 18:40:04 +00:00
|
|
|
# kyua automatically descends directories; only run make check on the
|
|
|
|
# top-level directory
|
|
|
|
.if !make(check)
|
2014-10-28 23:01:09 +00:00
|
|
|
.for ts in ${TESTS_SUBDIRS}
|
2014-10-29 04:32:46 +00:00
|
|
|
.if empty(SUBDIR:M${ts})
|
2014-10-28 23:01:09 +00:00
|
|
|
SUBDIR+= ${ts}
|
2012-11-07 22:02:02 +00:00
|
|
|
.endif
|
2014-10-28 23:01:09 +00:00
|
|
|
.endfor
|
2016-02-16 02:13:59 +00:00
|
|
|
SUBDIR_PARALLEL= t
|
2016-02-07 18:40:04 +00:00
|
|
|
.endif
|
2012-11-07 22:02:02 +00:00
|
|
|
|
|
|
|
# it is rare for test cases to have man pages
|
|
|
|
.if !defined(MAN)
|
2014-05-10 16:38:37 +00:00
|
|
|
MAN=
|
2012-11-07 22:02:02 +00:00
|
|
|
.endif
|
|
|
|
|
2014-03-14 12:52:55 +00:00
|
|
|
.if !defined(NOT_FOR_TEST_SUITE)
|
|
|
|
.include <suite.test.mk>
|
2012-11-07 22:02:02 +00:00
|
|
|
.endif
|
|
|
|
|
2016-02-07 18:40:04 +00:00
|
|
|
.if !target(realcheck)
|
|
|
|
realcheck: .PHONY
|
2012-11-07 22:02:02 +00:00
|
|
|
@echo "$@ not defined; skipping"
|
|
|
|
.endif
|
|
|
|
|
2016-02-07 18:40:04 +00:00
|
|
|
beforecheck realcheck aftercheck check: .PHONY
|
|
|
|
.ORDER: beforecheck realcheck aftercheck
|
|
|
|
check: beforecheck realcheck aftercheck
|
2012-11-07 22:02:02 +00:00
|
|
|
|
2013-10-19 06:48:49 +00:00
|
|
|
.include <bsd.progs.mk>
|