Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

atf-check(1) [netbsd man page]

ATF-CHECK(1)						    BSD 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 ...] [-x] 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 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). 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 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 omit- ted altogether, in which case any clean exit is accepted. ignore ignores the exit check. 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 empty ignore ignores stdout file:<path> compares stdout with given file inline:<value> compares stdout with inline value match:<regexp> looks for a regular expression in stdout save:<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 by ATF_SHELL in atf-config(1). You should avoid using this flag if at all possible to prevent shell quoting issues. 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' # 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 yy " 'echo foobar ; printf "xx yy " >&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 SEE ALSO
atf-config(1), atf(7) BSD
June 27, 2010 BSD

Check Out this Related Man Page

ATF-TEST-PROGRAM(1)					    BSD General Commands Manual 				       ATF-TEST-PROGRAM(1)

NAME
atf-test-program -- common interface to ATF test programs SYNOPSIS
atf-test-program [-r resfile] [-s srcdir] [-v var1=value1 [.. -v varN=valueN]] test_case atf-test-program -l DESCRIPTION
Test programs written using the ATF libraries all share a common user interface, which is what this manual page describes. NOTE: There is no binary known as atf-test-program; what is described in this manual page is the command-line interface exposed by the atf-c, atf-c++ and atf-sh bindings. In the first synopsis form, the test program will execute the provided test case and print its results to the standard output, unless other- wise stated by the -r flag. Optionally, the test case name can be suffixed by ':cleanup', in which case the cleanup routine of the test case will be executed instead of the test case body; see atf-test-case(4). Note that the test case is executed without isolation, so it can and probably will create and modify files in the current directory. To execute test cases in a controller manner, you need a runtime engine that understands the ATF interface. The recommended runtime engine is kyua(1). You should only execute test cases by hand for debugging pur- poses. In the second synopsis form, the test program will list all available test cases alongside their meta-data properties in a format that is machine parseable. This list is processed by kyua(1) to know how to execute the test cases of a given test program. The following options are available: -l Lists available test cases alongside a brief description for each of them. -r resfile Specifies the file that will receive the test case result. If not specified, the test case prints its results to stdout. If the result of a test case needs to be parsed by another program, you must use this option to redirect the result to a file and then read the resulting file from the other program. Note: do not try to process the stdout of the test case because your program may break in the future. -s srcdir The path to the directory where the test program is located. This is needed in all cases, except when the test program is being executed from the current directory. The test program will use this path to locate any helper data files or utilities. -v var=value Sets the configuration variable var to the value value. SEE ALSO
kyua(1) BSD
March 2, 2014 BSD
Man Page