197bff204Sjmmv.\" 297bff204Sjmmv.\" Automated Testing Framework (atf) 397bff204Sjmmv.\" 497bff204Sjmmv.\" Copyright (c) 2007 The NetBSD Foundation, Inc. 597bff204Sjmmv.\" All rights reserved. 697bff204Sjmmv.\" 797bff204Sjmmv.\" Redistribution and use in source and binary forms, with or without 897bff204Sjmmv.\" modification, are permitted provided that the following conditions 997bff204Sjmmv.\" are met: 1097bff204Sjmmv.\" 1. Redistributions of source code must retain the above copyright 1197bff204Sjmmv.\" notice, this list of conditions and the following disclaimer. 1297bff204Sjmmv.\" 2. Redistributions in binary form must reproduce the above copyright 1397bff204Sjmmv.\" notice, this list of conditions and the following disclaimer in the 1497bff204Sjmmv.\" documentation and/or other materials provided with the distribution. 1597bff204Sjmmv.\" 1697bff204Sjmmv.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND 1797bff204Sjmmv.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 1897bff204Sjmmv.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1997bff204Sjmmv.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2097bff204Sjmmv.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 2197bff204Sjmmv.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2297bff204Sjmmv.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 2397bff204Sjmmv.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2497bff204Sjmmv.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 2597bff204Sjmmv.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 2697bff204Sjmmv.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 2797bff204Sjmmv.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2897bff204Sjmmv.\" 29*e4942545Sgson.Dd April 10, 2021 3097bff204Sjmmv.Dt ATF-RUN 1 3197bff204Sjmmv.Os 3297bff204Sjmmv.Sh NAME 3397bff204Sjmmv.Nm atf-run 34*e4942545Sgson.Nd executes a collection of tests 3597bff204Sjmmv.Sh SYNOPSIS 3697bff204Sjmmv.Nm 3797bff204Sjmmv.Op Fl v Ar var1=value1 Op .. Fl v Ar varN=valueN 38*e4942545Sgson.Op Ar test1 Op Ar .. testN 3997bff204Sjmmv.Nm 4097bff204Sjmmv.Fl h 4197bff204Sjmmv.Sh DESCRIPTION 4297bff204Sjmmv.Nm 43*e4942545Sgsonexecutes a collection of test cases, test programs, or a complete test suite. 44*e4942545SgsonThe results of each test are collected by the tool, and are then 4597bff204Sjmmvmultiplexed into a single machine-parseable report; see 4697bff204Sjmmv.Xr atf-formats 5 4797bff204Sjmmvfor more details. 4897bff204SjmmvThis report can later be transformed into many different and saner formats 4997bff204Sjmmvusing the 5097bff204Sjmmv.Nm atf-report 5197bff204Sjmmvtool. 5297bff204Sjmmv.Pp 5397bff204SjmmvThe list of test programs to execute is read from an 5497bff204Sjmmv.Pa Atffile 5597bff204Sjmmvpresent in the current directory. 5697bff204SjmmvThis file describes the test suite stored in the directory it lives in, 5797bff204Sjmmvwhich aside from the list of test programs also includes meta-data and 5897bff204Sjmmvconfiguration variables. 5997bff204Sjmmv.Pp 6097bff204Sjmmv.Nm 6197bff204Sjmmvis also in charge of reading the configuration files that tune the behavior 6297bff204Sjmmvof each test program and passing down the necessary variables to them. 6397bff204SjmmvMore details on how this is done are given in the 6497bff204Sjmmv.Sx Configuration 6597bff204Sjmmvsection. 6697bff204Sjmmv.Pp 6797bff204SjmmvIn the first synopsis form, 6897bff204Sjmmv.Nm 6997bff204Sjmmvparses the 7097bff204Sjmmv.Pa Atffile 7197bff204Sjmmvin the current directory and runs all the test programs specified in it. 72*e4942545SgsonIf any 73*e4942545Sgson.Ar test 74*e4942545Sgsonarguments are given as part of the command line, those tests are 75*e4942545Sgsonexecuted instead of the complete list. Each 76*e4942545Sgson.Ar test 77*e4942545Sgsonargument can be either the name of a test program, or a string of the form 78*e4942545Sgson.Ar test_program:test_case 79*e4942545Sgsonto execute a single test case. 8097bff204Sjmmv.Pp 8197bff204SjmmvIn the second synopsis form, 8297bff204Sjmmv.Nm 8397bff204Sjmmvwill print information about all supported options and their purpose. 8497bff204Sjmmv.Pp 8597bff204SjmmvThe following options are available: 8697bff204Sjmmv.Bl -tag -width XvXvarXvalueXX 8797bff204Sjmmv.It Fl h 8897bff204SjmmvShows a short summary of all available options and their purpose. 8997bff204Sjmmv.It Fl v Ar var=value 9097bff204SjmmvSets the configuration variable 9197bff204Sjmmv.Ar var 9297bff204Sjmmvto the given value 9397bff204Sjmmv.Ar value . 9497bff204Sjmmv.El 9597bff204Sjmmv.Ss Configuration 9697bff204Sjmmv.Nm 9797bff204Sjmmvreads configuration data from multiple places. 9897bff204SjmmvAfter all of these places have been analyzed, a list of variable-value 9997bff204Sjmmvpairs are passed to the test programs to be run. 10097bff204Sjmmv.Pp 10197bff204SjmmvThe following locations are scanned for configuration data, in order. 10297bff204SjmmvItems down the list override values defined above them: 10397bff204Sjmmv.Bl -enum 10497bff204Sjmmv.It 10597bff204SjmmvConfiguration variables defined in the 10697bff204Sjmmv.Pa Atffile . 10797bff204Sjmmv.It 10897bff204SjmmvConfiguration variables defined in the system-wide configuration file 10997bff204Sjmmvshared among all test suites. 11097bff204SjmmvThis lives in 11197bff204Sjmmv.Pa ${ATF_CONFDIR}/common.conf . 11297bff204Sjmmv.It 11397bff204SjmmvConfiguration variables defined in the system-wide test-suite-specific 11497bff204Sjmmvconfiguration file. 11597bff204SjmmvThis lives in 11697bff204Sjmmv.Pa ${ATF_CONFDIR}/<test-suite>.conf . 11797bff204Sjmmv.It 11897bff204SjmmvConfiguration variables defined in the user-specific configuration file 11997bff204Sjmmvshared among all test suites. 12097bff204SjmmvThis lives in 12197bff204Sjmmv.Pa ${HOME}/.atf/common.conf . 12297bff204Sjmmv.It 12397bff204SjmmvConfiguration variables defined in the user-specific test-suite-specific 12497bff204Sjmmvconfiguration file. 12597bff204SjmmvThis lives in 12697bff204Sjmmv.Pa ${HOME}/.atf/<test-suite>.conf . 12797bff204Sjmmv.It 12897bff204SjmmvConfiguration variables provided as part of the command line through the 12997bff204Sjmmv.Fl v 13097bff204Sjmmvoption. 13197bff204Sjmmv.El 13297bff204Sjmmv.Pp 13397bff204SjmmvThe value of 13497bff204Sjmmv.Va ATF_CONFDIR 13597bff204Sjmmvin the above list determined as detailed in 13697bff204Sjmmv.Xr atf-config 1 . 13797bff204Sjmmv.Pp 13897bff204SjmmvThe following configuration variables are globally recognized: 13997bff204Sjmmv.Bl -tag -width XunprivilegedXuserXX 14097bff204Sjmmv.It Va unprivileged-user 14197bff204SjmmvThe name of the system user that atf-run will drop root privileges into 14297bff204Sjmmvfor test cases defining 14397bff204Sjmmv.Sq require.user=unprivileged . 14497bff204SjmmvNote that this is 14597bff204Sjmmv.Em not provided for security purposes ; 14697bff204Sjmmvthis feature is only for the convenience of the user. 14797bff204Sjmmv.El 14897bff204Sjmmv.Ss Hooks 14997bff204Sjmmv.Nm Ns 's 15097bff204Sjmmvinternal behavior can be customized by the system administrator and the 15197bff204Sjmmvuser by means of hooks. 15297bff204SjmmvThese hooks are written in the shell script language for simplicity and 15397bff204Sjmmvare stored in the following files, which are read in the order provided 15497bff204Sjmmvbelow: 15597bff204Sjmmv.Bl -enum 15697bff204Sjmmv.It 15797bff204Sjmmv${ATF_CONFDIR}/atf-run.hooks 15897bff204Sjmmv.It 15997bff204Sjmmv${HOME}/.atf/atf-run.hooks 16097bff204Sjmmv.El 16197bff204Sjmmv.Pp 16297bff204SjmmvThe following hooks are supported: 16397bff204Sjmmv.Bl -tag -width infoXstartXhookXX 16497bff204Sjmmv.It info_start_hook 16597bff204SjmmvCalled before 16697bff204Sjmmv.Nm 16797bff204Sjmmvexecutes any test program. 16897bff204SjmmvThe purpose of this hook is to write additional 16997bff204Sjmmv.Sq info 17097bff204Sjmmvstanzas to the top of the output report; these are defined by the 17197bff204Sjmmv.Sq application/X-atf-tps format 17297bff204Sjmmvdescribed in 17397bff204Sjmmv.Xr atf-formats 5 . 17497bff204SjmmvAlways use the 17597bff204Sjmmv.Sq atf_tps_writer_info 17697bff204Sjmmvfunction to print these. 17797bff204Sjmmv.Pp 17897bff204SjmmvThis takes no parameters. 17997bff204Sjmmv.It info_end_hook 18097bff204SjmmvSimilar to 18197bff204Sjmmv.Sq info_start_hook 18297bff204Sjmmvbut executed after all test programs have been run so that additional 18397bff204Sjmmv.Sq info 18497bff204Sjmmvstanzas can be added to the bottom of the output report. 18597bff204Sjmmv.Pp 18697bff204SjmmvThis takes no parameters. 18797bff204Sjmmv.El 18897bff204Sjmmv.Pp 18997bff204SjmmvAll hooks are accompanied by a function named 19097bff204Sjmmv.Sq default_<hook_name> 19197bff204Sjmmvthat can be executed by them to invoke the default behavior built into 19297bff204Sjmmv.Nm . 19397bff204SjmmvFor example, in order to extend the default 19497bff204Sjmmv.Sq info_start_hook 19597bff204Sjmmvhook, we could write the following function: 19697bff204Sjmmv.Bd -literal -offset indent 19797bff204Sjmmvinfo_start_hook() 19897bff204Sjmmv{ 19997bff204Sjmmv default_info_start_hook "${@}" 20097bff204Sjmmv 20197bff204Sjmmv atf_tps_writer_info "uptime" "$(uptime)" 20297bff204Sjmmv} 20397bff204Sjmmv.Ed 20497bff204Sjmmv.Sh SEE ALSO 20597bff204Sjmmv.Xr atf-report 1 , 20697bff204Sjmmv.Xr atf-test-program 1 , 20797bff204Sjmmv.Xr atf 7 208