1*11be35a1SLionel Sambuc.\" Copyright 2012 Google Inc. 2*11be35a1SLionel Sambuc.\" All rights reserved. 3*11be35a1SLionel Sambuc.\" 4*11be35a1SLionel Sambuc.\" Redistribution and use in source and binary forms, with or without 5*11be35a1SLionel Sambuc.\" modification, are permitted provided that the following conditions are 6*11be35a1SLionel Sambuc.\" met: 7*11be35a1SLionel Sambuc.\" 8*11be35a1SLionel Sambuc.\" * Redistributions of source code must retain the above copyright 9*11be35a1SLionel Sambuc.\" notice, this list of conditions and the following disclaimer. 10*11be35a1SLionel Sambuc.\" * Redistributions in binary form must reproduce the above copyright 11*11be35a1SLionel Sambuc.\" notice, this list of conditions and the following disclaimer in the 12*11be35a1SLionel Sambuc.\" documentation and/or other materials provided with the distribution. 13*11be35a1SLionel Sambuc.\" * Neither the name of Google Inc. nor the names of its contributors 14*11be35a1SLionel Sambuc.\" may be used to endorse or promote products derived from this software 15*11be35a1SLionel Sambuc.\" without specific prior written permission. 16*11be35a1SLionel Sambuc.\" 17*11be35a1SLionel Sambuc.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18*11be35a1SLionel Sambuc.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19*11be35a1SLionel Sambuc.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20*11be35a1SLionel Sambuc.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21*11be35a1SLionel Sambuc.\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22*11be35a1SLionel Sambuc.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23*11be35a1SLionel Sambuc.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24*11be35a1SLionel Sambuc.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25*11be35a1SLionel Sambuc.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26*11be35a1SLionel Sambuc.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27*11be35a1SLionel Sambuc.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28*11be35a1SLionel Sambuc.Dd February 9, 2013 29*11be35a1SLionel Sambuc.Dt KYUAFILE 5 30*11be35a1SLionel Sambuc.Os 31*11be35a1SLionel Sambuc.Sh NAME 32*11be35a1SLionel Sambuc.Nm Kyuafile 33*11be35a1SLionel Sambuc.Nd Test suite description files 34*11be35a1SLionel Sambuc.Sh SYNOPSIS 35*11be35a1SLionel Sambuc.Fn atf_test_program "string name" "[string test_suite]" "[string metadata]" 36*11be35a1SLionel Sambuc.Fn include "string path" 37*11be35a1SLionel Sambuc.Fn plain_test_program "string name" "[string test_suite]" "[string metadata]" 38*11be35a1SLionel Sambuc.Fn syntax "int version" 39*11be35a1SLionel Sambuc.Fn test_suite "string name" 40*11be35a1SLionel Sambuc.Sh DESCRIPTION 41*11be35a1SLionel SambucA test suite is a collection of test programs and is represented by a 42*11be35a1SLionel Sambuchierarchical layout of test binaries on the file system. Any subtree of 43*11be35a1SLionel Sambucthe file system can represent a test suite, provided that it includes one 44*11be35a1SLionel Sambucor more 45*11be35a1SLionel Sambuc.Nm Ns s , 46*11be35a1SLionel Sambucwhich are the test suite definition files. 47*11be35a1SLionel Sambuc.Pp 48*11be35a1SLionel SambucA 49*11be35a1SLionel Sambuc.Nm 50*11be35a1SLionel Sambucis a Lua script whose purpose is to describe the structure of the test 51*11be35a1SLionel Sambucsuite it belongs to. To do so, the script has access to a collection of 52*11be35a1SLionel Sambucspecial functions provided by 53*11be35a1SLionel Sambuc.Xr kyua 1 . 54*11be35a1SLionel Sambuc.Pp 55*11be35a1SLionel SambucA typical 56*11be35a1SLionel Sambuc.Nm 57*11be35a1SLionel Sambucwill look similar to this: 58*11be35a1SLionel Sambuc.Bd -literal -offset indent 59*11be35a1SLionel Sambucsyntax(2) 60*11be35a1SLionel Sambuc 61*11be35a1SLionel Sambuctest_suite('first') 62*11be35a1SLionel Sambuc 63*11be35a1SLionel Sambuc-- Declare the test programs that are in this directory. 64*11be35a1SLionel Sambucatf_test_program{name='foo_test'} 65*11be35a1SLionel Sambucatf_test_program{name='bar_test', test_suite='second'} 66*11be35a1SLionel Sambucplain_test_program{name='legacy_test'} 67*11be35a1SLionel Sambucplain_test_program{name='legacy2_test', allowed_architectures='amd64 i386', 68*11be35a1SLionel Sambuc required_files='/bin/ls', timeout=30} 69*11be35a1SLionel Sambuc 70*11be35a1SLionel Sambuc-- Recurse into any subdirectories that may have other tests. 71*11be35a1SLionel Sambucinclude('dir1/Kyuafile') 72*11be35a1SLionel Sambucinclude('dir2/Kyuafile') 73*11be35a1SLionel Sambuc.Ed 74*11be35a1SLionel Sambuc.Ss File versioning 75*11be35a1SLionel SambucEvery 76*11be35a1SLionel Sambuc.Nm 77*11be35a1SLionel Sambucfile starts with a call to 78*11be35a1SLionel Sambuc.Fn syntax "int version" . 79*11be35a1SLionel SambucThis call determines the specific schema used by the file so that future 80*11be35a1SLionel Sambucbackwards-incompatible modifications to the file can be introduced. 81*11be35a1SLionel Sambuc.Pp 82*11be35a1SLionel SambucAny new 83*11be35a1SLionel Sambuc.Nm 84*11be35a1SLionel Sambucfile should set 85*11be35a1SLionel Sambuc.Fa version 86*11be35a1SLionel Sambucto 87*11be35a1SLionel Sambuc.Sq 2 . 88*11be35a1SLionel Sambuc.Ss Test suite definition 89*11be35a1SLionel SambucEvery 90*11be35a1SLionel Sambuc.Nm 91*11be35a1SLionel Sambucshould define the name of the test suite it belongs to by calling the 92*11be35a1SLionel Sambuc.Fn test_suite 93*11be35a1SLionel Sambucfunction at the very beginning. 94*11be35a1SLionel SambucIndividual test programs can override this value in their definition, but 95*11be35a1SLionel Sambucthe most common style is to list a single test suite name for the whole 96*11be35a1SLionel Sambucfile. 97*11be35a1SLionel Sambuc.Pp 98*11be35a1SLionel SambucThe purpose of the test suite name definition is to tell 99*11be35a1SLionel Sambuc.Xr kyua 1 100*11be35a1SLionel Sambucscoping for the run-time configuration variables that these programs 101*11be35a1SLionel Sambucaccept. 102*11be35a1SLionel Sambuc.Ss Test program registration 103*11be35a1SLionel SambucA 104*11be35a1SLionel Sambuc.Nm 105*11be35a1SLionel Sambuccan register test programs by means of a variety of 106*11be35a1SLionel Sambuc.Fn *_test_program 107*11be35a1SLionel Sambucfunctions, all of which take the name of a test program and a set of 108*11be35a1SLionel Sambucoptional metadata properties that describe such test program. 109*11be35a1SLionel Sambuc.Pp 110*11be35a1SLionel SambucThe test programs to be registered must live in the current directory; in 111*11be35a1SLionel Sambucother words, the various 112*11be35a1SLionel Sambuc.Fn *_test_program 113*11be35a1SLionel Sambuccalls cannot reference test programs in other directories. 114*11be35a1SLionel SambucThe rationale for this is to force all 115*11be35a1SLionel Sambuc.Nm 116*11be35a1SLionel Sambucfiles to be self-contained, and to simplify their internal representation. 117*11be35a1SLionel Sambuc.Pp 118*11be35a1SLionel SambucATF-based test programs (those that implement the 119*11be35a1SLionel Sambuc.Xr kyua-atf-interface 7 120*11be35a1SLionel Sambucinterface) can be registered with the 121*11be35a1SLionel Sambuc.Fn atf_test_program 122*11be35a1SLionel Sambuctable constructor. This function takes the 123*11be35a1SLionel Sambuc.Fa name 124*11be35a1SLionel Sambucof the test program, an optional 125*11be35a1SLionel Sambuc.Fa test_suite 126*11be35a1SLionel Sambucname that overrides the global test suite name and a collection of optional 127*11be35a1SLionel Sambucmetadata settings for all the test cases in the test program. Any metadata 128*11be35a1SLionel Sambucproperties defined by the test cases themselves override the metadata values 129*11be35a1SLionel Sambucdefined here. 130*11be35a1SLionel Sambuc.Pp 131*11be35a1SLionel SambucPlain test programs (those that implement the 132*11be35a1SLionel Sambuc.Xr kyua-plain-interface 7 133*11be35a1SLionel Sambucinterface) can be registered with the 134*11be35a1SLionel Sambuc.Fn plain_test_program 135*11be35a1SLionel Sambuctable constructor. This function takes the 136*11be35a1SLionel Sambuc.Fa name 137*11be35a1SLionel Sambucof the test program an optional 138*11be35a1SLionel Sambuc.Fa test_suite 139*11be35a1SLionel Sambucname that overrides the global test suite name and a collection of optional 140*11be35a1SLionel Sambucmetadata settings for the test program. 141*11be35a1SLionel Sambuc.Pp 142*11be35a1SLionel SambucPlease see 143*11be35a1SLionel Sambuc.Xr kyua-tester-list 5 144*11be35a1SLionel Sambucfor the list of metadata properties that can be given to test programs. 145*11be35a1SLionel SambucAll the properties that can be given to a test case can also be given to a test 146*11be35a1SLionel Sambucprogram. 147*11be35a1SLionel Sambuc.Ss Recursion 148*11be35a1SLionel SambucTo reference test programs in another subdirectory, a different 149*11be35a1SLionel Sambuc.Nm 150*11be35a1SLionel Sambucmust be created in that directory and it must be included into the original 151*11be35a1SLionel Sambuc.Nm 152*11be35a1SLionel Sambucby means of the 153*11be35a1SLionel Sambuc.Fn include 154*11be35a1SLionel Sambucfunction. 155*11be35a1SLionel Sambuc.Pp 156*11be35a1SLionel SambucNote that each file is processed in its own Lua environment: there is no 157*11be35a1SLionel Sambucmechanism to pass state from one file to the other. The reason for this is 158*11be35a1SLionel Sambucthat there is no such thing as a 159*11be35a1SLionel Sambuc.Dq top-level 160*11be35a1SLionel Sambuc.Nm 161*11be35a1SLionel Sambucin a test suite: the user has to be able to run the test suite from any 162*11be35a1SLionel Sambucdirectory in a given hierarchy, and this execution must not depend on files 163*11be35a1SLionel Sambucthat live in parent directories. 164*11be35a1SLionel Sambuc.Ss Top-level Kyuafile 165*11be35a1SLionel SambucEvery system has a top directory into which test suites get installed. The 166*11be35a1SLionel Sambucdefault is 167*11be35a1SLionel Sambuc.Pa __TESTSDIR__ . 168*11be35a1SLionel SambucWithin this directory live test suites, each of which is in an independent 169*11be35a1SLionel Sambucsubdirectory. Each subdirectory can be provided separately by independent 170*11be35a1SLionel Sambucthird-party packages. 171*11be35a1SLionel Sambuc.Pp 172*11be35a1SLionel SambucKyua allows running all the installed test suites at once in order to 173*11be35a1SLionel Sambucprovide comprehensive cross-component reports. In order to do this, there 174*11be35a1SLionel Sambucis a special file in the top directory that knows how to inspect the 175*11be35a1SLionel Sambucsubdirectories in search for other Kyuafiles and include them. 176*11be35a1SLionel Sambuc.Pp 177*11be35a1SLionel SambucThe 178*11be35a1SLionel Sambuc.Sx FILES 179*11be35a1SLionel Sambucsection includes more details on where this file lives. 180*11be35a1SLionel Sambuc.Sh FILES 181*11be35a1SLionel Sambuc.Bl -tag -width XX 182*11be35a1SLionel Sambuc.It Pa __TESTSDIR__/Kyuafile . 183*11be35a1SLionel SambucTop-level 184*11be35a1SLionel Sambuc.Nm 185*11be35a1SLionel Sambucfor the current system. 186*11be35a1SLionel Sambuc.It Pa __EGDIR__/Kyuafile.top . 187*11be35a1SLionel SambucSample file to serve as a top-level 188*11be35a1SLionel Sambuc.Nm . 189*11be35a1SLionel Sambuc.El 190*11be35a1SLionel Sambuc.Sh SEE ALSO 191*11be35a1SLionel Sambuc.Xr kyua 1 192