xref: /freebsd/share/man/man7/tests.7 (revision 54e9e4e72d711fb41f88f793f6c64df1126112f9)
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 June 2, 2019
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
64The test suite is installed by default as of
65.Fx
6611.0-RELEASE.
67.Pp
68If the
69.Pa /usr/tests
70directory is missing, then you will have to enable the build of the test
71suite, rebuild your system and install the results.
72You can do so by setting
73.Sq WITH_TESTS=yes
74in your
75.Pa /etc/src.conf
76file (see
77.Xr src.conf 5
78for details)
79and rebuilding the system as described in
80.Xr build 7 .
81.Ss When to run the tests?
82Before diving into the details of how to run the test suite, here are some
83scenarios in which you should run it:
84.Bl -bullet -offset indent
85.It
86After a fresh installation of
87.Fx
88to ensure that the system works correctly on your hardware platform.
89.It
90After an upgrade of
91.Fx
92to a different version to ensure that the new code works well on your
93hardware platform and that the upgrade did not introduce regressions in your
94configuration.
95.It
96After modifying the source tree to detect any new bugs and/or regressions.
97.It
98Periodically, maybe from a
99.Xr cron 8
100job, to ensure that any changes to the system (such as the installation of
101third-party packages or manual modifications to configuration files) do not
102introduce unexpected failures.
103.El
104.Ss Running the tests
105First, you will need to install the
106.Sq devel/kyua
107package from
108.Xr ports 7 .
109Then use the following command to run the whole test suite:
110.Bd -literal -offset indent
111$ kyua test -k /usr/tests/Kyuafile
112.Ed
113.Pp
114The above will iterate through all test programs in
115.Pa /usr/tests
116recursively, execute them, store their results and debugging data in Kyua's
117database (by default in
118.Pa ~/.kyua/store.db ) ,
119and print a summary of the results.
120This summary includes a brief count of all total tests run and how many of
121them failed.
122.Pp
123It is possible to restrict which tests to run by providing their names in
124the command line.
125For example, this would execute the tests for the
126.Xr cp 1
127and
128.Xr cut 1
129utilities:
130.Bd -literal -offset indent
131$ kyua test -k /usr/tests/Kyuafile bin/cp usr.bin/cut
132.Ed
133.Ss Obtaining reports of the tests execution
134Additional information about the test results can be retrieved
135by using Kyua's various reporting commands.
136For example, the following would print a plain-text report of the executed
137tests and show which ones failed:
138.Bd -literal -offset indent
139$ kyua report
140.Ed
141.Pp
142This example would generate an HTML report ready to be published on a
143web server:
144.Bd -literal -offset indent
145$ kyua report-html --output ~/public_html/tests
146.Ed
147.Pp
148For further details on the command-line interface of Kyua, please refer
149to its manual page
150.Xr kyua 1 .
151.Ss Configuring the tests
152Some test cases in the
153.Fx
154Test Suite require manual configuration by the administrator before they can be
155run.
156Unless certain properties are defined, the tests that require them will be
157skipped.
158.Pp
159Test suites are configured by defining their configuration
160variables in
161.Pa /usr/local/etc/kyua/kyua.conf .
162The format of this file is detailed in
163.Xr kyua.conf 5 .
164.Pp
165The following configuration variables are available in the
166.Fx
167Test Suite:
168.Bl -tag -width "allow_sysctl_side_effects"
169.It allow_devfs_side_effects
170If defined, enables tests that may destroy and recreate semipermanent device
171nodes, like disk devices.
172Without this variable, tests may still create and destroy devices nodes that
173are normally transient, like /dev/tap* and /dev/pts*, as long as they clean
174them up afterwards.
175However, tests that require this variable have a relaxed cleanup requirement;
176they must recreate any devices that they destroyed, but not necessarily with
177the same devnames.
178.It allow_sysctl_side_effects
179Enables tests that change globally significant
180.Xr sysctl 8
181variables.
182The tests will undo any changes in their cleanup phases.
183.It disks
184Must be set to a space delimited list of disk device nodes.
185Tests that need destructive access to disks must use these devices.
186Tests are not required to preserve any data present on these disks.
187.It fibs
188Must be set to a space delimited list of FIBs (routing tables).
189Tests that need to modify a routing table may use any of these.
190Tests will cleanup any new routes that they create.
191.El
192.Ss What to do if something fails?
193If there is
194.Em any failure
195during the execution of the test suite, please consider reporting it to the
196.Fx
197developers so that the failure can be analyzed and fixed.
198To do so, either send a message to the appropriate mailing list or file a
199problem report.
200For more details please refer to:
201.Bl -bullet -offset indent -compact
202.It
203.Lk https://lists.freebsd.org/ "FreeBSD Mailing Lists"
204.It
205.Lk https://www.freebsd.org/support.html "Problem Reporting"
206.El
207.Sh FILES
208.Bl -tag -compact -width usrXlocalXetcXkyuaXkyuaXconfXX
209.It Pa /usr/local/etc/kyua/kyua.conf
210System-wide configuration file for
211.Xr kyua 1 .
212.It Pa ~/.kyua/kyua.conf
213User-specific configuration file for
214.Xr kyua 1 ;
215overrides the system file.
216.It Pa ~/.kyua/store.db
217Default result database used by Kyua.
218.It Pa /usr/tests/
219Location of the
220.Fx
221Test Suite.
222.It Pa /usr/tests/Kyuafile
223Top-level test suite definition file.
224.El
225.Sh SEE ALSO
226.Xr kyua 1 ,
227.Xr atf 7 ,
228.Xr build 7
229.Sh HISTORY
230The
231.Fx
232Test Suite first appeared in
233.Fx 10.1 .
234.Pp
235The
236.Nm
237manual page first appeared in
238.Nx 6.0
239and was later ported to
240.Fx 10.1 .
241.Sh AUTHORS
242.An Julio Merino Aq Mt jmmv@FreeBSD.org
243