2 .\" Automated Testing Framework (atf)
4 .\" Copyright (c) 2008 The NetBSD Foundation, Inc.
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17 .\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 .\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21 .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 .Nd executes a command and analyzes its results
37 .Op Fl s Ar qual:value
38 .Op Fl o Ar action:arg ...
39 .Op Fl e Ar action:arg ...
46 executes a given command and analyzes its results, including
47 exit code, stdout and stderr.
49 In the first synopsis form,
51 will execute the provided command and apply checks specified
53 By default it will act as if it was run with
60 Multiple checks for the same output channel are allowed and, if specified,
61 their results will be combined as a logical and (meaning that the output must
62 match all the provided checks).
64 In the second synopsis form,
66 will print information about all supported options and their purpose.
68 The following options are available:
69 .Bl -tag -width XqualXvalueXX
71 Shows a short summary of all available options and their purpose.
72 .It Fl s Ar qual:value
73 Analyzes termination status.
75 .Bl -tag -width signal:<value> -compact
77 checks that the program exited cleanly and that its exit status is equal to
79 The exit code can be omitted altogether, in which case any clean exit is
82 ignores the exit check.
84 checks that the program exited due to a signal and that the signal that
87 The signal can be specified both as a number or as a name, or it can also
88 be omitted altogether, in which case any signal is accepted.
91 Most of these checkers can be prefixed by the
93 string, which effectively reverses the check.
94 .It Fl o Ar action:arg
95 Analyzes standard output.
97 .Bl -tag -width inline:<value> -compact
99 checks that stdout is empty
103 compares stdout with given file
104 .It Ar inline:<value>
105 compares stdout with inline value
106 .It Ar match:<regexp>
107 looks for a regular expression in stdout
109 saves stdout to given file
112 Most of these checkers can be prefixed by the
114 string, which effectively reverses the check.
115 .It Fl e Ar action:arg
116 Analyzes standard error (syntax identical to above)
120 as a shell command line, executing it with the system shell defined by
124 You should avoid using this flag if at all possible to prevent shell quoting
129 exits 0 on success, and other (unspecified) value on failure.
131 .Bd -literal -offset indent
132 # Exit code 0, nothing on stdout/stderr
135 # Typical usage if failure is expected
136 atf-check -s not-exit:0 'false'
138 # Checking stdout/stderr
140 atf-check -o file:expout -e inline:"xx\etyy\en" \e
141 'echo foobar ; printf "xx\etyy\en" >&2'
143 # Checking for a crash
144 atf-check -s signal:sigsegv my_program
147 atf-check -o match:foo -o not-match:bar echo foo baz