ATF-CHECK(1)
β¨ atf-check β the girl who runs ur command and judges it π
okay so bestie, welcome to atf-check(1) from the General Commands Manual β yes we're doing manpage lore today, and this one is literally the vibe-checker of the Unix world. she runs a command, then reads the receipts: exit code, stdout, stderr, all of it. π
π¦ NAME π¦
atf-check β executes a command and analyzes its results
πΈ SYNOPSIS πΈ
atf-check [-s qual:value] [-o action:arg ...] [-e action:arg ...] [-x]
command
π DESCRIPTION π
atf-check runs a command for you and then analyzes what happened β like the exit code, the stdout, and the stderr. she's nosy in the best way fr fr.
test cases must useatf-sh(3)'satf_checkbuiltin function instead of calling this utility directly. like, don't come for her directly, use the builtin, iykyk.
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 exit:0 -o empty -e empty. π« Multiple checks for the same output channel are allowed and, if specified, their results will be combined as a logical and (meaning that the output must match all the provided checks). so like, everyone has to agree. no dissent. periodt.
In the second synopsis form, atf-check will print information about all supported options and their purpose. β¨
The following options are available:
-s qual:valueβ Analyzes termination status. Must be one of:exit:<value>β checks that the program exited cleanly and that its exit status is equal to value. The exit code can be omitted altogether, in which case any clean exit is accepted. πignoreβ ignores the exit check. not me caring... anyway.signal:<value>β checks that the program exited due to a signal and that the signal that terminated it is value. The signal can be specified both as a number or as a name, or it can also be omitted altogether, in which case any signal is accepted. π
Most of these checkers can be prefixed by the 'not-' string, which effectively reverses the check. π
-o action:argβ Analyzes standard output. Must be one of:emptyβ checks that stdout is emptyignoreβ ignores stdoutfile:<path>β compares stdout with given fileinline:<value>β compares stdout with inline valuematch:<regexp>β looks for a regular expression in stdoutsave:<path>β saves stdout to given file
Most of these checkers can be prefixed by the 'not-' string, which effectively reverses the check. π
-e action:argβ Analyzes standard error (syntax identical to above) π«Ά-xβ Executes command as a shell command line, executing it with the system shell defined byATF_SHELL. You should avoid using this flag if at all possible to prevent shell quoting issues. β οΈ like genuinely, avoid it, quoting hell is not the moment.-r timeout[:interval]β Repeats failed checks until the timeout (in seconds) expires. If unspecified, the default interval (in milliseconds) is 50 ms. This can be used to wait for an expected update to the contents of a file. β° she's patient, she'll wait for you to show up.
π ENVIRONMENT π
ATF_SHELLβ Path to the system shell to be used when the-xis given to run commands.
π EXIT STATUS π
atf-check exits 0 on success, and other (unspecified) value on failure. slay when it works, mystery number when it doesn't. π€·βοΈ
β EXAMPLES β
The following are sample invocations from within a test case. Note that we use the atf_check function provided by atf-sh(3) instead of executing atf-check directly:
# Exit code 0, nothing on stdout/stderr
atf_check true
# Typical usage if failure is expected
atf_check -s not-exit:0 false
# Checking stdout/stderr
echo foobar >expout
atf_check -o file:expout -e inline:"xx\tyy\n" \
-x 'echo foobar ; printf "xx\tyy\n" >&2'
# Checking for a crash
atf_check -s signal:sigsegv my_program
# Combined checks
atf_check -o match:foo -o not-match:bar echo foo baz
# Wait 5 seconds for a line to show up in a file
( sleep 2 ; echo "testing 123" > $test_path ) &
atf-check -o ignore -e ignore -s exit:0 -r 5 \
grep "testing 123" $test_path
π SEE ALSO π
okay that's the whole page bestie, you ate it, you read it, you understood it π β¨ this was the Debian edition, dated February 6, 2021, and it's giving iconic. go forth and check ur commands responsibly, ily π«ΆπΈ
π¦ where this page comes from
- alpine 3.22: atf-doc 0.23-r0 Β· BSD-2-Clause AND BSD-3-Clause
- alpine 3.23: atf-doc 0.23-r0 Β· BSD-2-Clause AND BSD-3-Clause
- alpine 3.24: atf-doc 0.23-r0 Β· BSD-2-Clause AND BSD-3-Clause
- debian trixie: atf-sh 0.22-3 Β· BSD-2-Clause
- fedora 43: libatf-sh-devel 0.23-2.fc43 Β· LicenseRef-Callaway-BSD
- fedora 43: libatf-sh-devel 0.23-2.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: libatf-sh-devel 0.23-4.fc44 Β· LicenseRef-Callaway-BSD
- fedora 44: libatf-sh-devel 0.23-4.fc44 Β· LicenseRef-Callaway-BSD
- nixos 26.05: atf 0.23
- nixpkgs unstable: atf 0.23
- ubuntu questing: atf-sh 0.22-3
- ubuntu resolute: atf-sh 0.22-3build1 Β· BSD-2-Clause
- ubuntu stonking: atf-sh 0.22-3build1 Β· BSD-2-Clause
- Copyright (c) 2008 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms