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