1716fd348SMartin Matuska.\" 2716fd348SMartin Matuska.\" This file and its contents are supplied under the terms of the 3716fd348SMartin Matuska.\" Common Development and Distribution License ("CDDL"), version 1.0. 4716fd348SMartin Matuska.\" You may only use this file in accordance with the terms of version 5716fd348SMartin Matuska.\" 1.0 of the CDDL. 6716fd348SMartin Matuska.\" 7716fd348SMartin Matuska.\" A full copy of the text of the CDDL should have accompanied this 8716fd348SMartin Matuska.\" source. A copy of the CDDL is also available via the Internet at 9716fd348SMartin Matuska.\" http://www.illumos.org/license/CDDL. 10716fd348SMartin Matuska.\" 11716fd348SMartin Matuska.\" Copyright (c) 2012 by Delphix. All rights reserved. 12716fd348SMartin Matuska.\" 13716fd348SMartin Matuska.Dd May 26, 2021 14716fd348SMartin Matuska.Dt RUN 1 15716fd348SMartin Matuska.Os 16716fd348SMartin Matuska. 17716fd348SMartin Matuska.Sh NAME 18716fd348SMartin Matuska.Nm run 19716fd348SMartin Matuska.Nd find, execute, and log the results of tests 20716fd348SMartin Matuska.Sh SYNOPSIS 21716fd348SMartin Matuska.Nm 22716fd348SMartin Matuska.Op Fl dgq 23716fd348SMartin Matuska.Op Fl o Ar outputdir 24716fd348SMartin Matuska.Op Fl pP Ar script 25716fd348SMartin Matuska.Op Fl t seconds 26716fd348SMartin Matuska.Op Fl uxX Ar username 27716fd348SMartin Matuska.Ar pathname Ns No … 28716fd348SMartin Matuska.Pp 29716fd348SMartin Matuska.Nm 30716fd348SMartin Matuska.Fl w Ar runfile 31716fd348SMartin Matuska.Op Fl gq 32716fd348SMartin Matuska.Op Fl o Ar outputdir 33716fd348SMartin Matuska.Op Fl pP Ar script 34716fd348SMartin Matuska.Op Fl t seconds 35716fd348SMartin Matuska.Op Fl uxX Ar username 36716fd348SMartin Matuska.Ar pathname Ns No … 37716fd348SMartin Matuska.Pp 38716fd348SMartin Matuska.Nm 39716fd348SMartin Matuska.Fl c Ar runfile 40716fd348SMartin Matuska.Op Fl dq 41716fd348SMartin Matuska.Pp 42716fd348SMartin Matuska.Nm 43716fd348SMartin Matuska.Op Fl h 44716fd348SMartin Matuska. 45716fd348SMartin Matuska.Sh DESCRIPTION 46716fd348SMartin Matuska.Nm 47716fd348SMartin Matuskacommand has three basic modes of operation. 48716fd348SMartin MatuskaWith neither 49716fd348SMartin Matuska.Fl c 50716fd348SMartin Matuskanor 51716fd348SMartin Matuska.Fl w , 52716fd348SMartin Matuska.Nm 53716fd348SMartin Matuskaprocesses the arguments provided on 54716fd348SMartin Matuskathe command line, adding them to the list for this run. 55716fd348SMartin MatuskaIf a specified 56716fd348SMartin Matuska.Ar pathname 57716fd348SMartin Matuskais an executable file, it is added as a test. 58716fd348SMartin MatuskaIf a specified 59716fd348SMartin Matuska.Ar pathname 60716fd348SMartin Matuskais a directory, the behavior depends upon the presence of 61716fd348SMartin Matuska.Fl g . 62716fd348SMartin MatuskaIf 63716fd348SMartin Matuska.Fl g 64716fd348SMartin Matuskais specified, the directory is treated as a test group. 65716fd348SMartin MatuskaSee the section on 66716fd348SMartin Matuska.Sy Test Groups 67716fd348SMartin Matuskabelow. 68716fd348SMartin MatuskaWithout 69716fd348SMartin Matuska.Fl g , 70716fd348SMartin Matuska.Nm 71716fd348SMartin Matuskasimply descends into the directory looking for executable files. 72716fd348SMartin MatuskaThe tests are then executed, and the results are logged. 73716fd348SMartin Matuska.Pp 74716fd348SMartin MatuskaWith 75716fd348SMartin Matuska.Fl w , 76716fd348SMartin Matuska.Nm 77716fd348SMartin Matuskafinds tests in the manner described above. 78716fd348SMartin MatuskaRather than executing the tests and logging the results, the test configuration 79716fd348SMartin Matuskais stored in a 80716fd348SMartin Matuska.Ar runfile , 81716fd348SMartin Matuskawhich can be used in future invocations, or edited 82716fd348SMartin Matuskato modify which tests are executed and which options are applied. 83716fd348SMartin MatuskaOptions included on the command line with 84716fd348SMartin Matuska.Fl w 85716fd348SMartin Matuskabecome defaults in the 86716fd348SMartin Matuska.Ar runfile . 87716fd348SMartin Matuska.Pp 88716fd348SMartin MatuskaWith 89716fd348SMartin Matuska.Fl c , 90716fd348SMartin Matuska.Nm 91716fd348SMartin Matuskaparses a 92716fd348SMartin Matuska.Ar runfile , 93716fd348SMartin Matuskawhich can specify a series of tests and test groups to be executed. 94716fd348SMartin MatuskaThe tests are then executed, and the results are logged. 95716fd348SMartin Matuska. 96716fd348SMartin Matuska.Ss Test Groups 97716fd348SMartin MatuskaA test group is comprised of a set of executable files, all of which exist in 98716fd348SMartin Matuskaone directory. 99716fd348SMartin MatuskaThe options specified on the command line or in a 100716fd348SMartin Matuska.Ar runfile 101716fd348SMartin Matuskaapply to individual tests in the group. 102*bb2d13b6SMartin MatuskaThe exception is options pertaining to pre and post scripts, which act on all 103*bb2d13b6SMartin Matuskatests as a group. 104716fd348SMartin MatuskaRather than running before and after each test, 105716fd348SMartin Matuskathese scripts are run only once each at the start and end of the test group. 106716fd348SMartin Matuska.Ss Test Execution 107716fd348SMartin MatuskaThe specified tests run serially, and are typically assigned results according 108716fd348SMartin Matuskato exit values. 109716fd348SMartin MatuskaTests that exit zero and non-zero are marked 110716fd348SMartin Matuska.Sy PASS 111716fd348SMartin Matuskaand 112716fd348SMartin Matuska.Sy FAIL , 113716fd348SMartin Matuskarespectively. 114716fd348SMartin MatuskaWhen a pre script fails for a test group, only the post script is executed, 115716fd348SMartin Matuskaand the remaining tests are marked 116716fd348SMartin Matuska.Sy SKIPPED . 117716fd348SMartin MatuskaAny test that exceeds 118716fd348SMartin Matuskaits 119716fd348SMartin Matuska.Ar timeout 120716fd348SMartin Matuskais terminated, and marked 121716fd348SMartin Matuska.Sy KILLED . 122716fd348SMartin Matuska.Pp 123716fd348SMartin MatuskaBy default, tests are executed with the credentials of the 124716fd348SMartin Matuska.Nm 125716fd348SMartin Matuskascript. 126716fd348SMartin MatuskaExecuting tests with other credentials is done via 127716fd348SMartin Matuska.Xr sudo 1m , 128716fd348SMartin Matuskawhich must 129716fd348SMartin Matuskabe configured to allow execution without prompting for a password. 130716fd348SMartin MatuskaEnvironment variables from the calling shell are available to individual tests. 131716fd348SMartin MatuskaDuring test execution, the working directory is changed to 132716fd348SMartin Matuska.Ar outputdir . 133716fd348SMartin Matuska. 134716fd348SMartin Matuska.Ss Output Logging 135716fd348SMartin MatuskaBy default, 136716fd348SMartin Matuska.Nm 137716fd348SMartin Matuskawill print one line on standard output at the conclusion 138716fd348SMartin Matuskaof each test indicating the test name, result and elapsed time. 139716fd348SMartin MatuskaAdditionally, for each invocation of 140716fd348SMartin Matuska.Nm , 141716fd348SMartin Matuskaa directory is created using the ISO 8601 date format. 142716fd348SMartin MatuskaWithin this directory is a file named 143716fd348SMartin Matuska.Sy log 144716fd348SMartin Matuskacontaining all the 145716fd348SMartin Matuskatest output with timestamps, and a directory for each test. 146716fd348SMartin MatuskaWithin the test directories, there is one file each for standard output, 147716fd348SMartin Matuskastandard error and merged output. 148716fd348SMartin MatuskaThe default location for the 149716fd348SMartin Matuska.Ar outputdir 150716fd348SMartin Matuskais 151716fd348SMartin Matuska.Pa /var/tmp/test_results . 152716fd348SMartin Matuska.Ss "Runfiles" 153716fd348SMartin MatuskaThe 154716fd348SMartin Matuska.Ar runfile 155716fd348SMartin Matuskais an INI-style configuration file that describes a test run. 156716fd348SMartin MatuskaThe file has one section named 157716fd348SMartin Matuska.Sy DEFAULT , 158716fd348SMartin Matuskawhich contains configuration option 159716fd348SMartin Matuskanames and their values in 160716fd348SMartin Matuska.Sy name No = Ar value 161716fd348SMartin Matuskaformat. 162716fd348SMartin MatuskaThe values in this section apply to all the subsequent sections, 163716fd348SMartin Matuskaunless they are also specified there, in which case the default is overridden. 164716fd348SMartin MatuskaThe remaining section names are the absolute pathnames of files and directories, 165716fd348SMartin Matuskadescribing tests and test groups respectively. 166716fd348SMartin MatuskaThe legal option names are: 167716fd348SMartin Matuska.Bl -tag -width "tests = ['filename', …]" 168716fd348SMartin Matuska.It Sy outputdir No = Ar pathname 169716fd348SMartin MatuskaThe name of the directory that holds test logs. 170716fd348SMartin Matuska.It Sy pre No = Ar script 171716fd348SMartin MatuskaRun 172716fd348SMartin Matuska.Ar script 173716fd348SMartin Matuskaprior to the test or test group. 174716fd348SMartin Matuska.It Sy pre_user No = Ar username 175716fd348SMartin MatuskaExecute the pre script as 176716fd348SMartin Matuska.Ar username . 177716fd348SMartin Matuska.It Sy post No = Ar script 178716fd348SMartin MatuskaRun 179716fd348SMartin Matuska.Ar script 180716fd348SMartin Matuskaafter the test or test group. 181716fd348SMartin Matuska.It Sy post_user No = Ar username 182716fd348SMartin MatuskaExecute the post script as 183716fd348SMartin Matuska.Ar username . 184716fd348SMartin Matuska.It Sy quiet No = Sy True Ns | Ns Sy False 185716fd348SMartin MatuskaIf 186716fd348SMartin Matuska.Sy True , 187716fd348SMartin Matuskaonly the results summary is printed to standard out. 188716fd348SMartin Matuska.It Sy tests No = [ Ns Ar 'filename' , No … ] 189716fd348SMartin MatuskaSpecify a list of 190716fd348SMartin Matuska.Ar filenames 191716fd348SMartin Matuskafor this test group. 192716fd348SMartin MatuskaOnly the basename of the absolute path is required. 193716fd348SMartin MatuskaThis option is only valid for test groups, and each 194716fd348SMartin Matuska.Ar filename 195716fd348SMartin Matuskamust be single quoted. 196716fd348SMartin Matuska.It Sy timeout No = Ar n 197716fd348SMartin MatuskaA timeout value of 198716fd348SMartin Matuska.Ar n 199716fd348SMartin Matuskaseconds. 200716fd348SMartin Matuska.It Sy user No = Ar username 201716fd348SMartin MatuskaExecute the test or test group as 202716fd348SMartin Matuska.Ar username . 203716fd348SMartin Matuska.El 204716fd348SMartin Matuska. 205716fd348SMartin Matuska.Sh OPTIONS 206716fd348SMartin Matuska.Bl -tag -width "-o outputdir" 207716fd348SMartin Matuska.It Fl c Ar runfile 208716fd348SMartin MatuskaSpecify a 209716fd348SMartin Matuska.Ar runfile 210716fd348SMartin Matuskato be consumed by the run command. 211716fd348SMartin Matuska.It Fl d 212716fd348SMartin MatuskaDry run mode. 213716fd348SMartin MatuskaExecute no tests, but print a description of each test that would have been run. 214716fd348SMartin Matuska.It Fl m 215716fd348SMartin MatuskaEnable kmemleak reporting (Linux only) 216716fd348SMartin Matuska.It Fl g 217716fd348SMartin MatuskaCreate test groups from any directories found while searching for tests. 218716fd348SMartin Matuska.It Fl o Ar outputdir 219716fd348SMartin MatuskaSpecify the directory in which to write test results. 220716fd348SMartin Matuska.It Fl p Ar script 221716fd348SMartin MatuskaRun 222716fd348SMartin Matuska.Ar script 223716fd348SMartin Matuskaprior to any test or test group. 224716fd348SMartin Matuska.It Fl P Ar script 225716fd348SMartin MatuskaRun 226716fd348SMartin Matuska.Ar script 227716fd348SMartin Matuskaafter any test or test group. 228716fd348SMartin Matuska.It Fl q 229716fd348SMartin MatuskaPrint only the results summary to the standard output. 230716fd348SMartin Matuska.It Fl s Ar script 231716fd348SMartin MatuskaRun 232716fd348SMartin Matuska.Ar script 233716fd348SMartin Matuskaas a failsafe after any test is killed. 234716fd348SMartin Matuska.It Fl S Ar username 235716fd348SMartin MatuskaExecute the failsafe script as 236716fd348SMartin Matuska.Ar username . 237716fd348SMartin Matuska.It Fl t Ar n 238716fd348SMartin MatuskaSpecify a timeout value of 239716fd348SMartin Matuska.Ar n 240716fd348SMartin Matuskaseconds per test. 241716fd348SMartin Matuska.It Fl u Ar username 242716fd348SMartin MatuskaExecute tests or test groups as 243716fd348SMartin Matuska.Ar username . 244716fd348SMartin Matuska.It Fl w Ar runfile 245716fd348SMartin MatuskaSpecify the name of the 246716fd348SMartin Matuska.Ar runfile 247716fd348SMartin Matuskato create. 248716fd348SMartin Matuska.It Fl x Ar username 249716fd348SMartin MatuskaExecute the pre script as 250716fd348SMartin Matuska.Ar username . 251716fd348SMartin Matuska.It Fl X Ar username 252716fd348SMartin MatuskaExecute the post script as 253716fd348SMartin Matuska.Ar username . 254716fd348SMartin Matuska.El 255716fd348SMartin Matuska. 256716fd348SMartin Matuska.Sh EXAMPLES 257716fd348SMartin Matuska.Bl -tag -width "-h" 258716fd348SMartin Matuska.It Sy Example 1 : No Running ad-hoc tests . 259716fd348SMartin MatuskaThis example demonstrates the simplest invocation of 260716fd348SMartin Matuska.Nm . 261716fd348SMartin Matuska.Bd -literal 262716fd348SMartin Matuska.No % Nm run Ar my-tests 263716fd348SMartin MatuskaTest: /home/jkennedy/my-tests/test-01 [00:02] [PASS] 264716fd348SMartin MatuskaTest: /home/jkennedy/my-tests/test-02 [00:04] [PASS] 265716fd348SMartin MatuskaTest: /home/jkennedy/my-tests/test-03 [00:01] [PASS] 266716fd348SMartin Matuska 267716fd348SMartin MatuskaResults Summary 268716fd348SMartin MatuskaPASS 3 269716fd348SMartin Matuska 270716fd348SMartin MatuskaRunning Time: 00:00:07 271716fd348SMartin MatuskaPercent passed: 100.0% 272716fd348SMartin MatuskaLog directory: /var/tmp/test_results/20120923T180654 273716fd348SMartin Matuska.Ed 274716fd348SMartin Matuska.It Sy Example 2 : No Creating a Ar runfile No for future use . 275716fd348SMartin MatuskaThis example demonstrates creating a 276716fd348SMartin Matuska.Ar runfile 277716fd348SMartin Matuskawith non-default options. 278716fd348SMartin Matuska.Bd -literal 279716fd348SMartin Matuska.No % Nm run Fl p Ar setup Fl x Ar root Fl g Fl w Ar new-tests.run Ar new-tests 280716fd348SMartin Matuska.No % Nm cat Pa new-tests.run 281716fd348SMartin Matuska[DEFAULT] 282716fd348SMartin Matuskapre = setup 283716fd348SMartin Matuskapost_user = 284716fd348SMartin Matuskaquiet = False 285716fd348SMartin Matuskauser = 286716fd348SMartin Matuskatimeout = 60 287716fd348SMartin Matuskapost = 288716fd348SMartin Matuskapre_user = root 289716fd348SMartin Matuskaoutputdir = /var/tmp/test_results 290716fd348SMartin Matuska 291716fd348SMartin Matuska[/home/jkennedy/new-tests] 292716fd348SMartin Matuskatests = ['test-01', 'test-02', 'test-03'] 293716fd348SMartin Matuska.Ed 294716fd348SMartin Matuska.El 295716fd348SMartin Matuska. 296716fd348SMartin Matuska.Sh SEE ALSO 297716fd348SMartin Matuska.Xr sudo 1m 298