1# $FreeBSD$ 2# 3# Generic build infrastructure for test programs. 4# 5# This is the only public file that should be included by Makefiles when 6# tests are to be built. All other *.test.mk files are internal and not 7# to be included directly. 8 9.include <bsd.init.mk> 10 11__<bsd.test.mk>__: 12 13.ifndef TESTSDIR 14.error "Please define TESTSDIR when including bsd.test.mk" 15.endif 16PACKAGE= tests 17 18# List of subdirectories containing tests into which to recurse. This has the 19# same semantics as SUBDIR at build-time. However, the directories listed here 20# get registered into the run-time test suite definitions so that the test 21# engines know to recurse into these directories. 22# 23# In other words: list here any directories that contain test programs but use 24# SUBDIR for directories that may contain helper binaries and/or data files. 25TESTS_SUBDIRS?= 26 27# If defined, indicates that the tests built by the Makefile are not part of 28# the FreeBSD Test Suite. The implication of this is that the tests won't be 29# installed under /usr/tests/ and that Kyua won't be able to run them. 30#NOT_FOR_TEST_SUITE= 31 32# List of variables to pass to the tests at run-time via the environment. 33TESTS_ENV?= 34 35# Force all tests in a separate distribution file. 36# 37# We want this to be the case even when the distribution name is already 38# overriden. For example: we want the tests for programs in the 'games' 39# distribution to end up in the 'tests' distribution; the test programs 40# themselves have all the necessary logic to detect that the games are not 41# installed and thus won't cause false negatives. 42DISTRIBUTION:= tests 43 44# Ordered list of directories to construct the PATH for the tests. 45TESTS_PATH+= ${DESTDIR}/bin ${DESTDIR}/sbin \ 46 ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin 47TESTS_ENV+= PATH=${TESTS_PATH:tW:C/ +/:/g} 48 49# Ordered list of directories to construct the LD_LIBRARY_PATH for the tests. 50TESTS_LD_LIBRARY_PATH+= ${DESTDIR}/lib ${DESTDIR}/usr/lib 51TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:C/ +/:/g} 52 53# List of all tests being built. The various *.test.mk modules extend this 54# variable as needed. 55_TESTS= 56 57# Pull in the definitions of all supported test interfaces. 58.include <atf.test.mk> 59.include <plain.test.mk> 60.include <tap.test.mk> 61 62.for ts in ${TESTS_SUBDIRS} 63.if empty(SUBDIR:M${ts}) 64SUBDIR+= ${ts} 65.endif 66.endfor 67 68# it is rare for test cases to have man pages 69.if !defined(MAN) 70MAN= 71.endif 72 73# tell progs.mk we might want to install things 74PROG_VARS+= BINDIR 75PROGS_TARGETS+= install 76 77.if !defined(NOT_FOR_TEST_SUITE) 78.include <suite.test.mk> 79.endif 80 81.if !target(realtest) 82realtest: .PHONY 83 @echo "$@ not defined; skipping" 84.endif 85 86test: .PHONY 87.ORDER: beforetest realtest 88test: beforetest realtest 89 90.if target(aftertest) 91.ORDER: realtest aftertest 92test: aftertest 93.endif 94 95.if !empty(SUBDIR) 96.include <bsd.subdir.mk> 97.endif 98 99.ifdef PROG 100# we came here via bsd.progs.mk below 101# parent will do staging. 102MK_STAGING= no 103.endif 104 105.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS) 106.include <bsd.progs.mk> 107.endif 108.include <bsd.files.mk> 109 110.if !defined(PROG) && ${MK_STAGING} != "no" 111.if !defined(_SKIP_BUILD) 112# this will handle staging if needed 113_SKIP_STAGING= no 114# but we don't want it to build anything 115_SKIP_BUILD= 116.endif 117.if !empty(PROGS) 118stage_files.prog: ${PROGS} 119.endif 120.include <bsd.prog.mk> 121.endif 122 123.if !target(objwarn) 124.include <bsd.obj.mk> 125.endif 126