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 30e8a34402SJulio Merino# Force all tests in a separate distribution file. 31e8a34402SJulio Merino# 32e8a34402SJulio Merino# We want this to be the case even when the distribution name is already 33e8a34402SJulio Merino# overriden. For example: we want the tests for programs in the 'games' 34e8a34402SJulio Merino# distribution to end up in the 'tests' distribution; the test programs 35e8a34402SJulio Merino# themselves have all the necessary logic to detect that the games are not 36e8a34402SJulio Merino# installed and thus won't cause false negatives. 37e8a34402SJulio MerinoDISTRIBUTION:= tests 38e8a34402SJulio 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 579aa97389SEnji Cooper.for ts in ${TESTS_SUBDIRS} 58*05f0ff5aSEnji Cooper.if empty(SUBDIR:M${ts}) 599aa97389SEnji CooperSUBDIR+= ${ts} 60d4a14c85SRui Paulo.endif 619aa97389SEnji Cooper.endfor 6250c5d27bSSimon J. Gerraty 6350c5d27bSSimon J. Gerraty# it is rare for test cases to have man pages 6450c5d27bSSimon J. Gerraty.if !defined(MAN) 65c115b818SWarner LoshMAN= 6650c5d27bSSimon J. Gerraty.endif 6750c5d27bSSimon J. Gerraty 6850c5d27bSSimon J. Gerraty# tell progs.mk we might want to install things 6950c5d27bSSimon J. GerratyPROG_VARS+= BINDIR 7050c5d27bSSimon J. GerratyPROGS_TARGETS+= install 7150c5d27bSSimon J. Gerraty 72a784098cSJulio Merino.if !defined(NOT_FOR_TEST_SUITE) 73a784098cSJulio Merino.include <suite.test.mk> 7425b6a535SRui Paulo.endif 7525b6a535SRui Paulo 7650c5d27bSSimon J. Gerraty.if !target(realtest) 7750c5d27bSSimon J. Gerratyrealtest: .PHONY 7850c5d27bSSimon J. Gerraty @echo "$@ not defined; skipping" 7950c5d27bSSimon J. Gerraty.endif 8050c5d27bSSimon J. Gerraty 8150c5d27bSSimon J. Gerratytest: .PHONY 8250c5d27bSSimon J. Gerraty.ORDER: beforetest realtest 8350c5d27bSSimon J. Gerratytest: beforetest realtest 8450c5d27bSSimon J. Gerraty 8550c5d27bSSimon J. Gerraty.if target(aftertest) 8650c5d27bSSimon J. Gerraty.ORDER: realtest aftertest 8750c5d27bSSimon J. Gerratytest: aftertest 8850c5d27bSSimon J. Gerraty.endif 8950c5d27bSSimon J. Gerraty 90d4a14c85SRui Paulo.if !empty(SUBDIR) 91d4a14c85SRui Paulo.include <bsd.subdir.mk> 92d4a14c85SRui Paulo.endif 93d4a14c85SRui Paulo 94d4a14c85SRui Paulo.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS) 95d4a14c85SRui Paulo.include <bsd.progs.mk> 96d4a14c85SRui Paulo.endif 97ada17d7bSJulio Merino.include <bsd.files.mk> 98d4a14c85SRui Paulo 9950c5d27bSSimon J. Gerraty.include <bsd.obj.mk> 100