1242711Ssjg# $FreeBSD: releng/11.0/share/mk/bsd.test.mk 299094 2016-05-04 23:20:53Z ngie $ 2256761Srpaulo# 3256761Srpaulo# Generic build infrastructure for test programs. 4256761Srpaulo# 5263161Sjmmv# This is the only public file that should be included by Makefiles when 6263161Sjmmv# tests are to be built. All other *.test.mk files are internal and not 7263161Sjmmv# to be included directly. 8242711Ssjg 9242711Ssjg.include <bsd.init.mk> 10242711Ssjg 11263161Sjmmv__<bsd.test.mk>__: 12263161Sjmmv 13292507Sngie# Third-party software (kyua, etc) prefix. 14292507SngieLOCALBASE?= /usr/local 15292507Sngie 16289158Sngie# Tests install directory 17289158SngieTESTSDIR?= ${TESTSBASE}/${RELDIR:H} 18284408Sngie 19299094SngiePACKAGE?= tests 20299094Sngie 21299094SngieFILESGROUPS+= ${PACKAGE}FILES 22299094Sngie${PACKAGE}FILESPACKAGE= ${PACKAGE} 23299094Sngie${PACKAGE}FILESDIR= ${TESTSDIR} 24299094Sngie 25256761Srpaulo# List of subdirectories containing tests into which to recurse. This has the 26256761Srpaulo# same semantics as SUBDIR at build-time. However, the directories listed here 27256761Srpaulo# get registered into the run-time test suite definitions so that the test 28256761Srpaulo# engines know to recurse into these directories. 29256761Srpaulo# 30256761Srpaulo# In other words: list here any directories that contain test programs but use 31256761Srpaulo# SUBDIR for directories that may contain helper binaries and/or data files. 32256761SrpauloTESTS_SUBDIRS?= 33256761Srpaulo 34263172Sjmmv# If defined, indicates that the tests built by the Makefile are not part of 35263172Sjmmv# the FreeBSD Test Suite. The implication of this is that the tests won't be 36263172Sjmmv# installed under /usr/tests/ and that Kyua won't be able to run them. 37263172Sjmmv#NOT_FOR_TEST_SUITE= 38256763Srpaulo 39256764Srpaulo# List of variables to pass to the tests at run-time via the environment. 40256764SrpauloTESTS_ENV?= 41256764Srpaulo 42267331Sjmmv# Force all tests in a separate distribution file. 43267331Sjmmv# 44267331Sjmmv# We want this to be the case even when the distribution name is already 45267331Sjmmv# overriden. For example: we want the tests for programs in the 'games' 46267331Sjmmv# distribution to end up in the 'tests' distribution; the test programs 47267331Sjmmv# themselves have all the necessary logic to detect that the games are not 48267331Sjmmv# installed and thus won't cause false negatives. 49267331SjmmvDISTRIBUTION:= tests 50267331Sjmmv 51256764Srpaulo# Ordered list of directories to construct the PATH for the tests. 52256764SrpauloTESTS_PATH+= ${DESTDIR}/bin ${DESTDIR}/sbin \ 53256764Srpaulo ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin 54256764SrpauloTESTS_ENV+= PATH=${TESTS_PATH:tW:C/ +/:/g} 55256764Srpaulo 56256764Srpaulo# Ordered list of directories to construct the LD_LIBRARY_PATH for the tests. 57256764SrpauloTESTS_LD_LIBRARY_PATH+= ${DESTDIR}/lib ${DESTDIR}/usr/lib 58256764SrpauloTESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:C/ +/:/g} 59256764Srpaulo 60263161Sjmmv# List of all tests being built. The various *.test.mk modules extend this 61263161Sjmmv# variable as needed. 62263161Sjmmv_TESTS= 63263161Sjmmv 64263161Sjmmv# Pull in the definitions of all supported test interfaces. 65263161Sjmmv.include <atf.test.mk> 66263161Sjmmv.include <plain.test.mk> 67263161Sjmmv.include <tap.test.mk> 68263161Sjmmv 69295380Sngie# kyua automatically descends directories; only run make check on the 70295380Sngie# top-level directory 71295380Sngie.if !make(check) 72273803Sngie.for ts in ${TESTS_SUBDIRS} 73273810Sngie.if empty(SUBDIR:M${ts}) 74273803SngieSUBDIR+= ${ts} 75242711Ssjg.endif 76273803Sngie.endfor 77295643SbdrewerySUBDIR_PARALLEL= t 78295380Sngie.endif 79242711Ssjg 80242711Ssjg# it is rare for test cases to have man pages 81242711Ssjg.if !defined(MAN) 82265836SimpMAN= 83242711Ssjg.endif 84242711Ssjg 85263172Sjmmv.if !defined(NOT_FOR_TEST_SUITE) 86263172Sjmmv.include <suite.test.mk> 87256763Srpaulo.endif 88256763Srpaulo 89295380Sngie.if !target(realcheck) 90295380Sngierealcheck: .PHONY 91242711Ssjg @echo "$@ not defined; skipping" 92242711Ssjg.endif 93242711Ssjg 94295380Sngiebeforecheck realcheck aftercheck check: .PHONY 95295380Sngie.ORDER: beforecheck realcheck aftercheck 96295380Sngiecheck: beforecheck realcheck aftercheck 97242711Ssjg 98256761Srpaulo.include <bsd.progs.mk> 99