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*b2b6c6a8SAlan Somers.Dd March 20, 2014 30f56169f4SRui Paulo.Dt TESTS 7 31f56169f4SRui Paulo.Os 32f56169f4SRui Paulo.Sh NAME 33f56169f4SRui Paulo.Nm tests 34f56169f4SRui Paulo.Nd introduction to the FreeBSD test suite 35f56169f4SRui Paulo.Sh DESCRIPTION 36f56169f4SRui PauloThe 37f56169f4SRui Paulo.Fx 38f56169f4SRui Paulotest suite provides a collection of automated tests for two major purposes. 39*b2b6c6a8SAlan SomersOn one hand, the test suite aids 40f56169f4SRui Paulo.Em developers 41*b2b6c6a8SAlan Somersto detect bugs and regressions when they modify the source tree. On the other 42*b2b6c6a8SAlan Somershand, it allows 43f56169f4SRui Paulo.Em end users 44f56169f4SRui Paulo(and, in particular, system administrators) to verify that fresh installations 45f56169f4SRui Pauloof the 46f56169f4SRui Paulo.Fx 47*b2b6c6a8SAlan Somersoperating system behave correctly on their hardware platform and also to ensure 48*b2b6c6a8SAlan Somersthat the system does not suffer from regressions during regular operation and 49*b2b6c6a8SAlan Somersmaintenance. 50f56169f4SRui Paulo.Pp 51f56169f4SRui PauloThe 52f56169f4SRui Paulo.Fx 53*b2b6c6a8SAlan Somerstest suite is installed in the 54f56169f4SRui Paulo.Pa /usr/tests 55f56169f4SRui Paulohierarchy. 56f56169f4SRui Paulo.Pp 57*b2b6c6a8SAlan SomersThis manual page describes how to run the test suite and how to configure 58f56169f4SRui Paulosome of its optional features. 59f56169f4SRui Paulo.Ss When to run the tests? 60f56169f4SRui PauloBefore diving into the details of how to run the test suite, here are some 61*b2b6c6a8SAlan Somersscenarios in which you should run it: 62f56169f4SRui Paulo.Bl -bullet -offset indent 63f56169f4SRui Paulo.It 64f56169f4SRui PauloAfter a fresh installation of 65f56169f4SRui Paulo.Fx 66f56169f4SRui Pauloto ensure that the system works correctly on your hardware platform. 67f56169f4SRui Paulo.It 68f56169f4SRui PauloAfter an upgrade of 69f56169f4SRui Paulo.Fx 70f56169f4SRui Pauloto a different version to ensure that the new code works well on your 71f56169f4SRui Paulohardware platform and that the upgrade did not introduce regressions in your 72f56169f4SRui Pauloconfiguration. 73f56169f4SRui Paulo.It 74*b2b6c6a8SAlan SomersAfter modifying the source tree to detect any new bugs and/or regressions. 75f56169f4SRui Paulo.It 76f56169f4SRui PauloPeriodically, maybe from a 77f56169f4SRui Paulo.Xr cron 8 78f56169f4SRui Paulojob, to ensure that any changes to the system (such as the installation of 79f56169f4SRui Paulothird-party packages or manual modifications to configuration files) do not 80f56169f4SRui Paulointroduce unexpected failures. 81f56169f4SRui Paulo.El 82f56169f4SRui Paulo.Ss Running the tests 83*b2b6c6a8SAlan SomersFirst, you will need to install the 84*b2b6c6a8SAlan Somers.Sq devel/kyua 85*b2b6c6a8SAlan Somerspackage from 86*b2b6c6a8SAlan Somers.Xr ports 7 . 87*b2b6c6a8SAlan SomersThen use the following command to run the whole test suite: 88f56169f4SRui Paulo.Bd -literal -offset indent 89f56169f4SRui Paulo$ kyua test -k /usr/tests/Kyuafile 90f56169f4SRui Paulo.Ed 91f56169f4SRui Paulo.Pp 92*b2b6c6a8SAlan SomersThe above will iterate through all test programs in 93f56169f4SRui Paulo.Pa /usr/tests 94*b2b6c6a8SAlan Somersrecursively, execute them, store their results and debugging data in Kyua's 95f56169f4SRui Paulodatabase (by default in 96f56169f4SRui Paulo.Pa ~/.kyua/store.db ) , 97f56169f4SRui Pauloand print a summary of the results. 98f56169f4SRui PauloThis summary includes a brief count of all total tests run and how many of 99f56169f4SRui Paulothem failed. 100f56169f4SRui Paulo.Pp 101f56169f4SRui PauloIt is possible to restrict which tests to run by providing their names in 102f56169f4SRui Paulothe command line. 103f56169f4SRui PauloFor example, this would execute the tests for the 104f56169f4SRui Paulo.Xr cp 1 105f56169f4SRui Pauloand 106f56169f4SRui Paulo.Xr cut 1 107f56169f4SRui Pauloutilities: 108f56169f4SRui Paulo.Bd -literal -offset indent 109f56169f4SRui Paulo$ kyua test -k /usr/tests/Kyuafile bin/cp usr.bin/cut 110f56169f4SRui Paulo.Ed 111f56169f4SRui Paulo.Ss Obtaining reports of the tests execution 112*b2b6c6a8SAlan SomersAdditional information about the test results can be retrieved 113*b2b6c6a8SAlan Somersby using Kyua's various reporting commands. 114*b2b6c6a8SAlan SomersFor example, the following would print a plain-text report of the executed 115f56169f4SRui Paulotests and show which ones failed: 116f56169f4SRui Paulo.Bd -literal -offset indent 117f56169f4SRui Paulo$ kyua report 118f56169f4SRui Paulo.Ed 119f56169f4SRui Paulo.Pp 120*b2b6c6a8SAlan SomersThis example would generate an HTML report ready to be published on a 121f56169f4SRui Pauloweb server: 122f56169f4SRui Paulo.Bd -literal -offset indent 123f56169f4SRui Paulo$ kyua report-html --output ~/public_html/tests 124f56169f4SRui Paulo.Ed 125f56169f4SRui Paulo.Pp 126f56169f4SRui PauloFor further details on the command-line interface of Kyua, please refer 127f56169f4SRui Pauloto its manual page 128f56169f4SRui Paulo.Xr kyua 1 . 129*b2b6c6a8SAlan Somers.Ss Configuring the tests 130*b2b6c6a8SAlan SomersSome test cases in the 131*b2b6c6a8SAlan Somers.Fx 132*b2b6c6a8SAlan Somerstest suite require manual configuration by the administrator before they can be 133*b2b6c6a8SAlan Somersrun. Unless certain properties are defined, the tests that require them will 134*b2b6c6a8SAlan Somersbe skipped. 135*b2b6c6a8SAlan Somers.Pp 136*b2b6c6a8SAlan SomersTest suites are configured by defining their configuration 137*b2b6c6a8SAlan Somersvariables in 138*b2b6c6a8SAlan Somers.Pa /usr/local/etc/kyua/kyua.conf . 139*b2b6c6a8SAlan SomersThe format of this file is detailed in 140*b2b6c6a8SAlan Somers.Xr kyua.conf 5 . 141*b2b6c6a8SAlan Somers.Pp 142*b2b6c6a8SAlan SomersThe following configuration variables are available in the 143*b2b6c6a8SAlan Somers.Fx 144*b2b6c6a8SAlan Somerstest suite: 145*b2b6c6a8SAlan Somers.Bl -tag -width "allow_sysctl_side_effects" 146*b2b6c6a8SAlan Somers.It allow_devfs_side_effects 147*b2b6c6a8SAlan SomersIf defined, enables tests that may destroy and recreate semipermanent device 148*b2b6c6a8SAlan Somersnodes, like disk devices. Without this variable, tests may still create and 149*b2b6c6a8SAlan Somersdestroy devices nodes that are normally transient, like /dev/tap* and 150*b2b6c6a8SAlan Somers/dev/pts*, as long as they clean them up afterwards. However, tests that 151*b2b6c6a8SAlan Somersrequire this variable have a relaxed cleanup requirement; they must recreate 152*b2b6c6a8SAlan Somersany devices that they destroyed, but not necessarily with the same devnames. 153*b2b6c6a8SAlan Somers.It allow_sysctl_side_effects 154*b2b6c6a8SAlan SomersEnables tests that change globally significant 155*b2b6c6a8SAlan Somers.Xr sysctl 8 156*b2b6c6a8SAlan Somersvariables. The tests will undo any changes in their cleanup phases. 157*b2b6c6a8SAlan Somers.It disks 158*b2b6c6a8SAlan SomersMust be set to a space delimited list of disk device nodes. Tests that need 159*b2b6c6a8SAlan Somersdestructive access to disks must use these devices. Tests are not required to 160*b2b6c6a8SAlan Somerspreserve any data present on these disks. 161*b2b6c6a8SAlan Somers.It fibs 162*b2b6c6a8SAlan SomersMust be set to a space delimited list of FIBs (routing tables). Tests that 163*b2b6c6a8SAlan Somersneed to modify a routing table may use any of these. Tests will cleanup any 164*b2b6c6a8SAlan Somersnew routes that they create. 165*b2b6c6a8SAlan Somers.El 166f56169f4SRui Paulo.Ss What to do if something fails? 167f56169f4SRui PauloIf there is 168f56169f4SRui Paulo.Em any failure 169*b2b6c6a8SAlan Somersduring the execution of the test suite, please consider reporting it to the 170f56169f4SRui Paulo.Fx 171f56169f4SRui Paulodevelopers so that the failure can be analyzed and fixed. 172f56169f4SRui PauloTo do so, either send a message to the appropriate mailing list or file a 173f56169f4SRui Pauloproblem report. 174f56169f4SRui PauloFor more details please refer to: 175f56169f4SRui Paulo.Bl -bullet -offset indent -compact 176f56169f4SRui Paulo.It 177f56169f4SRui Paulo.Lk http://lists.freebsd.org/ "FreeBSD Mailing Lists" 178f56169f4SRui Paulo.It 179f56169f4SRui Paulo.Lk http://www.freebsd.org/send-pr.html "Submit a FreeBSD Problem Report" 180f56169f4SRui Paulo.El 181f56169f4SRui Paulo.Sh FILES 182f56169f4SRui Paulo.Bl -tag -compact -width usrXlocalXetcXkyuaXkyuaXconfXX 183f56169f4SRui Paulo.It Pa /usr/local/etc/kyua/kyua.conf 184f56169f4SRui PauloSystem-wide configuration file for 185f56169f4SRui Paulo.Xr kyua 1 . 186f56169f4SRui Paulo.It Pa ~/.kyua/kyua.conf 187f56169f4SRui PauloUser-specific configuration file for 188f56169f4SRui Paulo.Xr kyua 1 ; 189f56169f4SRui Paulooverrides the system file. 190f56169f4SRui Paulo.It Pa ~/.kyua/store.db 191*b2b6c6a8SAlan SomersDefault result database used by Kyua. 192f56169f4SRui Paulo.It Pa /usr/tests/ 193f56169f4SRui PauloLocation of the 194f56169f4SRui Paulo.Fx 195f56169f4SRui Paulotest suite. 196f56169f4SRui Paulo.It Pa /usr/tests/Kyuafile 197f56169f4SRui PauloTop-level test suite definition file. 198f56169f4SRui Paulo.El 199f56169f4SRui Paulo.Sh SEE ALSO 200f56169f4SRui Paulo.Xr kyua 1 . 201f56169f4SRui Paulo.Sh HISTORY 202*b2b6c6a8SAlan SomersThis test suite first appeared in 203f56169f4SRui Paulo.Fx 11.0 . 204f56169f4SRui Paulo.Pp 205f56169f4SRui PauloThe 206f56169f4SRui Paulo.Nm 207f56169f4SRui Paulomanual page first appeared in 208f56169f4SRui Paulo.Nx 6.0 209f56169f4SRui Pauloand was later ported to 210f56169f4SRui Paulo.Fx 11.0 . 211f56169f4SRui Paulo.Sh AUTHORS 212f56169f4SRui Paulo.An Julio Merino Aq Mt jmmv@google.com 213