summaryrefslogtreecommitdiffstats
path: root/share/mk/bsd.test.mk
blob: a75298f42d65d08be649c22e95ef6b7ad1166d1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# $NetBSD: bsd.test.mk,v 1.21 2012/08/25 22:21:16 jmmv Exp $
# $FreeBSD$

.include <bsd.init.mk>

.if defined(TESTS_C)
PROGS+=	${TESTS_C}
.for _T in ${TESTS_C}
BINDIR.${_T}= ${TESTSDIR}
MAN.${_T}?= # empty
.endfor
.endif

.if defined(TESTS_CXX)
PROGS_CXX+= ${TESTS_CXX}
PROGS+= ${TESTS_CXX}
.for _T in ${TESTS_CXX}
BINDIR.${_T}= ${TESTSDIR}
MAN.${_T}?= # empty
.endfor
.endif

.if defined(TESTS_SH)
SCRIPTS+= ${TESTS_SH}
.for _T in ${TESTS_SH}
SCRIPTSDIR_${_T}= ${TESTSDIR}
.endfor
.endif

TESTSBASE?= ${DESTDIR}/usr/tests

# it is rare for test cases to have man pages
.if !defined(MAN)
WITHOUT_MAN=yes
.export WITHOUT_MAN
.endif

# tell progs.mk we might want to install things
PROG_VARS+= BINDIR
PROGS_TARGETS+= install

.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS)
.include <bsd.progs.mk>
.endif

beforetest: .PHONY
.if defined(TESTSDIR)
.if ${TESTSDIR} == ${TESTSBASE}
# Forbid running from ${TESTSBASE}.  It can cause false positives/negatives and
# it does not cover all the tests (e.g. it misses testing software in external).
	@echo "*** Sorry, you cannot use make test from src/tests.  Install the"
	@echo "*** tests into their final location and run them from ${TESTSBASE}"
	@false
.else
	@echo "*** Using this test does not preclude you from running the tests"
	@echo "*** installed in ${TESTSBASE}.  This test run may raise false"
	@echo "*** positives and/or false negatives."
.endif
.else
	@echo "*** No TESTSDIR defined; nothing to do."
	@false
.endif
	@echo

.if !target(realtest)
realtest: .PHONY
	@echo "$@ not defined; skipping"
.endif

test: .PHONY
.ORDER: beforetest realtest
test: beforetest realtest

.if target(aftertest)
.ORDER: realtest aftertest
test: aftertest
.endif

.include <bsd.obj.mk>
OpenPOWER on IntegriCloud