1*716fd348SMartin Matuska.\" 2*716fd348SMartin Matuska.\" This file and its contents are supplied under the terms of the 3*716fd348SMartin Matuska.\" Common Development and Distribution License ("CDDL"), version 1.0. 4*716fd348SMartin Matuska.\" You may only use this file in accordance with the terms of version 5*716fd348SMartin Matuska.\" 1.0 of the CDDL. 6*716fd348SMartin Matuska.\" 7*716fd348SMartin Matuska.\" A full copy of the text of the CDDL should have accompanied this 8*716fd348SMartin Matuska.\" source. A copy of the CDDL is also available via the Internet at 9*716fd348SMartin Matuska.\" http://www.illumos.org/license/CDDL. 10*716fd348SMartin Matuska.\" 11*716fd348SMartin Matuska.\" Copyright (c) 2012 by Delphix. All rights reserved. 12*716fd348SMartin Matuska.\" 13*716fd348SMartin Matuska.Dd May 26, 2021 14*716fd348SMartin Matuska.Dt RUN 1 15*716fd348SMartin Matuska.Os 16*716fd348SMartin Matuska. 17*716fd348SMartin Matuska.Sh NAME 18*716fd348SMartin Matuska.Nm run 19*716fd348SMartin Matuska.Nd find, execute, and log the results of tests 20*716fd348SMartin Matuska.Sh SYNOPSIS 21*716fd348SMartin Matuska.Nm 22*716fd348SMartin Matuska.Op Fl dgq 23*716fd348SMartin Matuska.Op Fl o Ar outputdir 24*716fd348SMartin Matuska.Op Fl pP Ar script 25*716fd348SMartin Matuska.Op Fl t seconds 26*716fd348SMartin Matuska.Op Fl uxX Ar username 27*716fd348SMartin Matuska.Ar pathname Ns No … 28*716fd348SMartin Matuska.Pp 29*716fd348SMartin Matuska.Nm 30*716fd348SMartin Matuska.Fl w Ar runfile 31*716fd348SMartin Matuska.Op Fl gq 32*716fd348SMartin Matuska.Op Fl o Ar outputdir 33*716fd348SMartin Matuska.Op Fl pP Ar script 34*716fd348SMartin Matuska.Op Fl t seconds 35*716fd348SMartin Matuska.Op Fl uxX Ar username 36*716fd348SMartin Matuska.Ar pathname Ns No … 37*716fd348SMartin Matuska.Pp 38*716fd348SMartin Matuska.Nm 39*716fd348SMartin Matuska.Fl c Ar runfile 40*716fd348SMartin Matuska.Op Fl dq 41*716fd348SMartin Matuska.Pp 42*716fd348SMartin Matuska.Nm 43*716fd348SMartin Matuska.Op Fl h 44*716fd348SMartin Matuska. 45*716fd348SMartin Matuska.Sh DESCRIPTION 46*716fd348SMartin Matuska.Nm 47*716fd348SMartin Matuskacommand has three basic modes of operation. 48*716fd348SMartin MatuskaWith neither 49*716fd348SMartin Matuska.Fl c 50*716fd348SMartin Matuskanor 51*716fd348SMartin Matuska.Fl w , 52*716fd348SMartin Matuska.Nm 53*716fd348SMartin Matuskaprocesses the arguments provided on 54*716fd348SMartin Matuskathe command line, adding them to the list for this run. 55*716fd348SMartin MatuskaIf a specified 56*716fd348SMartin Matuska.Ar pathname 57*716fd348SMartin Matuskais an executable file, it is added as a test. 58*716fd348SMartin MatuskaIf a specified 59*716fd348SMartin Matuska.Ar pathname 60*716fd348SMartin Matuskais a directory, the behavior depends upon the presence of 61*716fd348SMartin Matuska.Fl g . 62*716fd348SMartin MatuskaIf 63*716fd348SMartin Matuska.Fl g 64*716fd348SMartin Matuskais specified, the directory is treated as a test group. 65*716fd348SMartin MatuskaSee the section on 66*716fd348SMartin Matuska.Sy Test Groups 67*716fd348SMartin Matuskabelow. 68*716fd348SMartin MatuskaWithout 69*716fd348SMartin Matuska.Fl g , 70*716fd348SMartin Matuska.Nm 71*716fd348SMartin Matuskasimply descends into the directory looking for executable files. 72*716fd348SMartin MatuskaThe tests are then executed, and the results are logged. 73*716fd348SMartin Matuska.Pp 74*716fd348SMartin MatuskaWith 75*716fd348SMartin Matuska.Fl w , 76*716fd348SMartin Matuska.Nm 77*716fd348SMartin Matuskafinds tests in the manner described above. 78*716fd348SMartin MatuskaRather than executing the tests and logging the results, the test configuration 79*716fd348SMartin Matuskais stored in a 80*716fd348SMartin Matuska.Ar runfile , 81*716fd348SMartin Matuskawhich can be used in future invocations, or edited 82*716fd348SMartin Matuskato modify which tests are executed and which options are applied. 83*716fd348SMartin MatuskaOptions included on the command line with 84*716fd348SMartin Matuska.Fl w 85*716fd348SMartin Matuskabecome defaults in the 86*716fd348SMartin Matuska.Ar runfile . 87*716fd348SMartin Matuska.Pp 88*716fd348SMartin MatuskaWith 89*716fd348SMartin Matuska.Fl c , 90*716fd348SMartin Matuska.Nm 91*716fd348SMartin Matuskaparses a 92*716fd348SMartin Matuska.Ar runfile , 93*716fd348SMartin Matuskawhich can specify a series of tests and test groups to be executed. 94*716fd348SMartin MatuskaThe tests are then executed, and the results are logged. 95*716fd348SMartin Matuska. 96*716fd348SMartin Matuska.Ss Test Groups 97*716fd348SMartin MatuskaA test group is comprised of a set of executable files, all of which exist in 98*716fd348SMartin Matuskaone directory. 99*716fd348SMartin MatuskaThe options specified on the command line or in a 100*716fd348SMartin Matuska.Ar runfile 101*716fd348SMartin Matuskaapply to individual tests in the group. 102*716fd348SMartin MatuskaThe exception is options pertaining to pre and post scripts, which act on all tests as a group. 103*716fd348SMartin MatuskaRather than running before and after each test, 104*716fd348SMartin Matuskathese scripts are run only once each at the start and end of the test group. 105*716fd348SMartin Matuska.Ss Test Execution 106*716fd348SMartin MatuskaThe specified tests run serially, and are typically assigned results according 107*716fd348SMartin Matuskato exit values. 108*716fd348SMartin MatuskaTests that exit zero and non-zero are marked 109*716fd348SMartin Matuska.Sy PASS 110*716fd348SMartin Matuskaand 111*716fd348SMartin Matuska.Sy FAIL , 112*716fd348SMartin Matuskarespectively. 113*716fd348SMartin MatuskaWhen a pre script fails for a test group, only the post script is executed, 114*716fd348SMartin Matuskaand the remaining tests are marked 115*716fd348SMartin Matuska.Sy SKIPPED . 116*716fd348SMartin MatuskaAny test that exceeds 117*716fd348SMartin Matuskaits 118*716fd348SMartin Matuska.Ar timeout 119*716fd348SMartin Matuskais terminated, and marked 120*716fd348SMartin Matuska.Sy KILLED . 121*716fd348SMartin Matuska.Pp 122*716fd348SMartin MatuskaBy default, tests are executed with the credentials of the 123*716fd348SMartin Matuska.Nm 124*716fd348SMartin Matuskascript. 125*716fd348SMartin MatuskaExecuting tests with other credentials is done via 126*716fd348SMartin Matuska.Xr sudo 1m , 127*716fd348SMartin Matuskawhich must 128*716fd348SMartin Matuskabe configured to allow execution without prompting for a password. 129*716fd348SMartin MatuskaEnvironment variables from the calling shell are available to individual tests. 130*716fd348SMartin MatuskaDuring test execution, the working directory is changed to 131*716fd348SMartin Matuska.Ar outputdir . 132*716fd348SMartin Matuska. 133*716fd348SMartin Matuska.Ss Output Logging 134*716fd348SMartin MatuskaBy default, 135*716fd348SMartin Matuska.Nm 136*716fd348SMartin Matuskawill print one line on standard output at the conclusion 137*716fd348SMartin Matuskaof each test indicating the test name, result and elapsed time. 138*716fd348SMartin MatuskaAdditionally, for each invocation of 139*716fd348SMartin Matuska.Nm , 140*716fd348SMartin Matuskaa directory is created using the ISO 8601 date format. 141*716fd348SMartin MatuskaWithin this directory is a file named 142*716fd348SMartin Matuska.Sy log 143*716fd348SMartin Matuskacontaining all the 144*716fd348SMartin Matuskatest output with timestamps, and a directory for each test. 145*716fd348SMartin MatuskaWithin the test directories, there is one file each for standard output, 146*716fd348SMartin Matuskastandard error and merged output. 147*716fd348SMartin MatuskaThe default location for the 148*716fd348SMartin Matuska.Ar outputdir 149*716fd348SMartin Matuskais 150*716fd348SMartin Matuska.Pa /var/tmp/test_results . 151*716fd348SMartin Matuska.Ss "Runfiles" 152*716fd348SMartin MatuskaThe 153*716fd348SMartin Matuska.Ar runfile 154*716fd348SMartin Matuskais an INI-style configuration file that describes a test run. 155*716fd348SMartin MatuskaThe file has one section named 156*716fd348SMartin Matuska.Sy DEFAULT , 157*716fd348SMartin Matuskawhich contains configuration option 158*716fd348SMartin Matuskanames and their values in 159*716fd348SMartin Matuska.Sy name No = Ar value 160*716fd348SMartin Matuskaformat. 161*716fd348SMartin MatuskaThe values in this section apply to all the subsequent sections, 162*716fd348SMartin Matuskaunless they are also specified there, in which case the default is overridden. 163*716fd348SMartin MatuskaThe remaining section names are the absolute pathnames of files and directories, 164*716fd348SMartin Matuskadescribing tests and test groups respectively. 165*716fd348SMartin MatuskaThe legal option names are: 166*716fd348SMartin Matuska.Bl -tag -width "tests = ['filename', …]" 167*716fd348SMartin Matuska.It Sy outputdir No = Ar pathname 168*716fd348SMartin MatuskaThe name of the directory that holds test logs. 169*716fd348SMartin Matuska.It Sy pre No = Ar script 170*716fd348SMartin MatuskaRun 171*716fd348SMartin Matuska.Ar script 172*716fd348SMartin Matuskaprior to the test or test group. 173*716fd348SMartin Matuska.It Sy pre_user No = Ar username 174*716fd348SMartin MatuskaExecute the pre script as 175*716fd348SMartin Matuska.Ar username . 176*716fd348SMartin Matuska.It Sy post No = Ar script 177*716fd348SMartin MatuskaRun 178*716fd348SMartin Matuska.Ar script 179*716fd348SMartin Matuskaafter the test or test group. 180*716fd348SMartin Matuska.It Sy post_user No = Ar username 181*716fd348SMartin MatuskaExecute the post script as 182*716fd348SMartin Matuska.Ar username . 183*716fd348SMartin Matuska.It Sy quiet No = Sy True Ns | Ns Sy False 184*716fd348SMartin MatuskaIf 185*716fd348SMartin Matuska.Sy True , 186*716fd348SMartin Matuskaonly the results summary is printed to standard out. 187*716fd348SMartin Matuska.It Sy tests No = [ Ns Ar 'filename' , No … ] 188*716fd348SMartin MatuskaSpecify a list of 189*716fd348SMartin Matuska.Ar filenames 190*716fd348SMartin Matuskafor this test group. 191*716fd348SMartin MatuskaOnly the basename of the absolute path is required. 192*716fd348SMartin MatuskaThis option is only valid for test groups, and each 193*716fd348SMartin Matuska.Ar filename 194*716fd348SMartin Matuskamust be single quoted. 195*716fd348SMartin Matuska.It Sy timeout No = Ar n 196*716fd348SMartin MatuskaA timeout value of 197*716fd348SMartin Matuska.Ar n 198*716fd348SMartin Matuskaseconds. 199*716fd348SMartin Matuska.It Sy user No = Ar username 200*716fd348SMartin MatuskaExecute the test or test group as 201*716fd348SMartin Matuska.Ar username . 202*716fd348SMartin Matuska.El 203*716fd348SMartin Matuska. 204*716fd348SMartin Matuska.Sh OPTIONS 205*716fd348SMartin Matuska.Bl -tag -width "-o outputdir" 206*716fd348SMartin Matuska.It Fl c Ar runfile 207*716fd348SMartin MatuskaSpecify a 208*716fd348SMartin Matuska.Ar runfile 209*716fd348SMartin Matuskato be consumed by the run command. 210*716fd348SMartin Matuska.It Fl d 211*716fd348SMartin MatuskaDry run mode. 212*716fd348SMartin MatuskaExecute no tests, but print a description of each test that would have been run. 213*716fd348SMartin Matuska.It Fl m 214*716fd348SMartin MatuskaEnable kmemleak reporting (Linux only) 215*716fd348SMartin Matuska.It Fl g 216*716fd348SMartin MatuskaCreate test groups from any directories found while searching for tests. 217*716fd348SMartin Matuska.It Fl o Ar outputdir 218*716fd348SMartin MatuskaSpecify the directory in which to write test results. 219*716fd348SMartin Matuska.It Fl p Ar script 220*716fd348SMartin MatuskaRun 221*716fd348SMartin Matuska.Ar script 222*716fd348SMartin Matuskaprior to any test or test group. 223*716fd348SMartin Matuska.It Fl P Ar script 224*716fd348SMartin MatuskaRun 225*716fd348SMartin Matuska.Ar script 226*716fd348SMartin Matuskaafter any test or test group. 227*716fd348SMartin Matuska.It Fl q 228*716fd348SMartin MatuskaPrint only the results summary to the standard output. 229*716fd348SMartin Matuska.It Fl s Ar script 230*716fd348SMartin MatuskaRun 231*716fd348SMartin Matuska.Ar script 232*716fd348SMartin Matuskaas a failsafe after any test is killed. 233*716fd348SMartin Matuska.It Fl S Ar username 234*716fd348SMartin MatuskaExecute the failsafe script as 235*716fd348SMartin Matuska.Ar username . 236*716fd348SMartin Matuska.It Fl t Ar n 237*716fd348SMartin MatuskaSpecify a timeout value of 238*716fd348SMartin Matuska.Ar n 239*716fd348SMartin Matuskaseconds per test. 240*716fd348SMartin Matuska.It Fl u Ar username 241*716fd348SMartin MatuskaExecute tests or test groups as 242*716fd348SMartin Matuska.Ar username . 243*716fd348SMartin Matuska.It Fl w Ar runfile 244*716fd348SMartin MatuskaSpecify the name of the 245*716fd348SMartin Matuska.Ar runfile 246*716fd348SMartin Matuskato create. 247*716fd348SMartin Matuska.It Fl x Ar username 248*716fd348SMartin MatuskaExecute the pre script as 249*716fd348SMartin Matuska.Ar username . 250*716fd348SMartin Matuska.It Fl X Ar username 251*716fd348SMartin MatuskaExecute the post script as 252*716fd348SMartin Matuska.Ar username . 253*716fd348SMartin Matuska.El 254*716fd348SMartin Matuska. 255*716fd348SMartin Matuska.Sh EXAMPLES 256*716fd348SMartin Matuska.Bl -tag -width "-h" 257*716fd348SMartin Matuska.It Sy Example 1 : No Running ad-hoc tests. 258*716fd348SMartin MatuskaThis example demonstrates the simplest invocation of 259*716fd348SMartin Matuska.Nm . 260*716fd348SMartin Matuska.Bd -literal 261*716fd348SMartin Matuska.No % Nm run Ar my-tests 262*716fd348SMartin MatuskaTest: /home/jkennedy/my-tests/test-01 [00:02] [PASS] 263*716fd348SMartin MatuskaTest: /home/jkennedy/my-tests/test-02 [00:04] [PASS] 264*716fd348SMartin MatuskaTest: /home/jkennedy/my-tests/test-03 [00:01] [PASS] 265*716fd348SMartin Matuska 266*716fd348SMartin MatuskaResults Summary 267*716fd348SMartin MatuskaPASS 3 268*716fd348SMartin Matuska 269*716fd348SMartin MatuskaRunning Time: 00:00:07 270*716fd348SMartin MatuskaPercent passed: 100.0% 271*716fd348SMartin MatuskaLog directory: /var/tmp/test_results/20120923T180654 272*716fd348SMartin Matuska.Ed 273*716fd348SMartin Matuska.It Sy Example 2 : No Creating a Ar runfile No for future use. 274*716fd348SMartin MatuskaThis example demonstrates creating a 275*716fd348SMartin Matuska.Ar runfile 276*716fd348SMartin Matuskawith non-default options. 277*716fd348SMartin Matuska.Bd -literal 278*716fd348SMartin Matuska.No % Nm run Fl p Ar setup Fl x Ar root Fl g Fl w Ar new-tests.run Ar new-tests 279*716fd348SMartin Matuska.No % Nm cat Pa new-tests.run 280*716fd348SMartin Matuska[DEFAULT] 281*716fd348SMartin Matuskapre = setup 282*716fd348SMartin Matuskapost_user = 283*716fd348SMartin Matuskaquiet = False 284*716fd348SMartin Matuskauser = 285*716fd348SMartin Matuskatimeout = 60 286*716fd348SMartin Matuskapost = 287*716fd348SMartin Matuskapre_user = root 288*716fd348SMartin Matuskaoutputdir = /var/tmp/test_results 289*716fd348SMartin Matuska 290*716fd348SMartin Matuska[/home/jkennedy/new-tests] 291*716fd348SMartin Matuskatests = ['test-01', 'test-02', 'test-03'] 292*716fd348SMartin Matuska.Ed 293*716fd348SMartin Matuska.El 294*716fd348SMartin Matuska. 295*716fd348SMartin Matuska.Sh SEE ALSO 296*716fd348SMartin Matuska.Xr sudo 1m 297