]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/mk/bsd.test.mk
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / mk / bsd.test.mk
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)
7 PROGS+= ${TESTS_C}
8 .for _T in ${TESTS_C}
9 BINDIR.${_T}= ${TESTSDIR}
10 MAN.${_T}?= # empty
11 .endfor
12 .endif
13
14 .if defined(TESTS_CXX)
15 PROGS_CXX+= ${TESTS_CXX}
16 PROGS+= ${TESTS_CXX}
17 .for _T in ${TESTS_CXX}
18 BINDIR.${_T}= ${TESTSDIR}
19 MAN.${_T}?= # empty
20 .endfor
21 .endif
22
23 .if defined(TESTS_SH)
24 SCRIPTS+= ${TESTS_SH}
25 .for _T in ${TESTS_SH}
26 SCRIPTSDIR_${_T}= ${TESTSDIR}
27 .endfor
28 .endif
29
30 TESTSBASE?= ${DESTDIR}/usr/tests
31
32 # it is rare for test cases to have man pages
33 .if !defined(MAN)
34 WITHOUT_MAN=yes
35 .export WITHOUT_MAN
36 .endif
37
38 # tell progs.mk we might want to install things
39 PROG_VARS+= BINDIR
40 PROGS_TARGETS+= install
41
42 .if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS)
43 .include <bsd.progs.mk>
44 .endif
45
46 beforetest: .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)
66 realtest: .PHONY
67         @echo "$@ not defined; skipping"
68 .endif
69
70 test: .PHONY
71 .ORDER: beforetest realtest
72 test: beforetest realtest
73
74 .if target(aftertest)
75 .ORDER: realtest aftertest
76 test: aftertest
77 .endif
78
79 .include <bsd.obj.mk>