xref: /freebsd/share/man/man7/tests.7 (revision 8fea68c6a6ed5f727789b5d695da2b857f060057)
1f56169f4SRui Paulo.\"	$FreeBSD$
2f56169f4SRui Paulo.\"	$NetBSD: tests.kyua.7,v 1.2 2013/07/20 21:39:59 wiz Exp $
3f56169f4SRui Paulo.\"
4f56169f4SRui Paulo.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
5f56169f4SRui Paulo.\" All rights reserved.
6f56169f4SRui Paulo.\"
7f56169f4SRui Paulo.\" Redistribution and use in source and binary forms, with or without
8f56169f4SRui Paulo.\" modification, are permitted provided that the following conditions
9f56169f4SRui Paulo.\" are met:
10f56169f4SRui Paulo.\" 1. Redistributions of source code must retain the above copyright
11f56169f4SRui Paulo.\"    notice, this list of conditions and the following disclaimer.
12f56169f4SRui Paulo.\" 2. Redistributions in binary form must reproduce the above copyright
13f56169f4SRui Paulo.\"    notice, this list of conditions and the following disclaimer in the
14f56169f4SRui Paulo.\"    documentation and/or other materials provided with the distribution.
15f56169f4SRui Paulo.\"
16f56169f4SRui Paulo.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17f56169f4SRui Paulo.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18f56169f4SRui Paulo.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19f56169f4SRui Paulo.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20f56169f4SRui Paulo.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21f56169f4SRui Paulo.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22f56169f4SRui Paulo.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23f56169f4SRui Paulo.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24f56169f4SRui Paulo.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25f56169f4SRui Paulo.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26f56169f4SRui Paulo.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27f56169f4SRui Paulo.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28f56169f4SRui Paulo.\"
29*8fea68c6SEnji Cooper.Dd March 22, 2017
30f56169f4SRui Paulo.Dt TESTS 7
31f56169f4SRui Paulo.Os
32f56169f4SRui Paulo.Sh NAME
33f56169f4SRui Paulo.Nm tests
34fb77db09SEnji Cooper.Nd introduction to the
35fb77db09SEnji Cooper.Fx
36fb77db09SEnji CooperTest Suite
37f56169f4SRui Paulo.Sh DESCRIPTION
38f56169f4SRui PauloThe
39f56169f4SRui Paulo.Fx
40985e53cfSJulio MerinoTest Suite provides a collection of automated tests for two major purposes.
41b2b6c6a8SAlan SomersOn one hand, the test suite aids
42f56169f4SRui Paulo.Em developers
43fb77db09SEnji Cooperto detect bugs and regressions when they modify the source tree.
44fb77db09SEnji CooperOn the other hand, it allows
45f56169f4SRui Paulo.Em end users
46f56169f4SRui Paulo(and, in particular, system administrators) to verify that fresh installations
47f56169f4SRui Pauloof the
48f56169f4SRui Paulo.Fx
49b2b6c6a8SAlan Somersoperating system behave correctly on their hardware platform and also to ensure
50b2b6c6a8SAlan Somersthat the system does not suffer from regressions during regular operation and
51b2b6c6a8SAlan Somersmaintenance.
52f56169f4SRui Paulo.Pp
53f56169f4SRui PauloThe
54f56169f4SRui Paulo.Fx
55985e53cfSJulio MerinoTest Suite can be found in the
56f56169f4SRui Paulo.Pa /usr/tests
57f56169f4SRui Paulohierarchy.
58f56169f4SRui Paulo.Pp
59b2b6c6a8SAlan SomersThis manual page describes how to run the test suite and how to configure
60f56169f4SRui Paulosome of its optional features.
61e1c6a283SJulio Merino.Ss Installing the test suite
62e1c6a283SJulio MerinoThe test suite is not yet installed by default as part of
63e1c6a283SJulio Merino.Fx ,
64e1c6a283SJulio Merinobut this is bound to change during the development of
65e1c6a283SJulio Merino.Fx 11.0 .
66e1c6a283SJulio Merino.Pp
67e1c6a283SJulio MerinoIf the
68e1c6a283SJulio Merino.Pa /usr/tests
69e1c6a283SJulio Merinodirectory is missing, then you will have to enable the build of the test
70e1c6a283SJulio Merinosuite, rebuild your system and install the results.
71e1c6a283SJulio MerinoYou can do so by setting
72e1c6a283SJulio Merino.Sq WITH_TESTS=yes
73e1c6a283SJulio Merinoin your
74e1c6a283SJulio Merino.Pa /etc/src.conf
75e1c6a283SJulio Merinofile (see
76e1c6a283SJulio Merino.Xr src.conf 5
77e1c6a283SJulio Merinofor details)
78e1c6a283SJulio Merinoand rebuilding the system as described in
79e1c6a283SJulio Merino.Xr build 7 .
80f56169f4SRui Paulo.Ss When to run the tests?
81f56169f4SRui PauloBefore diving into the details of how to run the test suite, here are some
82b2b6c6a8SAlan Somersscenarios in which you should run it:
83f56169f4SRui Paulo.Bl -bullet -offset indent
84f56169f4SRui Paulo.It
85f56169f4SRui PauloAfter a fresh installation of
86f56169f4SRui Paulo.Fx
87f56169f4SRui Pauloto ensure that the system works correctly on your hardware platform.
88f56169f4SRui Paulo.It
89f56169f4SRui PauloAfter an upgrade of
90f56169f4SRui Paulo.Fx
91f56169f4SRui Pauloto a different version to ensure that the new code works well on your
92f56169f4SRui Paulohardware platform and that the upgrade did not introduce regressions in your
93f56169f4SRui Pauloconfiguration.
94f56169f4SRui Paulo.It
95b2b6c6a8SAlan SomersAfter modifying the source tree to detect any new bugs and/or regressions.
96f56169f4SRui Paulo.It
97f56169f4SRui PauloPeriodically, maybe from a
98f56169f4SRui Paulo.Xr cron 8
99f56169f4SRui Paulojob, to ensure that any changes to the system (such as the installation of
100f56169f4SRui Paulothird-party packages or manual modifications to configuration files) do not
101f56169f4SRui Paulointroduce unexpected failures.
102f56169f4SRui Paulo.El
103f56169f4SRui Paulo.Ss Running the tests
104b2b6c6a8SAlan SomersFirst, you will need to install the
105b2b6c6a8SAlan Somers.Sq devel/kyua
106b2b6c6a8SAlan Somerspackage from
107b2b6c6a8SAlan Somers.Xr ports 7 .
108b2b6c6a8SAlan SomersThen use the following command to run the whole test suite:
109f56169f4SRui Paulo.Bd -literal -offset indent
110f56169f4SRui Paulo$ kyua test -k /usr/tests/Kyuafile
111f56169f4SRui Paulo.Ed
112f56169f4SRui Paulo.Pp
113b2b6c6a8SAlan SomersThe above will iterate through all test programs in
114f56169f4SRui Paulo.Pa /usr/tests
115b2b6c6a8SAlan Somersrecursively, execute them, store their results and debugging data in Kyua's
116f56169f4SRui Paulodatabase (by default in
117f56169f4SRui Paulo.Pa ~/.kyua/store.db ) ,
118f56169f4SRui Pauloand print a summary of the results.
119f56169f4SRui PauloThis summary includes a brief count of all total tests run and how many of
120f56169f4SRui Paulothem failed.
121f56169f4SRui Paulo.Pp
122f56169f4SRui PauloIt is possible to restrict which tests to run by providing their names in
123f56169f4SRui Paulothe command line.
124f56169f4SRui PauloFor example, this would execute the tests for the
125f56169f4SRui Paulo.Xr cp 1
126f56169f4SRui Pauloand
127f56169f4SRui Paulo.Xr cut 1
128f56169f4SRui Pauloutilities:
129f56169f4SRui Paulo.Bd -literal -offset indent
130f56169f4SRui Paulo$ kyua test -k /usr/tests/Kyuafile bin/cp usr.bin/cut
131f56169f4SRui Paulo.Ed
132f56169f4SRui Paulo.Ss Obtaining reports of the tests execution
133b2b6c6a8SAlan SomersAdditional information about the test results can be retrieved
134b2b6c6a8SAlan Somersby using Kyua's various reporting commands.
135b2b6c6a8SAlan SomersFor example, the following would print a plain-text report of the executed
136f56169f4SRui Paulotests and show which ones failed:
137f56169f4SRui Paulo.Bd -literal -offset indent
138f56169f4SRui Paulo$ kyua report
139f56169f4SRui Paulo.Ed
140f56169f4SRui Paulo.Pp
141b2b6c6a8SAlan SomersThis example would generate an HTML report ready to be published on a
142f56169f4SRui Pauloweb server:
143f56169f4SRui Paulo.Bd -literal -offset indent
144f56169f4SRui Paulo$ kyua report-html --output ~/public_html/tests
145f56169f4SRui Paulo.Ed
146f56169f4SRui Paulo.Pp
147f56169f4SRui PauloFor further details on the command-line interface of Kyua, please refer
148f56169f4SRui Pauloto its manual page
149f56169f4SRui Paulo.Xr kyua 1 .
150b2b6c6a8SAlan Somers.Ss Configuring the tests
151b2b6c6a8SAlan SomersSome test cases in the
152b2b6c6a8SAlan Somers.Fx
153985e53cfSJulio MerinoTest Suite require manual configuration by the administrator before they can be
154*8fea68c6SEnji Cooperrun.
155*8fea68c6SEnji CooperUnless certain properties are defined, the tests that require them will be
156*8fea68c6SEnji Cooperskipped.
157b2b6c6a8SAlan Somers.Pp
158b2b6c6a8SAlan SomersTest suites are configured by defining their configuration
159b2b6c6a8SAlan Somersvariables in
160b2b6c6a8SAlan Somers.Pa /usr/local/etc/kyua/kyua.conf .
161b2b6c6a8SAlan SomersThe format of this file is detailed in
162b2b6c6a8SAlan Somers.Xr kyua.conf 5 .
163b2b6c6a8SAlan Somers.Pp
164b2b6c6a8SAlan SomersThe following configuration variables are available in the
165b2b6c6a8SAlan Somers.Fx
166985e53cfSJulio MerinoTest Suite:
167b2b6c6a8SAlan Somers.Bl -tag -width "allow_sysctl_side_effects"
168b2b6c6a8SAlan Somers.It allow_devfs_side_effects
169b2b6c6a8SAlan SomersIf defined, enables tests that may destroy and recreate semipermanent device
170fb77db09SEnji Coopernodes, like disk devices.
171fb77db09SEnji CooperWithout this variable, tests may still create and destroy devices nodes that
172fb77db09SEnji Cooperare normally transient, like /dev/tap* and /dev/pts*, as long as they clean
173fb77db09SEnji Cooperthem up afterwards.
174fb77db09SEnji CooperHowever, tests that require this variable have a relaxed cleanup requirement;
175fb77db09SEnji Cooperthey must recreate any devices that they destroyed, but not necessarily with
176fb77db09SEnji Cooperthe same devnames.
177b2b6c6a8SAlan Somers.It allow_sysctl_side_effects
178b2b6c6a8SAlan SomersEnables tests that change globally significant
179b2b6c6a8SAlan Somers.Xr sysctl 8
180fb77db09SEnji Coopervariables.
181fb77db09SEnji CooperThe tests will undo any changes in their cleanup phases.
182b2b6c6a8SAlan Somers.It disks
183fb77db09SEnji CooperMust be set to a space delimited list of disk device nodes.
184fb77db09SEnji CooperTests that need destructive access to disks must use these devices.
185fb77db09SEnji CooperTests are not required to preserve any data present on these disks.
186b2b6c6a8SAlan Somers.It fibs
187fb77db09SEnji CooperMust be set to a space delimited list of FIBs (routing tables).
188fb77db09SEnji CooperTests that need to modify a routing table may use any of these.
189fb77db09SEnji CooperTests will cleanup any new routes that they create.
190b2b6c6a8SAlan Somers.El
191f56169f4SRui Paulo.Ss What to do if something fails?
192f56169f4SRui PauloIf there is
193f56169f4SRui Paulo.Em any failure
194b2b6c6a8SAlan Somersduring the execution of the test suite, please consider reporting it to the
195f56169f4SRui Paulo.Fx
196f56169f4SRui Paulodevelopers so that the failure can be analyzed and fixed.
197f56169f4SRui PauloTo do so, either send a message to the appropriate mailing list or file a
198f56169f4SRui Pauloproblem report.
199f56169f4SRui PauloFor more details please refer to:
200f56169f4SRui Paulo.Bl -bullet -offset indent -compact
201f56169f4SRui Paulo.It
202f56169f4SRui Paulo.Lk http://lists.freebsd.org/ "FreeBSD Mailing Lists"
203f56169f4SRui Paulo.It
204deee077eSGavin Atkinson.Lk http://www.freebsd.org/support.html "Problem Reporting"
205f56169f4SRui Paulo.El
206f56169f4SRui Paulo.Sh FILES
207f56169f4SRui Paulo.Bl -tag -compact -width usrXlocalXetcXkyuaXkyuaXconfXX
208f56169f4SRui Paulo.It Pa /usr/local/etc/kyua/kyua.conf
209f56169f4SRui PauloSystem-wide configuration file for
210f56169f4SRui Paulo.Xr kyua 1 .
211f56169f4SRui Paulo.It Pa ~/.kyua/kyua.conf
212f56169f4SRui PauloUser-specific configuration file for
213f56169f4SRui Paulo.Xr kyua 1 ;
214f56169f4SRui Paulooverrides the system file.
215f56169f4SRui Paulo.It Pa ~/.kyua/store.db
216b2b6c6a8SAlan SomersDefault result database used by Kyua.
217f56169f4SRui Paulo.It Pa /usr/tests/
218f56169f4SRui PauloLocation of the
219f56169f4SRui Paulo.Fx
220985e53cfSJulio MerinoTest Suite.
221f56169f4SRui Paulo.It Pa /usr/tests/Kyuafile
222f56169f4SRui PauloTop-level test suite definition file.
223f56169f4SRui Paulo.El
224f56169f4SRui Paulo.Sh SEE ALSO
225e1c6a283SJulio Merino.Xr kyua 1 ,
226e1c6a283SJulio Merino.Xr build 7
227f56169f4SRui Paulo.Sh HISTORY
228985e53cfSJulio MerinoThe
229985e53cfSJulio Merino.Fx
230985e53cfSJulio MerinoTest Suite first appeared in
231985e53cfSJulio Merino.Fx 10.1 .
232f56169f4SRui Paulo.Pp
233f56169f4SRui PauloThe
234f56169f4SRui Paulo.Nm
235f56169f4SRui Paulomanual page first appeared in
236f56169f4SRui Paulo.Nx 6.0
237f56169f4SRui Pauloand was later ported to
238985e53cfSJulio Merino.Fx 10.1 .
239f56169f4SRui Paulo.Sh AUTHORS
240985e53cfSJulio Merino.An Julio Merino Aq Mt jmmv@FreeBSD.org
241