1*0a6a1f1dSLionel Sambuc.\" 2*0a6a1f1dSLionel Sambuc.\" Automated Testing Framework (atf) 3*0a6a1f1dSLionel Sambuc.\" 4*0a6a1f1dSLionel Sambuc.\" Copyright (c) 2007 The NetBSD Foundation, Inc. 5*0a6a1f1dSLionel Sambuc.\" All rights reserved. 6*0a6a1f1dSLionel Sambuc.\" 7*0a6a1f1dSLionel Sambuc.\" Redistribution and use in source and binary forms, with or without 8*0a6a1f1dSLionel Sambuc.\" modification, are permitted provided that the following conditions 9*0a6a1f1dSLionel Sambuc.\" are met: 10*0a6a1f1dSLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright 11*0a6a1f1dSLionel Sambuc.\" notice, this list of conditions and the following disclaimer. 12*0a6a1f1dSLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright 13*0a6a1f1dSLionel Sambuc.\" notice, this list of conditions and the following disclaimer in the 14*0a6a1f1dSLionel Sambuc.\" documentation and/or other materials provided with the distribution. 15*0a6a1f1dSLionel Sambuc.\" 16*0a6a1f1dSLionel Sambuc.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND 17*0a6a1f1dSLionel Sambuc.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 18*0a6a1f1dSLionel Sambuc.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19*0a6a1f1dSLionel Sambuc.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20*0a6a1f1dSLionel Sambuc.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 21*0a6a1f1dSLionel Sambuc.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22*0a6a1f1dSLionel Sambuc.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23*0a6a1f1dSLionel Sambuc.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24*0a6a1f1dSLionel Sambuc.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25*0a6a1f1dSLionel Sambuc.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26*0a6a1f1dSLionel Sambuc.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27*0a6a1f1dSLionel Sambuc.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28*0a6a1f1dSLionel Sambuc.\" 29*0a6a1f1dSLionel Sambuc.Dd November 1, 2010 30*0a6a1f1dSLionel Sambuc.Dt ATF-RUN 1 31*0a6a1f1dSLionel Sambuc.Os 32*0a6a1f1dSLionel Sambuc.Sh NAME 33*0a6a1f1dSLionel Sambuc.Nm atf-run 34*0a6a1f1dSLionel Sambuc.Nd executes a collection of test programs 35*0a6a1f1dSLionel Sambuc.Sh SYNOPSIS 36*0a6a1f1dSLionel Sambuc.Nm 37*0a6a1f1dSLionel Sambuc.Op Fl v Ar var1=value1 Op .. Fl v Ar varN=valueN 38*0a6a1f1dSLionel Sambuc.Op Ar test_program1 Op Ar .. test_programN 39*0a6a1f1dSLionel Sambuc.Nm 40*0a6a1f1dSLionel Sambuc.Fl h 41*0a6a1f1dSLionel Sambuc.Sh DESCRIPTION 42*0a6a1f1dSLionel Sambuc.Nm 43*0a6a1f1dSLionel Sambucexecutes a collection of test programs or, in other words, a complete 44*0a6a1f1dSLionel Sambuctest suite. 45*0a6a1f1dSLionel SambucThe results of each test program are collected by the tool, and are then 46*0a6a1f1dSLionel Sambucmultiplexed into a single machine-parseable report; see 47*0a6a1f1dSLionel Sambuc.Xr atf-formats 5 48*0a6a1f1dSLionel Sambucfor more details. 49*0a6a1f1dSLionel SambucThis report can later be transformed into many different and saner formats 50*0a6a1f1dSLionel Sambucusing the 51*0a6a1f1dSLionel Sambuc.Nm atf-report 52*0a6a1f1dSLionel Sambuctool. 53*0a6a1f1dSLionel Sambuc.Pp 54*0a6a1f1dSLionel SambucThe list of test programs to execute is read from an 55*0a6a1f1dSLionel Sambuc.Pa Atffile 56*0a6a1f1dSLionel Sambucpresent in the current directory. 57*0a6a1f1dSLionel SambucThis file describes the test suite stored in the directory it lives in, 58*0a6a1f1dSLionel Sambucwhich aside from the list of test programs also includes meta-data and 59*0a6a1f1dSLionel Sambucconfiguration variables. 60*0a6a1f1dSLionel Sambuc.Pp 61*0a6a1f1dSLionel Sambuc.Nm 62*0a6a1f1dSLionel Sambucis also in charge of reading the configuration files that tune the behavior 63*0a6a1f1dSLionel Sambucof each test program and passing down the necessary variables to them. 64*0a6a1f1dSLionel SambucMore details on how this is done are given in the 65*0a6a1f1dSLionel Sambuc.Sx Configuration 66*0a6a1f1dSLionel Sambucsection. 67*0a6a1f1dSLionel Sambuc.Pp 68*0a6a1f1dSLionel SambucIn the first synopsis form, 69*0a6a1f1dSLionel Sambuc.Nm 70*0a6a1f1dSLionel Sambucparses the 71*0a6a1f1dSLionel Sambuc.Pa Atffile 72*0a6a1f1dSLionel Sambucin the current directory and runs all the test programs specified in it. 73*0a6a1f1dSLionel SambucIf any test program names are given as part of the command line, those are 74*0a6a1f1dSLionel Sambucthe ones executed instead of the complete list. 75*0a6a1f1dSLionel Sambuc.Pp 76*0a6a1f1dSLionel SambucIn the second synopsis form, 77*0a6a1f1dSLionel Sambuc.Nm 78*0a6a1f1dSLionel Sambucwill print information about all supported options and their purpose. 79*0a6a1f1dSLionel Sambuc.Pp 80*0a6a1f1dSLionel SambucThe following options are available: 81*0a6a1f1dSLionel Sambuc.Bl -tag -width XvXvarXvalueXX 82*0a6a1f1dSLionel Sambuc.It Fl h 83*0a6a1f1dSLionel SambucShows a short summary of all available options and their purpose. 84*0a6a1f1dSLionel Sambuc.It Fl v Ar var=value 85*0a6a1f1dSLionel SambucSets the configuration variable 86*0a6a1f1dSLionel Sambuc.Ar var 87*0a6a1f1dSLionel Sambucto the given value 88*0a6a1f1dSLionel Sambuc.Ar value . 89*0a6a1f1dSLionel Sambuc.El 90*0a6a1f1dSLionel Sambuc.Ss Configuration 91*0a6a1f1dSLionel Sambuc.Nm 92*0a6a1f1dSLionel Sambucreads configuration data from multiple places. 93*0a6a1f1dSLionel SambucAfter all of these places have been analyzed, a list of variable-value 94*0a6a1f1dSLionel Sambucpairs are passed to the test programs to be run. 95*0a6a1f1dSLionel Sambuc.Pp 96*0a6a1f1dSLionel SambucThe following locations are scanned for configuration data, in order. 97*0a6a1f1dSLionel SambucItems down the list override values defined above them: 98*0a6a1f1dSLionel Sambuc.Bl -enum 99*0a6a1f1dSLionel Sambuc.It 100*0a6a1f1dSLionel SambucConfiguration variables defined in the 101*0a6a1f1dSLionel Sambuc.Pa Atffile . 102*0a6a1f1dSLionel Sambuc.It 103*0a6a1f1dSLionel SambucConfiguration variables defined in the system-wide configuration file 104*0a6a1f1dSLionel Sambucshared among all test suites. 105*0a6a1f1dSLionel SambucThis lives in 106*0a6a1f1dSLionel Sambuc.Pa ${ATF_CONFDIR}/common.conf . 107*0a6a1f1dSLionel Sambuc.It 108*0a6a1f1dSLionel SambucConfiguration variables defined in the system-wide test-suite-specific 109*0a6a1f1dSLionel Sambucconfiguration file. 110*0a6a1f1dSLionel SambucThis lives in 111*0a6a1f1dSLionel Sambuc.Pa ${ATF_CONFDIR}/<test-suite>.conf . 112*0a6a1f1dSLionel Sambuc.It 113*0a6a1f1dSLionel SambucConfiguration variables defined in the user-specific configuration file 114*0a6a1f1dSLionel Sambucshared among all test suites. 115*0a6a1f1dSLionel SambucThis lives in 116*0a6a1f1dSLionel Sambuc.Pa ${HOME}/.atf/common.conf . 117*0a6a1f1dSLionel Sambuc.It 118*0a6a1f1dSLionel SambucConfiguration variables defined in the user-specific test-suite-specific 119*0a6a1f1dSLionel Sambucconfiguration file. 120*0a6a1f1dSLionel SambucThis lives in 121*0a6a1f1dSLionel Sambuc.Pa ${HOME}/.atf/<test-suite>.conf . 122*0a6a1f1dSLionel Sambuc.It 123*0a6a1f1dSLionel SambucConfiguration variables provided as part of the command line through the 124*0a6a1f1dSLionel Sambuc.Fl v 125*0a6a1f1dSLionel Sambucoption. 126*0a6a1f1dSLionel Sambuc.El 127*0a6a1f1dSLionel Sambuc.Pp 128*0a6a1f1dSLionel SambucThe value of 129*0a6a1f1dSLionel Sambuc.Va ATF_CONFDIR 130*0a6a1f1dSLionel Sambucin the above list determined as detailed in 131*0a6a1f1dSLionel Sambuc.Xr atf-config 1 . 132*0a6a1f1dSLionel Sambuc.Pp 133*0a6a1f1dSLionel SambucThe following configuration variables are globally recognized: 134*0a6a1f1dSLionel Sambuc.Bl -tag -width XunprivilegedXuserXX 135*0a6a1f1dSLionel Sambuc.It Va unprivileged-user 136*0a6a1f1dSLionel SambucThe name of the system user that atf-run will drop root privileges into 137*0a6a1f1dSLionel Sambucfor test cases defining 138*0a6a1f1dSLionel Sambuc.Sq require.user=unprivileged . 139*0a6a1f1dSLionel SambucNote that this is 140*0a6a1f1dSLionel Sambuc.Em not provided for security purposes ; 141*0a6a1f1dSLionel Sambucthis feature is only for the convenience of the user. 142*0a6a1f1dSLionel Sambuc.El 143*0a6a1f1dSLionel Sambuc.Ss Hooks 144*0a6a1f1dSLionel Sambuc.Nm Ns 's 145*0a6a1f1dSLionel Sambucinternal behavior can be customized by the system administrator and the 146*0a6a1f1dSLionel Sambucuser by means of hooks. 147*0a6a1f1dSLionel SambucThese hooks are written in the shell script language for simplicity and 148*0a6a1f1dSLionel Sambucare stored in the following files, which are read in the order provided 149*0a6a1f1dSLionel Sambucbelow: 150*0a6a1f1dSLionel Sambuc.Bl -enum 151*0a6a1f1dSLionel Sambuc.It 152*0a6a1f1dSLionel Sambuc${ATF_CONFDIR}/atf-run.hooks 153*0a6a1f1dSLionel Sambuc.It 154*0a6a1f1dSLionel Sambuc${HOME}/.atf/atf-run.hooks 155*0a6a1f1dSLionel Sambuc.El 156*0a6a1f1dSLionel Sambuc.Pp 157*0a6a1f1dSLionel SambucThe following hooks are supported: 158*0a6a1f1dSLionel Sambuc.Bl -tag -width infoXstartXhookXX 159*0a6a1f1dSLionel Sambuc.It info_start_hook 160*0a6a1f1dSLionel SambucCalled before 161*0a6a1f1dSLionel Sambuc.Nm 162*0a6a1f1dSLionel Sambucexecutes any test program. 163*0a6a1f1dSLionel SambucThe purpose of this hook is to write additional 164*0a6a1f1dSLionel Sambuc.Sq info 165*0a6a1f1dSLionel Sambucstanzas to the top of the output report; these are defined by the 166*0a6a1f1dSLionel Sambuc.Sq application/X-atf-tps format 167*0a6a1f1dSLionel Sambucdescribed in 168*0a6a1f1dSLionel Sambuc.Xr atf-formats 5 . 169*0a6a1f1dSLionel SambucAlways use the 170*0a6a1f1dSLionel Sambuc.Sq atf_tps_writer_info 171*0a6a1f1dSLionel Sambucfunction to print these. 172*0a6a1f1dSLionel Sambuc.Pp 173*0a6a1f1dSLionel SambucThis takes no parameters. 174*0a6a1f1dSLionel Sambuc.It info_end_hook 175*0a6a1f1dSLionel SambucSimilar to 176*0a6a1f1dSLionel Sambuc.Sq info_start_hook 177*0a6a1f1dSLionel Sambucbut executed after all test programs have been run so that additional 178*0a6a1f1dSLionel Sambuc.Sq info 179*0a6a1f1dSLionel Sambucstanzas can be added to the bottom of the output report. 180*0a6a1f1dSLionel Sambuc.Pp 181*0a6a1f1dSLionel SambucThis takes no parameters. 182*0a6a1f1dSLionel Sambuc.El 183*0a6a1f1dSLionel Sambuc.Pp 184*0a6a1f1dSLionel SambucAll hooks are accompanied by a function named 185*0a6a1f1dSLionel Sambuc.Sq default_<hook_name> 186*0a6a1f1dSLionel Sambucthat can be executed by them to invoke the default behavior built into 187*0a6a1f1dSLionel Sambuc.Nm . 188*0a6a1f1dSLionel SambucFor example, in order to extend the default 189*0a6a1f1dSLionel Sambuc.Sq info_start_hook 190*0a6a1f1dSLionel Sambuchook, we could write the following function: 191*0a6a1f1dSLionel Sambuc.Bd -literal -offset indent 192*0a6a1f1dSLionel Sambucinfo_start_hook() 193*0a6a1f1dSLionel Sambuc{ 194*0a6a1f1dSLionel Sambuc default_info_start_hook "${@}" 195*0a6a1f1dSLionel Sambuc 196*0a6a1f1dSLionel Sambuc atf_tps_writer_info "uptime" "$(uptime)" 197*0a6a1f1dSLionel Sambuc} 198*0a6a1f1dSLionel Sambuc.Ed 199*0a6a1f1dSLionel Sambuc.Sh SEE ALSO 200*0a6a1f1dSLionel Sambuc.Xr atf-report 1 , 201*0a6a1f1dSLionel Sambuc.Xr atf-test-program 1 , 202*0a6a1f1dSLionel Sambuc.Xr atf 7 203