1ATF-CHECK(1) BSD General Commands Manual ATF-CHECK(1)
2
4 atf-check — executes a command and analyzes its results
5
7 atf-check [-s qual:value] [-o action:arg ...] [-e action:arg ...] [-x]
8 command
9 atf-check -h
10
12 atf-check executes a given command and analyzes its results, including
13 exit code, stdout and stderr.
14
15 In the first synopsis form, atf-check will execute the provided command
16 and apply checks specified by arguments. By default it will act as if it
17 was run with -s exit:0 -o empty -e empty. Multiple checks for the same
18 output channel are allowed and, if specified, their results will be com‐
19 bined as a logical and (meaning that the output must match all the pro‐
20 vided checks).
21
22 In the second synopsis form, atf-check will print information about all
23 supported options and their purpose.
24
25 The following options are available:
26
27 -h Shows a short summary of all available options and their
28 purpose.
29
30 -s qual:value Analyzes termination status. Must be one of:
31 exit:<value> checks that the program exited cleanly and
32 that its exit status is equal to value.
33 The exit code can be omitted altogether,
34 in which case any clean exit is accepted.
35 ignore ignores the exit check.
36 signal:<value> checks that the program exited due to a
37 signal and that the signal that terminated
38 it is value. The signal can be specified
39 both as a number or as a name, or it can
40 also be omitted altogether, in which case
41 any signal is accepted.
42
43 Most of these checkers can be prefixed by the ‘not-’
44 string, which effectively reverses the check.
45
46 -o action:arg Analyzes standard output. Must be one of:
47 empty checks that stdout is empty
48 ignore ignores stdout
49 file:<path> compares stdout with given file
50 inline:<value> compares stdout with inline value
51 match:<regexp> looks for a regular expression in stdout
52 save:<path> saves stdout to given file
53
54 Most of these checkers can be prefixed by the ‘not-’
55 string, which effectively reverses the check.
56
57 -e action:arg Analyzes standard error (syntax identical to above)
58
59 -x Executes command as a shell command line, executing it
60 with the system shell defined by ATF_SHELL in
61 atf-config(1). You should avoid using this flag if at all
62 possible to prevent shell quoting issues.
63
65 atf-check exits 0 on success, and other (unspecified) value on failure.
66
68 # Exit code 0, nothing on stdout/stderr
69 atf-check 'true'
70
71 # Typical usage if failure is expected
72 atf-check -s not-exit:0 'false'
73
74 # Checking stdout/stderr
75 echo foobar >expout
76 atf-check -o file:expout -e inline:"xx\tyy\n" \
77 'echo foobar ; printf "xx\tyy\n" >&2'
78
79 # Checking for a crash
80 atf-check -s signal:sigsegv my_program
81
82 # Combined checks
83 atf-check -o match:foo -o not-match:bar echo foo baz
84
86 atf-config(1), atf(7)
87
88BSD June 27, 2010 BSD