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