xref: /aosp_15_r20/external/ltp/include/tst_res_flags.h (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (c) Linux Test Project, 2014
4  */
5 
6 #ifndef TST_RES_FLAGS_H
7 #define TST_RES_FLAGS_H
8 
9 /**
10  * enum tst_res_flags - Test result reporting flags.
11  *
12  * @TPASS: Reports a single success.
13  * @TFAIL: Reports a single failure.
14  * @TBROK: Reports a single breakage.
15  * @TWARN: Reports a single warning. Warnings increment a warning counter and
16  *         show up in test results.
17  *
18  * @TDEBUG: Prints additional debugging messages, it does not change the test result counters and
19  *          the message is not displayed unless debugging is enabled with -D
20  *          test command line parameter.
21  *
22  * @TINFO: Prints an additional information, it does not change the test result
23  *         counters but unlike TDEBUG the message is always displayed.
24  *
25  * @TCONF: Reports unsupported configuration. When tests produce this result at
26  *         least a subset of test was skipped, because it couldn't run. The
27  *         usual reasons are, missing kernel modules or CONFIG options.
28  *         Unsuitable CPU architecture, not enough memory, etc.
29  *
30  * @TERRNO: Combine bitwise with result flags to append errno to the output message.
31  *
32  * @TTERRNO: Combine bitwise with result flags to append error from TST_ERR to
33  *           the message. The TST_TEST() macros store the errno into the
34  *           TST_ERR global variable in order to make sure it's not change
35  *           between the test is done and results are printed.
36  *
37  * @TRERRNO: Combine bitwise with result flags to errno from TST_RET variable
38  *           to the message. The TST_TEST() macros store return value into the
39  *           TST_RET global variable and quite a few, e.g. pthread functions,
40  *           return the error value directly instead of storing it to the errno.
41  *
42  * A result flag with optional bitwise combination of errno flag are passed to
43  * the tst_res() and tst_brk() functions. Each message counts as a single test
44  * result and tests can produce arbitrary number of results, i.e. TPASS, TFAIL,
45  * TBROK, TWARN and TCONF messages. Each such message increases a result
46  * counter in a piece of shared memory, which means that reported results are
47  * accounted immediately even from child processes and there is no need for
48  * result propagation.
49  */
50 enum tst_res_flags {
51 	TPASS = 0,
52 	TFAIL = 1,
53 	TBROK = 2,
54 	TWARN = 4,
55 	TDEBUG = 8,
56 	TINFO = 16,
57 	TCONF = 32,
58 	TERRNO = 0x100,
59 	TTERRNO = 0x200,
60 	TRERRNO	= 0x400,
61 };
62 
63 #define TTYPE_RESULT(ttype)	((ttype) & TTYPE_MASK)
64 #define TTYPE_MASK 0x3f
65 
66 #endif /* TST_RES_FLAGS_H */
67