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