ATF-CHECK(1) NetBSD General Commands Manual ATF-CHECK(1)
NAME
atf-check -- executes a command and analyzes its results
SYNOPSIS
atf-check [-s qual:value] [-o action:arg] [-e action:arg] command
atf-check -h
DESCRIPTION
atf-check executes a given command and analyzes its results, including
exit code, stdout and stderr.
In the first synopsis form, atf-check will execute the provided command
and apply checks specified by arguments. By default it will act as if it
was run with -s eq:0 -o empty -e empty
In the second synopsis form, atf-check will print information about all
supported options and their purpose.
The following options are available:
-h Shows a short summary of all available options and their
purpose.
-s qual:value Analyzes exit code. Must be one of:
ignore ignores exit status
eq:<value> checks that exit status is equal to value
ne:<value> checks that exit status is other than value
-o action:arg Analyzes standard output. Must be one of:
empty checks that stdout is empty
ignore ignores stdout
file:<path> compares stdout with given file
inline:<value> compares stdout with inline value
save:<path> saves stdout to given file
-e action:arg Analyzes standard error (syntax identical to above)
EXIT STATUS
atf-check exits 0 on success, and other (unspecified) value on failure.
EXAMPLES
# Exit code 0, nothing on stdout/stderr
atf-check 'true' || atf_fail
# Typical usage if failure is expected
atf-check -s ne:0 'false' || atf_fail
# Checking stdout/stderr
echo foobar >expout
atf-check -o file:expout -e inline:"xx\tyy\n" \
'echo foobar ; printf "xx\tyy\n" >&2' || atf_fail
SEE ALSO
atf(7)
NetBSD 5.0 May 9, 2008 NetBSD 5.0
