2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright (c) 2012 by Delphix. All rights reserved.
14 .TH run 1 "23 Sep 2012"
16 run \- find, execute, and log the results of tests
20 \fBrun\fR [\fB-dgq] [\fB-o\fR \fIoutputdir\fR] [\fB-pP\fR \fIscript\fR] [\fB-t\fR \fIseconds\fR] [\fB-uxX\fR \fIusername\fR]
26 \fBrun\fR \fB-w\fR \fIrunfile\fR [\fB-gq\fR] [\fB-o\fR \fIoutputdir\fR] [\fB-pP\fR \fIscript\fR] [\fB-t\fR \fIseconds\fR]
27 [\fB-uxX\fR \fIusername\fR] \fIpathname\fR ...
32 \fBrun\fR \fB-c\fR \fIrunfile\fR [\fB-dq\fR]
43 The \fBrun\fR command has three basic modes of operation. With neither the
44 \fB-c\fR nor the \fB-w\fR option, \fBrun\fR processes the arguments provided on
45 the command line, adding them to the list for this run. If a specified
46 \fIpathname\fR is an executable file, it is added as a test. If a specified
47 \fIpathname\fR is a directory, the behavior depends upon the \fB-g\fR option.
48 If \fB-g\fR is specified, the directory is treated as a test group. See the
49 section on "Test Groups" below. Without the \fB-g\fR option, \fBrun\fR simply
50 descends into the directory looking for executable files. The tests are then
51 executed, and the results are logged.
53 With the \fB-w\fR option, \fBrun\fR finds tests in the manner described above.
54 Rather than executing the tests and logging the results, the test configuration
55 is stored in a \fIrunfile\fR which can be used in future invocations, or edited
56 to modify which tests are executed and which options are applied. Options
57 included on the command line with \fB-w\fR become defaults in the
60 With the \fB-c\fR option, \fBrun\fR parses a \fIrunfile\fR, which can specify a
61 series of tests and test groups to be executed. The tests are then executed,
62 and the results are logged.
67 A test group is comprised of a set of executable files, all of which exist in
68 one directory. The options specified on the command line or in a \fIrunfile\fR
69 apply to individual tests in the group. The exception is options pertaining to
70 pre and post scripts, which act on all tests as a group. Rather than running
71 before and after each test, these scripts are run only once each at the start
72 and end of the test group.
76 The specified tests run serially, and are typically assigned results according
77 to exit values. Tests that exit zero and non-zero are marked "PASS" and "FAIL"
78 respectively. When a pre script fails for a test group, only the post script is
79 executed, and the remaining tests are marked "SKIPPED." Any test that exceeds
80 its \fItimeout\fR is terminated, and marked "KILLED."
82 By default, tests are executed with the credentials of the \fBrun\fR script.
83 Executing tests with other credentials is done via \fBsudo\fR(1m), which must
84 be configured to allow execution without prompting for a password. Environment
85 variables from the calling shell are available to individual tests. During test
86 execution, the working directory is changed to \fIoutputdir\fR.
90 By default, \fBrun\fR will print one line on standard output at the conclusion
91 of each test indicating the test name, result and elapsed time. Additionally,
92 for each invocation of \fBrun\fR, a directory is created using the ISO 8601
93 date format. Within this directory is a file named \fIlog\fR containing all the
94 test output with timestamps, and a directory for each test. Within the test
95 directories, there is one file each for standard output, standard error and
96 merged output. The default location for the \fIoutputdir\fR is
97 \fI/var/tmp/test_results\fR.
101 The \fIrunfile\fR is an ini style configuration file that describes a test run.
102 The file has one section named "DEFAULT," which contains configuration option
103 names and their values in "name = value" format. The values in this section
104 apply to all the subsequent sections, unless they are also specified there, in
105 which case the default is overridden. The remaining section names are the
106 absolute pathnames of files and direcotries, describing tests and test groups
107 respectively. The legal option names are:
111 \fBoutputdir\fR = \fIpathname\fR
115 The name of the directory that holds test logs.
120 \fBpre\fR = \fIscript\fR
124 Run \fIscript\fR prior to the test or test group.
129 \fBpre_user\fR = \fIusername\fR
133 Execute the pre script as \fIusername\fR.
138 \fBpost\fR = \fIscript\fR
142 Run \fIscript\fR after the test or test group.
147 \fBpost_user\fR = \fIusername\fR
151 Execute the post script as \fIusername\fR.
156 \fBquiet\fR = [\fITrue\fR|\fIFalse\fR]
160 If set to True, only the results summary is printed to standard out.
165 \fBtests\fR = [\fI'filename'\fR [,...]]
169 Specify a list of \fIfilenames\fR for this test group. Only the basename of the
170 absolute path is required. This option is only valid for test groups, and each
171 \fIfilename\fR must be single quoted.
176 \fBtimeout\fR = \fIn\fR
180 A timeout value of \fIn\fR seconds.
185 \fBuser\fR = \fIusername\fR
189 Execute the test or test group as \fIusername\fR.
195 The following options are available for the \fBrun\fR command.
199 \fB-c\fR \fIrunfile\fR
202 Specify a \fIrunfile\fR to be consumed by the run command.
210 Dry run mode. Execute no tests, but print a description of each test that would
219 Create test groups from any directories found while searching for tests.
224 \fB-o\fR \fIoutputdir\fR
227 Specify the directory in which to write test results.
232 \fB-p\fR \fIscript\fR
235 Run \fIscript\fR prior to any test or test group.
240 \fB-P\fR \fIscript\fR
243 Run \fIscript\fR after any test or test group.
251 Print only the results sumary to the standard output.
259 Specify a timeout value of \fIn\fR seconds per test.
264 \fB-u\fR \fIusername\fR
267 Execute tests or test groups as \fIusername\fR.
272 \fB-w\fR \fIrunfile\fR
275 Specify the name of the \fIrunfile\fR to create.
280 \fB-x\fR \fIusername\fR
283 Execute the pre script as \fIusername\fR.
288 \fB-X\fR \fIusername\fR
291 Execute the post script as \fIusername\fR.
296 \fBExample 1\fR Running ad-hoc tests.
299 This example demonstrates the simplest invocation of \fBrun\fR.
305 Test: /home/jkennedy/my-tests/test-01 [00:02] [PASS]
306 Test: /home/jkennedy/my-tests/test-02 [00:04] [PASS]
307 Test: /home/jkennedy/my-tests/test-03 [00:01] [PASS]
312 Running Time: 00:00:07
313 Percent passed: 100.0%
314 Log directory: /var/tmp/test_results/20120923T180654
319 \fBExample 2\fR Creating a \fIrunfile\fR for future use.
322 This example demonstrates creating a \fIrunfile\fR with non default options.
327 % \fBrun -p setup -x root -g -w new-tests.run new-tests\fR
328 % \fBcat new-tests.run\fR
337 outputdir = /var/tmp/test_results
339 [/home/jkennedy/new-tests]
340 tests = ['test-01', 'test-02', 'test-03']
347 The following exit values are returned:
355 Successful completion.