xref: /openbsd-src/share/man/man5/bsd.regress.mk.5 (revision 03adc85b7600a1f8f04886b8321c1c1c0c4933d4)
1.\" $OpenBSD: bsd.regress.mk.5,v 1.11 2017/01/16 07:00:03 jmc Exp $
2.\"
3.\" Copyright (c) 2002 Anil Madhavapeddy
4.\" Copyright (c) 2000 Marc Espie
5.\"
6.\" All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27.\"
28.Dd $Mdocdate: January 16 2017 $
29.Dt BSD.REGRESS.MK 5
30.Os
31.Sh NAME
32.Nm bsd.regress.mk
33.Nd regression test master Makefile fragment
34.Sh SYNOPSIS
35.Fd .include <bsd.regress.mk>
36.Sh DESCRIPTION
37.Nm
38holds the standard routines used by the source regression tests.
39Some variables and targets are for its internal use only.
40The rest are documented here.
41.Pp
42Since this file also includes
43.Nm bsd.prog.mk ,
44all of the usual
45.Ox
46Makefile variables may be used to build the regression
47test programs.
48.Sh TARGETS
49.Bl -tag -width regress
50.It Cm depend
51Build any dependencies required to carry out the current set
52of regression tests.
53.It Cm regress
54Executes all of the regression targets defined in the Makefile.
55If one of the tests fails, the line
56.Qq FAILED
57is printed to the standard output.
58By default, execution continues with the next test and, after running
59all the tests,
60.Sy make Cm regress
61exits with an exit status of 0 even if some of the tests failed.
62.It Cm run-regress-*
63Runs an individual regression test.
64If the exit status of the program indicates an error or timeout,
65then a failure is logged, otherwise the test is marked as a success.
66.El
67.Sh VARIABLES
68.Bl -tag -width Ds
69.It Ev REGRESS_FAIL_EARLY
70If this variable is set to anything but
71.Dq no ,
72the
73.Cm regress
74target will abort as soon as a test fails.
75This variable is intended to be set at runtime in the environment
76or in
77.Pa /etc/mk.conf ,
78but not in the test's Makefile itself.
79.It Ev REGRESS_LOG
80Points to the fully-qualified path of a file to which regression
81results are appended.
82Defaults to
83.Pa /dev/null .
84.It Ev REGRESS_MAXTIME
85Maximum limit of CPU seconds to spend on the regression test.
86Exceeding this time will result in a failure being logged.
87.It Ev REGRESS_ROOT_TARGETS
88Targets for which root access is required to run the test.
89The
90.Ev SUDO
91variable is invoked for these targets.
92See also
93.Ev SUDO .
94.It Ev REGRESS_SKIP_SLOW
95If this variable is not empty, skip over all the regression
96tests which have been marked as being 'slow' using the
97.Ev REGRESS_SLOW_TARGETS
98variable.
99.It Ev REGRESS_SLOW_TARGETS
100Targets which are defined as 'slow'.
101All of these tests can be skipped by setting the
102.Ev REGRESS_SKIP_SLOW
103variable.
104.It Ev REGRESS_TARGETS
105Targets which are invoked to run the set of regression tests
106for this Makefile.
107Defaults to
108.Cm run-regress-${PROG} .
109.It Ev SUDO
110Location of a command used to switch to root for certain
111test targets which require it.
112See
113.Xr doas 1 .
114.El
115.Sh GUIDELINES
116If an individual test passes,
117.Sy make Ar testname
118should return with an exit status of 0.
119If it fails, it should return with a non-zero exit status.
120.Pp
121If a test cannot be executed because a package is not installed or
122some environment variable is not set,
123.Sy make Ar testname
124should print
125.Qq SKIPPED
126to stdout and exit with status 0.
127To skip everything, implement the
128.Cm regress
129target with a command that prints
130.Qq SKIPPED .
131.Pp
132Tests should not fail because an intended feature has not been
133implemented yet.
134To avoid such false failures, a test should show the reason, print
135.Qq DISABLED
136to stdout and exit with status 0.
137.Pp
138Tests must be able to run with an
139.Pa obj
140directory.
141In case the test is not linked to the build or the tester forgot
142to run
143.Sy make Cm obj
144before, this directory or symlink may not exist.
145Then the test should run anyway.
146.Pp
147Test are executed with
148.Sy make Cm regress ,
149but running
150.Sy make Cm all
151or
152.Sy make
153should have the same effect.
154.Pp
155Tests should use the binaries installed and the kernel running on
156the local system.
157They may use environment variables to test alternative binaries or
158remote kernels running on other machines.
159In some cases a test may need binaries or libraries or object files
160to be present in
161.Pa /usr/obj/
162that exist only after
163.Sy make Cm build
164was run in
165.Pa /usr/src/ .
166The test must not assume that they have already been built, but
167should run
168.Sy make
169in the appropriate source directory as a dependency.
170The
171.Pa /usr/src/
172tree can be found with a relative path or with the
173.Ev BSDSRCDIR
174variable.
175.Sh SEE ALSO
176.Xr bsd.port.mk 5
177.Sh HISTORY
178The regression system originally came from
179.Nx ,
180with many tests added by
181.Ox
182since.
183The current Makefile framework was written by Artur Grabowski
184and Marc Espie for
185.Ox 3.1 .
186.Sh BUGS AND LIMITATIONS
187The build system is unable to distinguish between timeouts due to
188.Ev REGRESS_MAXTIME
189being exceeded, or a genuine failure occurring.
190