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