]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - share/mk/bsd.test.mk
Revert r289043.
[FreeBSD/stable/10.git] / share / mk / bsd.test.mk
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 # List of subdirectories containing tests into which to recurse.  This has the
14 # same semantics as SUBDIR at build-time.  However, the directories listed here
15 # get registered into the run-time test suite definitions so that the test
16 # engines know to recurse into these directories.
17 #
18 # In other words: list here any directories that contain test programs but use
19 # SUBDIR for directories that may contain helper binaries and/or data files.
20 TESTS_SUBDIRS?=
21
22 # If defined, indicates that the tests built by the Makefile are not part of
23 # the FreeBSD Test Suite.  The implication of this is that the tests won't be
24 # installed under /usr/tests/ and that Kyua won't be able to run them.
25 #NOT_FOR_TEST_SUITE=
26
27 # List of variables to pass to the tests at run-time via the environment.
28 TESTS_ENV?=
29
30 # Force all tests in a separate distribution file.
31 #
32 # We want this to be the case even when the distribution name is already
33 # overriden.  For example: we want the tests for programs in the 'games'
34 # distribution to end up in the 'tests' distribution; the test programs
35 # themselves have all the necessary logic to detect that the games are not
36 # installed and thus won't cause false negatives.
37 DISTRIBUTION:=  tests
38
39 # Ordered list of directories to construct the PATH for the tests.
40 TESTS_PATH+= ${DESTDIR}/bin ${DESTDIR}/sbin \
41              ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin
42 .if defined(.PARSEDIR)
43 TESTS_ENV+= PATH=${TESTS_PATH:tW:C/ +/:/g}
44 .else
45 TESTS_ENV+= PATH=${TESTS_PATH:N :Q:S,\\ ,:,g}
46 .endif
47
48 # Ordered list of directories to construct the LD_LIBRARY_PATH for the tests.
49 TESTS_LD_LIBRARY_PATH+= ${DESTDIR}/lib ${DESTDIR}/usr/lib
50 .if defined(.PARSEDIR)
51 TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:C/ +/:/g}
52 .else
53 TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:N :Q:S,\\ ,:,g}
54 .endif
55
56 # List of all tests being built.  The various *.test.mk modules extend this
57 # variable as needed.
58 _TESTS=
59
60 # Pull in the definitions of all supported test interfaces.
61 .include <atf.test.mk>
62 .include <plain.test.mk>
63 .include <tap.test.mk>
64
65 .for ts in ${TESTS_SUBDIRS}
66 .if empty(SUBDIR:M${ts})
67 SUBDIR+= ${ts}
68 .endif
69 .endfor
70
71 # it is rare for test cases to have man pages
72 .if !defined(MAN)
73 MAN=
74 .endif
75
76 # tell progs.mk we might want to install things
77 PROG_VARS+= BINDIR
78 PROGS_TARGETS+= install
79
80 .if !defined(NOT_FOR_TEST_SUITE)
81 .include <suite.test.mk>
82 .endif
83
84 .if !target(realtest)
85 realtest: .PHONY
86         @echo "$@ not defined; skipping"
87 .endif
88
89 test: .PHONY
90 .ORDER: beforetest realtest
91 test: beforetest realtest
92
93 .if target(aftertest)
94 .ORDER: realtest aftertest
95 test: aftertest
96 .endif
97
98 .if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS)
99 .include <bsd.progs.mk>
100 .endif
101 .include <bsd.files.mk>
102
103 .include <bsd.obj.mk>