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