150c5d27bSSimon J. Gerraty# $FreeBSD$ 2d4a14c85SRui Paulo# 3d4a14c85SRui Paulo# Generic build infrastructure for test programs. 4d4a14c85SRui Paulo# 5f5fd950eSJulio Merino# This is the only public file that should be included by Makefiles when 6f5fd950eSJulio Merino# tests are to be built. All other *.test.mk files are internal and not 7f5fd950eSJulio Merino# to be included directly. 850c5d27bSSimon J. Gerraty 950c5d27bSSimon J. Gerraty.include <bsd.init.mk> 1050c5d27bSSimon J. Gerraty 11f5fd950eSJulio Merino__<bsd.test.mk>__: 12f5fd950eSJulio Merino 13d4a14c85SRui Paulo# List of subdirectories containing tests into which to recurse. This has the 14d4a14c85SRui Paulo# same semantics as SUBDIR at build-time. However, the directories listed here 15d4a14c85SRui Paulo# get registered into the run-time test suite definitions so that the test 16d4a14c85SRui Paulo# engines know to recurse into these directories. 17d4a14c85SRui Paulo# 18d4a14c85SRui Paulo# In other words: list here any directories that contain test programs but use 19d4a14c85SRui Paulo# SUBDIR for directories that may contain helper binaries and/or data files. 20d4a14c85SRui PauloTESTS_SUBDIRS?= 2150c5d27bSSimon J. Gerraty 22a784098cSJulio Merino# If defined, indicates that the tests built by the Makefile are not part of 23a784098cSJulio Merino# the FreeBSD Test Suite. The implication of this is that the tests won't be 24a784098cSJulio Merino# installed under /usr/tests/ and that Kyua won't be able to run them. 25a784098cSJulio Merino#NOT_FOR_TEST_SUITE= 268c465f58SJulio Merino 2730cc088dSRui Paulo# List of variables to pass to the tests at run-time via the environment. 2830cc088dSRui PauloTESTS_ENV?= 2930cc088dSRui Paulo 30*e8a34402SJulio Merino# Force all tests in a separate distribution file. 31*e8a34402SJulio Merino# 32*e8a34402SJulio Merino# We want this to be the case even when the distribution name is already 33*e8a34402SJulio Merino# overriden. For example: we want the tests for programs in the 'games' 34*e8a34402SJulio Merino# distribution to end up in the 'tests' distribution; the test programs 35*e8a34402SJulio Merino# themselves have all the necessary logic to detect that the games are not 36*e8a34402SJulio Merino# installed and thus won't cause false negatives. 37*e8a34402SJulio MerinoDISTRIBUTION:= tests 38*e8a34402SJulio Merino 3930cc088dSRui Paulo# Ordered list of directories to construct the PATH for the tests. 4030cc088dSRui PauloTESTS_PATH+= ${DESTDIR}/bin ${DESTDIR}/sbin \ 4130cc088dSRui Paulo ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin 4230cc088dSRui PauloTESTS_ENV+= PATH=${TESTS_PATH:tW:C/ +/:/g} 4330cc088dSRui Paulo 4430cc088dSRui Paulo# Ordered list of directories to construct the LD_LIBRARY_PATH for the tests. 4530cc088dSRui PauloTESTS_LD_LIBRARY_PATH+= ${DESTDIR}/lib ${DESTDIR}/usr/lib 4630cc088dSRui PauloTESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:C/ +/:/g} 4730cc088dSRui Paulo 48f5fd950eSJulio Merino# List of all tests being built. The various *.test.mk modules extend this 49f5fd950eSJulio Merino# variable as needed. 50f5fd950eSJulio Merino_TESTS= 51f5fd950eSJulio Merino 52f5fd950eSJulio Merino# Pull in the definitions of all supported test interfaces. 53f5fd950eSJulio Merino.include <atf.test.mk> 54f5fd950eSJulio Merino.include <plain.test.mk> 55f5fd950eSJulio Merino.include <tap.test.mk> 56f5fd950eSJulio Merino 57d4a14c85SRui Paulo.if !empty(TESTS_SUBDIRS) 58d4a14c85SRui PauloSUBDIR+= ${TESTS_SUBDIRS} 59d4a14c85SRui Paulo.endif 6050c5d27bSSimon J. Gerraty 6150c5d27bSSimon J. Gerraty# it is rare for test cases to have man pages 6250c5d27bSSimon J. Gerraty.if !defined(MAN) 63c115b818SWarner LoshMAN= 6450c5d27bSSimon J. Gerraty.endif 6550c5d27bSSimon J. Gerraty 6650c5d27bSSimon J. Gerraty# tell progs.mk we might want to install things 6750c5d27bSSimon J. GerratyPROG_VARS+= BINDIR 6850c5d27bSSimon J. GerratyPROGS_TARGETS+= install 6950c5d27bSSimon J. Gerraty 70a784098cSJulio Merino.if !defined(NOT_FOR_TEST_SUITE) 71a784098cSJulio Merino.include <suite.test.mk> 7225b6a535SRui Paulo.endif 7325b6a535SRui Paulo 7450c5d27bSSimon J. Gerraty.if !target(realtest) 7550c5d27bSSimon J. Gerratyrealtest: .PHONY 7650c5d27bSSimon J. Gerraty @echo "$@ not defined; skipping" 7750c5d27bSSimon J. Gerraty.endif 7850c5d27bSSimon J. Gerraty 7950c5d27bSSimon J. Gerratytest: .PHONY 8050c5d27bSSimon J. Gerraty.ORDER: beforetest realtest 8150c5d27bSSimon J. Gerratytest: beforetest realtest 8250c5d27bSSimon J. Gerraty 8350c5d27bSSimon J. Gerraty.if target(aftertest) 8450c5d27bSSimon J. Gerraty.ORDER: realtest aftertest 8550c5d27bSSimon J. Gerratytest: aftertest 8650c5d27bSSimon J. Gerraty.endif 8750c5d27bSSimon J. Gerraty 88d4a14c85SRui Paulo.if !empty(SUBDIR) 89d4a14c85SRui Paulo.include <bsd.subdir.mk> 90d4a14c85SRui Paulo.endif 91d4a14c85SRui Paulo 92d4a14c85SRui Paulo.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS) 93d4a14c85SRui Paulo.include <bsd.progs.mk> 94d4a14c85SRui Paulo.endif 95ada17d7bSJulio Merino.include <bsd.files.mk> 96d4a14c85SRui Paulo 9750c5d27bSSimon J. Gerraty.include <bsd.obj.mk> 98