xref: /netbsd-src/share/man/man7/tests.atf.7 (revision 6d322f2f4598f0d8a138f10ea648ec4fabe41f8b)
1.\"	$NetBSD: tests.atf.7,v 1.2 2013/07/20 21:39:59 wiz Exp $
2.\"
3.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
16.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
17.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
20.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27.\"
28.Dd August 5, 2011
29.Dt TESTS 7
30.Os
31.Sh NAME
32.Nm tests
33.Nd introduction to the NetBSD test suite
34.Sh DESCRIPTION
35The
36.Nx
37test suite provides a collection of automated tests for two major purposes.
38On the one hand, the test suite aids
39.Em developers
40in catching bugs and regressions in the code when they performing modifications
41to the source tree.
42On the other hand, the test suite allows
43.Em end users
44(and, in particular, system administrators) to verify that fresh installations
45of the
46.Nx
47operating system behave correctly in their hardware platform and also to ensure
48that the system does not suffer from regressions during regular system
49operation and maintenance.
50.Pp
51The
52.Nx
53tests are implemented using the
54.Em Automated Testing Framework (ATF) ,
55a third-party package shipped with
56.Nx ;
57see
58.Xr atf 7
59for details.
60The
61.Nx
62test suite is distributed as a separate installation set, named
63.Pa tests.tgz ,
64and the test programs are all installed under the
65.Pa /usr/tests
66hierarchy.
67.Pp
68This manual page describes how to execute the test suite and how to configure
69some of its optional features.
70.Ss When to run the tests?
71Before diving into the details of how to run the test suite, here are some
72scenarios in which you should be running them:
73.Bl -bullet -offset indent
74.It
75After a fresh installation of
76.Nx
77to ensure that the system works correctly on your hardware platform.
78.It
79After an upgrade of
80.Nx
81to a different version to ensure that the new code works well on your
82hardware platform and that the upgrade did not introduce regressions in your
83configuration.
84.It
85After performing changes to the source tree to catch any bugs and/or regressions
86introduced by the modifications.
87.It
88Periodically, maybe from a
89.Xr cron 8
90job, to ensure that any changes to the system (such as the installation of
91third-party packages or manual modifications to configuration files) do not
92introduce unexpected failures.
93.El
94.Ss Installing the tests
95If you chose to install the
96.Pa tests.tgz
97distribution set while setting up your
98.Nx
99system, the tests are already available in
100.Pa /usr/tests .
101Otherwise, install the set now by running:
102.Bd -literal -offset indent
103# cd /
104# tar xzpf /path/to/tests.tgz
105.Ed
106.Ss Running the tests
107Use the following commands to run the whole test suite:
108.Bd -literal -offset indent
109$ cd /usr/tests
110$ atf-run | atf-report
111.Ed
112.Pp
113The above will go through all test programs in
114.Pa /usr/tests
115recursively, execute them, and, at the very end, show a report of
116the results of the test suite.
117These results include the count of tests that succeeded (passed), the names of
118the tests that failed, and the count of the tests that were not executed
119(skipped) because the system configuration did not meet their requirements.
120.Pp
121If you are interested in saving the whole output of the test suite execution so
122that you can later investigate failures, use the following idiom instead:
123.Bd -literal -offset indent
124$ cd /usr/tests
125$ atf-run | tee ~/tests.log | atf-report
126.Ed
127.Pp
128The above command will save the raw output of the test suite in
129.Pa ~/tests.log ,
130which you can later inspect manually to look for failures.
131Note that the file contains a copy of the
132.Sq stdout
133and
134.Sq stderr
135of each test case, which becomes valuable during debugging.
136.Pp
137It is also possible to restrict which tests to execute so that only a small
138subsystem is tested; see
139.Xr atf-run 1
140for details.
141Additionally, it is also possible to run the test programs themselves by hand;
142see
143.Xr atf-test-program 1
144for more details, but be aware that you should only be doing this if you are
145debugging failing tests.
146.Ss Configuring the tests
147Some test cases in the
148.Nx
149test suite require the administrator to manually set up some configuration
150properties before they can run.
151Unless these properties are defined, the tests that require them will be marked
152as skipped and thus they will not be really executed.
153.Pp
154Each test suite is configured through a separate file that lives under
155.Pa /etc/atf/
156and that carries the name of the test suite.
157Henceforth, to configure the properties that affect the execution of the
158.Nx
159test suite, you need to edit
160.Pa /etc/atf/NetBSD.conf .
161The suite-specific configuration file implicitly depends on
162.Pa /etc/atf/common.conf ,
163which contains properties shared among all test suites.
164These files conform to the configuration file format described in
165.Xr atf-formats 5 .
166.Pp
167The following configuration variables are available in the
168.Nx
169test suite:
170.Bl -tag -width "unprivileged-user"
171.It fstype
172When set to a filesystem type, restrict tests programs from the
173.Pa /usr/tests/fs/vfs/
174tree to only run test cases for the given type.
175.It unprivileged-user
176This variable allows setting an unprivileged user login name to be used by
177tests.
178Defaults to
179.Sq _tests .
180.El
181.Ss What to do if something fails?
182If there is
183.Em any failure
184during the execution of the test suite, please considering reporting it to the
185.Nx
186developers so that the failure can be analyzed and fixed.
187To do so, either send a message to the appropriate mailing list or file a
188problem report.
189For more details please refer to:
190.Bl -bullet -offset indent -compact
191.It
192.Lk http://www.netbsd.org/mailinglists/ "NetBSD mailing lists"
193.It
194.Lk http://www.netbsd.org/support/send-pr.html "NetBSD Problem Reports"
195.El
196.Sh FILES
197.Bl -tag -compact -width etcXatfXNetBSDXconfXX
198.It Pa /etc/atf/NetBSD.conf
199Configuration file for the
200.Nx
201test suite.
202.It Pa /etc/atf/common.conf
203Configuration file for all test suites.
204.It Pa /usr/tests/
205Location of the test suites.
206.El
207.Sh SEE ALSO
208.Xr atf 7
209.Sh HISTORY
210The
211.Nm
212manual page first appeared in
213.Nx 6.0 .
214.Pp
215The ATF testing framework was first distributed with
216.Nx 5.0
217and the collection of test programs in
218.Pa /usr/tests
219has been growing since then.
220.Sh AUTHORS
221.An Julio Merino Aq Mt jmmv@NetBSD.org
222