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(7)						       BSD Miscellaneous Information Manual						    ATF(7)

NAME
ATF -- introduction to the Automated Testing Framework DESCRIPTION
IMPORTANT: If you are here because you want to know how to run the tests in /usr/tests, you most likely want to read the tests(7) manual page instead. The Automated Testing Framework (ATF) is a collection of libraries and utilities designed to ease unattended application testing in the hands of developers and end users of a specific piece of software. As regards developers, ATF provides the necessary means to easily create test suites composed of multiple test programs, which in turn are a collection of test cases. It also attempts to simplify the debugging of problems when these test cases detect an error by providing as much information as possible about the failure. As regards users, it simplifies the process of running the test suites and, in special, encourages end users to run them often: they do not need to have source trees around nor any other development tools installed to be able to certify that a given piece of software works on their machine as advertised. If your operating systems distributes ATF, it is possible that it provides an introductory tests(7) manual page. You are encouraged to read it now. License ATF is distributed under the terms of the TNF License, a 2-clause BSD license. For more details please see: /usr/share/doc/atf/COPYING Components ATF is a highly modular piece of software. It provides a couple of libraries to ease the implementation of test programs: one for the C and C++ languages and another one for shell scripts. It also includes multiple small utilities that follow the principle of doing a single thing but doing it right. This section outlines which these components are. Public utilities: atf-check(1) Executes a command and checks that its exit code, its standard output and its standard error output match pre-speci- fied expected values. atf-config(1) Queries static configuration information. atf-report(1) Converts the output of atf-run to user-friendly and/or machine-parseable reports. atf-run(1) Automates the execution of a series of test programs and collects their results in a unified report. atf-sh(1) Shell interpreter for shell-based test programs. Programming interfaces: atf-c-api(3) C programming interface for test programs. atf-c++-api(3) C++ programming interface for test programs. atf-sh-api(3) POSIX shell programming interface for test programs. Other: atf-formats(5) Description of the machine-parseable data formats used by the tools. atf-test-case(4) Generic description of test cases, independent of the language they are implemented in. atf-test-program(1) Common interface provided by the test programs written using the ATF libraries. Recommended reading order For end users wishing to run tests: 1. tests(7) (only if provided by your operating system). 2. atf-test-program(1) 3. atf-run(1) 4. atf-report(1) 5. atf-config(1) For developers wanting to write their own tests: 1. Everything recommended to users. 2. atf-test-case(4) 3. atf-c-api(3) 4. atf-c++-api(3) 5. atf-sh-api(3) 6. atf-sh(1) 7. atf-check(1) For those interested in ATF internals: 1. Everything recommended to users. 2. Everything recommended to developers. 3. atf-formats(5) SEE ALSO
tests(7) HISTORY
ATF started as a Google Summer of Code 2007 project mentored by The NetBSD Foundation. Its original goal was to provide a testing framework for The NetBSD Operating System, but it grew as an independent project because the framework itself did not need to be tied to a specific operating system. For more details on this subject, please see: /usr/share/doc/atf/NEWS /usr/share/doc/atf/ROADMAP AUTHORS
For more details on the people that made ATF possible, please see: /usr/share/doc/atf/AUTHORS BSD
August 28, 2010 BSD
Man Page