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