NIHTEST-CASE(5) File Formats Manual NIHTEST-CASE(5)

nihtest-case
test case format for nihtest

nihtest(1) is a testing tool. It uses .test files as input. This man page describes the format of these test files.

Lines beginning with “#” are comments.

The following commands are recognized. The return and args commands must appear exactly once, the others are optional.

[args ...]
Run the program with command line arguments args.
text
Describes the purpose of the test.
feature ...
Only run test if all features are present, otherwise skip it. The features are extracted from a top-level config.h file. If the string HAVE_FOO is defined in the file, the feature FOO is assumed to be available, otherwise not. See also the description of top-build-directory in nihtest-config(5).
test in [out]
Copy file in into the testing directory as test, compare it against out after program run. If out is omitted, it is compared to in.
test in
Copy file in into the testing directory as test, check that it is removed by the program.
test out
Check that file test is created by the program and compare it against out.
command [args ...]
If command exits with non-zero status, skip the test.
library
Pre-load the shared object library before running the program.
prg
Run prg. See the description of args above for its command line arguments. If this directive is omitted, default-program from nihtest.conf is run.
ret
ret is the expected exit code (usually 0 on success).
var value
Set the environment variable var to value.
text
Expect the error message text on standard error output (stderr). If multiple stderr commands are used, the messages are expected in the order given.
pattern replacement
Run regular expression replacement over the standard error output and the expected output as provided by stderr before comparing them. pattern is the match expression, replacement is the replacement expression. In the replacement expression, “$1” to “$9” are replaced with the content of the corresponding “(...)” match in the pattern. See re_format(7) for details.
text
Provide text to the program's standard input. If multiple stdin commands are used, the messages are expected in the order given.
file
Provide the contents of the file file to the program's standard input.
text
The program is expected to print text to it standard output (stdout). If multiple stdout commands are used, the messages are expected in the order given.

nihtest(1), nihtest-config(5)
June 2, 2020 NiH