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. Successes increment passed counter and 13 * show up in the test results. 14 * 15 * @TFAIL: Reports a single failure. Failures increment failure counter and 16 * show up in the test results. A failure occurs when test assertion 17 * is broken. 18 * 19 * @TBROK: Reports a single breakage. Breakages increment breakage counter and 20 * show up in the test results. Breakages are reported in cases where a 21 * test couldn't be executed due to an unexpected failure during the 22 * test setup. The TBROK status is mostly used with tst_brk() which 23 * exit the test immediately. The difference between TBROK and TCONF is 24 * that TCONF is used in cases where optional functionality is missing 25 * while TBROK is used in cases where something that is supposed to 26 * work is broken unexpectedly. 27 * 28 * @TWARN: Reports a single warning. Warnings increment a warning counter and 29 * show up in test results. Warnings are somewhere in the middle between 30 * TBROK and TCONF. Warnings usually appear when something that is 31 * supposed to be working is broken but the test can somehow continue. 32 * 33 * @TDEBUG: Prints additional debugging messages, it does not change the test result counters and 34 * the message is not displayed unless debugging is enabled with -D 35 * test command line parameter. 36 * 37 * @TINFO: Prints an additional information, it does not change the test result 38 * counters but unlike TDEBUG the message is always displayed. 39 * 40 * @TCONF: Reports unsupported configuration. When tests produce this result at 41 * least a subset of test was skipped, because it couldn't run. The 42 * usual reasons are, missing kernel modules or CONFIG options. 43 * Unsuitable CPU architecture, not enough memory, etc. 44 * 45 * @TERRNO: Combine bitwise with result flags to append errno to the output message. 46 * 47 * @TTERRNO: Combine bitwise with result flags to append error from TST_ERR to 48 * the message. The TST_TEST() macros store the errno into the 49 * TST_ERR global variable in order to make sure it's not change 50 * between the test is done and results are printed. 51 * 52 * @TRERRNO: Combine bitwise with result flags to errno from TST_RET variable 53 * to the message. The TST_TEST() macros store return value into the 54 * TST_RET global variable and quite a few, e.g. pthread functions, 55 * return the error value directly instead of storing it to the errno. 56 * 57 * A result flag with optional bitwise combination of errno flag are passed to 58 * the tst_res() and tst_brk() functions. Each message counts as a single test 59 * result and tests can produce arbitrary number of results, i.e. TPASS, TFAIL, 60 * TBROK, TWARN and TCONF messages. Each such message increases a result 61 * counter in a piece of shared memory, which means that reported results are 62 * accounted immediately even from child processes and there is no need for 63 * result propagation. 64 */ 65 enum tst_res_flags { 66 TPASS = 0, 67 TFAIL = 1, 68 TBROK = 2, 69 TWARN = 4, 70 TDEBUG = 8, 71 TINFO = 16, 72 TCONF = 32, 73 TERRNO = 0x100, 74 TTERRNO = 0x200, 75 TRERRNO = 0x400, 76 }; 77 78 #define TTYPE_RESULT(ttype) ((ttype) & TTYPE_MASK) 79 #define TTYPE_MASK 0x3f 80 81 #endif /* TST_RES_FLAGS_H */ 82