Changeset View
Changeset View
Standalone View
Standalone View
share/mk/bsd.test.mk
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
# Generic build infrastructure for test programs. | # Generic build infrastructure for test programs. | ||||
# | # | ||||
# This is the only public file that should be included by Makefiles when | # 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 | # tests are to be built. All other *.test.mk files are internal and not | ||||
# to be included directly. | # to be included directly. | ||||
.include <bsd.init.mk> | .include <bsd.init.mk> | ||||
__<bsd.test.mk>__: | __<bsd.test.mk>__: | ||||
# Path to the prefix of the ATF and Kyua CLI. | |||||
ngie: `Third-party package prefix` (kyua, etc) would probably be more generic. | |||||
LOCALBASE?= /usr/local | |||||
# Tests install directory | # Tests install directory | ||||
TESTSDIR?= ${TESTSBASE}/${RELDIR:H} | TESTSDIR?= ${TESTSBASE}/${RELDIR:H} | ||||
# List of subdirectories containing tests into which to recurse. This has the | # List of subdirectories containing tests into which to recurse. This has the | ||||
# same semantics as SUBDIR at build-time. However, the directories listed here | # 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 | # get registered into the run-time test suite definitions so that the test | ||||
# engines know to recurse into these directories. | # engines know to recurse into these directories. | ||||
# | # | ||||
Show All 31 Lines | |||||
# variable as needed. | # variable as needed. | ||||
_TESTS= | _TESTS= | ||||
# Pull in the definitions of all supported test interfaces. | # Pull in the definitions of all supported test interfaces. | ||||
.include <atf.test.mk> | .include <atf.test.mk> | ||||
.include <plain.test.mk> | .include <plain.test.mk> | ||||
.include <tap.test.mk> | .include <tap.test.mk> | ||||
# kyua automatically descends directories; only run make check on the | |||||
# top-level directory | |||||
.if !make(check) | |||||
.for ts in ${TESTS_SUBDIRS} | .for ts in ${TESTS_SUBDIRS} | ||||
.if empty(SUBDIR:M${ts}) | .if empty(SUBDIR:M${ts}) | ||||
SUBDIR+= ${ts} | SUBDIR+= ${ts} | ||||
.endif | .endif | ||||
.endfor | .endfor | ||||
.endif | |||||
# it is rare for test cases to have man pages | # it is rare for test cases to have man pages | ||||
.if !defined(MAN) | .if !defined(MAN) | ||||
MAN= | MAN= | ||||
.endif | .endif | ||||
# tell progs.mk we might want to install things | # tell progs.mk we might want to install things | ||||
PROG_VARS+= BINDIR | PROG_VARS+= BINDIR | ||||
PROGS_TARGETS+= install | PROGS_TARGETS+= install | ||||
.if !defined(NOT_FOR_TEST_SUITE) | .if !defined(NOT_FOR_TEST_SUITE) | ||||
.include <suite.test.mk> | .include <suite.test.mk> | ||||
.endif | .endif | ||||
.if !target(realtest) | .if !target(realcheck) | ||||
realtest: .PHONY | realcheck: .PHONY | ||||
@echo "$@ not defined; skipping" | @echo "$@ not defined; skipping" | ||||
.endif | .endif | ||||
test: .PHONY | beforecheck realcheck aftercheck check: .PHONY | ||||
.ORDER: beforetest realtest | .ORDER: beforecheck realcheck aftercheck | ||||
test: beforetest realtest | check: beforecheck realcheck aftercheck | ||||
.if target(aftertest) | |||||
.ORDER: realtest aftertest | |||||
test: aftertest | |||||
.endif | |||||
.ifdef PROG | .ifdef PROG | ||||
# we came here via bsd.progs.mk below | # we came here via bsd.progs.mk below | ||||
# parent will do staging. | # parent will do staging. | ||||
MK_STAGING= no | MK_STAGING= no | ||||
.endif | .endif | ||||
.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS) | .if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS) | ||||
Show All 20 Lines |
Third-party package prefix (kyua, etc) would probably be more generic.