1NIHTEST-CASE(5) File Formats Manual NIHTEST-CASE(5)
2
3
4
6 nihtest-case - test case format for nihtest
7
9 nihtest(1) is a testing tool. It uses .test files as input. This man
10 page describes the format of these test files.
11
12 Lines beginning with “#” are comments.
13
14 The following commands are recognized. The return and args commands
15 must appear exactly once, the others are optional.
16
17 arguments [argument ...]
18 Run the program with command line arguments args.
19 Shell style quoting is supported.
20
21 description text Describes the purpose of the test.
22
23 environment-clear Only variables explicitly set or passed through
24 are included in the environment passed to the
25 tested program.
26
27 environment-passthrough variable ...
28 Passes the named environment variables from the
29 environment nihtest(1) is run in to the tested
30 program.
31
32 environment-set variable value
33 Set the environment variable variable to value.
34
35 environment-unset variable ...
36 Removes the named environment variables.
37
38 features feature ... Only run test if all features are present,
39 otherwise skip it. The features are extracted
40 from a top-level config.h file. If the string
41 FOO is defined in the file, the feature FOO is
42 assumed to be available, otherwise not. See also
43 the description of top-build-directory in
44 nihtest-config(5).
45
46 file name in [out] The arguments in and out specify the contents of
47 the file name in the test directory before and
48 after the program is run, respectively. If out
49 is omitted, the file is expected to remain
50 unchanged.
51
52 “{}” specifies that the file does not exist (i.
53 e. that it is created or deleted by the program).
54
55 For “<inline>” the contents of the file are taken
56 from the test case, up to a line consisting of
57 “end-of-inline-data”. If both in and out are
58 “<inline>”, the input data comes first.
59 Otherwise the argument specifies the name of the
60 file to copy or compare againts.
61
62 mkdir name Create directory name
63 in the test directory.
64
65 precheck command [argument ...]
66 If command exits with non-zero status, skip the
67 test.
68
69 preload object Pre-load the shared object object before running
70 the program.
71
72 This is not supported on macOS and Windows, where
73 tests with preload will be skipped.
74
75 program name Run name. See the description of arguments above
76 for its command line arguments. If this
77 directive is omitted, default-program from
78 nihtest.conf is run.
79
80 return exit-code exit-code is the expected exit code (usually 0 on
81 success).
82
83 stderr [file] Specify the expect standard error output
84 (stderr). If file is given, the output is
85 compared with that file, otherwise the expected
86 text is taken from the following lines of the
87 test case, up to a line consisting of “end-of-
88 inline-data”.
89
90 stderr-replace pattern replacement
91 Run regular expression replacement over the
92 standard error output and the expected output as
93 provided by stderr before comparing them.
94 pattern is the match expression, replacement is
95 the replacement expression. In the replacement
96 expression, “$1” to “$9” are replaced with the
97 content of the corresponding “(...)” match in
98 the pattern. See re_format(7) for details.
99
100 stdin [file] If file is given, standard input (stdin) is
101 redirected from this file, which means the
102 program has direct access to the file, including
103 the ability to seek within it.
104
105 Otherwise the text provided to the program via a
106 pipe is taken from the test case, up to a line
107 consisting of “end-of-inline-data”.
108
109 stdout [file] Specify the expect standard output (stdout). If
110 file is given, the output is compared with that
111 file, otherwise the expected text is taken from
112 the following lines of the test case, up to a
113 line consisting of “end-of-inline-data”.
114
116 nihtest(1), nihtest-config(5)
117
118
119
120Linux 6.3.8-200.fc38.s390x June 15, 2023 NIHTEST-CASE(5)