xref: /freebsd/share/man/man7/tests.7 (revision c7a063741720ef81d4caa4613242579d12f1d605)
1.\"	$FreeBSD$
2.\"	$NetBSD: tests.kyua.7,v 1.2 2013/07/20 21:39:59 wiz Exp $
3.\"
4.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28.\"
29.Dd August 19, 2020
30.Dt TESTS 7
31.Os
32.Sh NAME
33.Nm tests
34.Nd introduction to the
35.Fx
36Test Suite
37.Sh DESCRIPTION
38The
39.Fx
40Test Suite provides a collection of automated tests for two major purposes.
41On one hand, the test suite aids
42.Em developers
43to detect bugs and regressions when they modify the source tree.
44On the other hand, it allows
45.Em end users
46(and, in particular, system administrators) to verify that fresh installations
47of the
48.Fx
49operating system behave correctly on their hardware platform and also to ensure
50that the system does not suffer from regressions during regular operation and
51maintenance.
52.Pp
53The
54.Fx
55Test Suite can be found in the
56.Pa /usr/tests
57hierarchy.
58.Pp
59This manual page describes how to run the test suite and how to configure
60some of its optional features.
61For information on writing the tests, see
62.Xr atf 7 .
63.Ss Installing the test suite
64If the
65.Pa /usr/tests
66directory is missing, then you will have to enable the build of the test
67suite, rebuild your system and install the results.
68You can do so by setting
69.Sq WITH_TESTS=yes
70in your
71.Pa /etc/src.conf
72file (see
73.Xr src.conf 5
74for details)
75and rebuilding the system as described in
76.Xr build 7 .
77.Ss When to run the tests?
78Before diving into the details of how to run the test suite, here are some
79scenarios in which you should run it:
80.Bl -bullet -offset indent
81.It
82After a fresh installation of
83.Fx
84to ensure that the system works correctly on your hardware platform.
85.It
86After an upgrade of
87.Fx
88to a different version to ensure that the new code works well on your
89hardware platform and that the upgrade did not introduce regressions in your
90configuration.
91.It
92After modifying the source tree to detect any new bugs and/or regressions.
93.It
94Periodically, maybe from a
95.Xr cron 8
96job, to ensure that any changes to the system (such as the installation of
97third-party packages or manual modifications to configuration files) do not
98introduce unexpected failures.
99.El
100.Ss Running the tests
101Use the following command to run the whole test suite:
102.Bd -literal -offset indent
103$ kyua test -k /usr/tests/Kyuafile
104.Ed
105.Pp
106The above will iterate through all test programs in
107.Pa /usr/tests
108recursively, execute them, store their results and debugging data in Kyua's
109database (by default in
110.Pa ~/.kyua/store.db ) ,
111and print a summary of the results.
112This summary includes a brief count of all total tests run and how many of
113them failed.
114.Pp
115It is possible to restrict which tests to run by providing their names in
116the command line.
117For example, this would execute the tests for the
118.Xr cp 1
119and
120.Xr cut 1
121utilities:
122.Bd -literal -offset indent
123$ kyua test -k /usr/tests/Kyuafile bin/cp usr.bin/cut
124.Ed
125.Ss Obtaining reports of the tests execution
126Additional information about the test results can be retrieved
127by using Kyua's various reporting commands.
128For example, the following would print a plain-text report of the executed
129tests and show which ones failed:
130.Bd -literal -offset indent
131$ kyua report --verbose -r <.db file from output of test>
132.Ed
133.Pp
134This example would generate an HTML report ready to be published on a
135web server:
136.Bd -literal -offset indent
137$ kyua report-html --output ~/public_html/tests
138.Ed
139.Pp
140For further details on the command-line interface of Kyua, please refer
141to its manual page
142.Xr kyua 1 .
143.Ss Configuring the tests
144Some test cases in the
145.Fx
146Test Suite require manual configuration by the administrator before they can be
147run.
148Unless certain properties are defined, the tests that require them will be
149skipped.
150.Pp
151Test suites are configured by defining their configuration
152variables in
153.Pa /etc/kyua/kyua.conf .
154The format of this file is detailed in
155.Xr kyua.conf 5 .
156.Pp
157The following configuration variables are available in the
158.Fx
159Test Suite:
160.Bl -tag -width "allow_sysctl_side_effects"
161.It allow_devfs_side_effects
162If defined, enables tests that may destroy and recreate semipermanent device
163nodes, like disk devices.
164Without this variable, tests may still create and destroy devices nodes that
165are normally transient, like /dev/tap* and /dev/pts*, as long as they clean
166them up afterwards.
167However, tests that require this variable have a relaxed cleanup requirement;
168they must recreate any devices that they destroyed, but not necessarily with
169the same devnames.
170.It allow_sysctl_side_effects
171Enables tests that change globally significant
172.Xr sysctl 8
173variables.
174The tests will undo any changes in their cleanup phases.
175.It disks
176Must be set to a space delimited list of disk device nodes.
177Tests that need destructive access to disks must use these devices.
178Tests are not required to preserve any data present on these disks.
179.It fibs
180Must be set to a space delimited list of FIBs (routing tables).
181Tests that need to modify a routing table may use any of these.
182Tests will cleanup any new routes that they create.
183.El
184.Ss What to do if something fails?
185If there is
186.Em any failure
187during the execution of the test suite, please consider reporting it to the
188.Fx
189developers so that the failure can be analyzed and fixed.
190To do so, either send a message to the appropriate mailing list or file a
191problem report.
192For more details please refer to:
193.Bl -bullet -offset indent -compact
194.It
195.Lk https://lists.freebsd.org/ "FreeBSD Mailing Lists"
196.It
197.Lk https://www.freebsd.org/support/ "Problem Reporting"
198.El
199.Sh FILES
200.Bl -tag -compact -width "/etc/kyua/kyua.conf"
201.It Pa /etc/kyua/kyua.conf
202System-wide configuration file for
203.Xr kyua 1 .
204.It Pa ~/.kyua/kyua.conf
205User-specific configuration file for
206.Xr kyua 1 ;
207overrides the system file.
208.It Pa ~/.kyua/store.db
209Default result database used by Kyua.
210.It Pa /usr/tests/
211Location of the
212.Fx
213Test Suite.
214.It Pa /usr/tests/Kyuafile
215Top-level test suite definition file.
216.El
217.Sh SEE ALSO
218.Xr kyua 1 ,
219.Xr atf 7 ,
220.Xr build 7 ,
221.Xr development 7
222.Sh HISTORY
223The
224.Fx
225Test Suite first appeared in
226.Fx 10.1
227and was installed by default in
228.Fx 11.0 .
229.Pp
230The
231.Nm
232manual page first appeared in
233.Nx 6.0
234and was later ported to
235.Fx 10.1 .
236.Pp
237The test driver,
238.Xr kyua 1 ,
239was imported as part of the base system in
240.Fx 13.0 ,
241previously being available only in
242.Xr ports 7 .
243.Sh AUTHORS
244.An Julio Merino Aq Mt jmmv@FreeBSD.org
245