1# $NetBSD: bsd.test.mk,v 1.21 2012/08/25 22:21:16 jmmv Exp $ 2# $FreeBSD$ 3 4.include <bsd.init.mk> 5 6.if defined(TESTS_C) 7PROGS+= ${TESTS_C} 8.for _T in ${TESTS_C} 9BINDIR.${_T}= ${TESTSDIR} 10MAN.${_T}?= # empty 11.endfor 12.endif 13 14.if defined(TESTS_CXX) 15PROGS_CXX+= ${TESTS_CXX} 16PROGS+= ${TESTS_CXX} 17.for _T in ${TESTS_CXX} 18BINDIR.${_T}= ${TESTSDIR} 19MAN.${_T}?= # empty 20.endfor 21.endif 22 23.if defined(TESTS_SH) 24SCRIPTS+= ${TESTS_SH} 25.for _T in ${TESTS_SH} 26SCRIPTSDIR_${_T}= ${TESTSDIR} 27.endfor 28.endif 29 30TESTSBASE?= ${DESTDIR}/usr/tests 31 32# it is rare for test cases to have man pages 33.if !defined(MAN) 34WITHOUT_MAN=yes 35.export WITHOUT_MAN 36.endif 37 38# tell progs.mk we might want to install things 39PROG_VARS+= BINDIR 40PROGS_TARGETS+= install 41 42.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS) 43.include <bsd.progs.mk> 44.endif 45 46beforetest: .PHONY 47.if defined(TESTSDIR) 48.if ${TESTSDIR} == ${TESTSBASE} 49# Forbid running from ${TESTSBASE}. It can cause false positives/negatives and 50# it does not cover all the tests (e.g. it misses testing software in external). 51 @echo "*** Sorry, you cannot use make test from src/tests. Install the" 52 @echo "*** tests into their final location and run them from ${TESTSBASE}" 53 @false 54.else 55 @echo "*** Using this test does not preclude you from running the tests" 56 @echo "*** installed in ${TESTSBASE}. This test run may raise false" 57 @echo "*** positives and/or false negatives." 58.endif 59.else 60 @echo "*** No TESTSDIR defined; nothing to do." 61 @false 62.endif 63 @echo 64 65.if !target(realtest) 66realtest: .PHONY 67 @echo "$@ not defined; skipping" 68.endif 69 70test: .PHONY 71.ORDER: beforetest realtest 72test: beforetest realtest 73 74.if target(aftertest) 75.ORDER: realtest aftertest 76test: aftertest 77.endif 78 79.include <bsd.obj.mk> 80