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