@@ -22,6 +22,9 @@
* @TINFO: Prints an additional information, it does not change the test result
* counters but unlike TDEBUG the message is always displayed.
*
+ * @TINFO_WARN: Reports a single warning, but it does not change the test result
+ * counters like TINFO.
+ *
* @TCONF: Reports unsupported configuration. When tests produce this result at
* least a subset of test was skipped, because it couldn't run. The
* usual reasons are, missing kernel modules or CONFIG options.
@@ -55,12 +58,13 @@ enum tst_res_flags {
TDEBUG = 8,
TINFO = 16,
TCONF = 32,
+ TINFO_WARN = 64,
TERRNO = 0x100,
TTERRNO = 0x200,
TRERRNO = 0x400,
};
#define TTYPE_RESULT(ttype) ((ttype) & TTYPE_MASK)
-#define TTYPE_MASK 0x3f
+#define TTYPE_MASK 0x7f
#endif /* TST_RES_FLAGS_H */
@@ -69,7 +69,7 @@ void tst_res_(const char *file, const int lineno, int ttype,
({ \
TST_RES_SUPPORTS_TCONF_TDEBUG_TFAIL_TINFO_TPASS_TWARN(\
!((TTYPE_RESULT(ttype) ?: TCONF) & \
- (TCONF | TDEBUG | TFAIL | TINFO | TPASS | TWARN))); \
+ (TCONF | TDEBUG | TFAIL | TINFO | TPASS | TWARN | TINFO_WARN))); \
tst_res_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__);\
})
@@ -20,6 +20,7 @@ static struct tcase {
{FLAG(TBROK)},
{FLAG(TCONF)},
{FLAG(TWARN)},
+ {FLAG(TINFO_WARN)},
{FLAG(TINFO)},
{FLAG(TDEBUG), " (printed only with -D or LTP_ENABLE_DEBUG=1)"},
};
@@ -26,6 +26,7 @@ char* tst_ttype2color(int ttype)
return ANSI_COLOR_YELLOW;
break;
case TWARN:
+ case TINFO_WARN:
return ANSI_COLOR_MAGENTA;
break;
case TINFO:
@@ -174,13 +174,16 @@ static void tst_res__(const char *file, const int lineno, int ttype,
int len = 0;
int ttype_result = TTYPE_RESULT(ttype);
- if (ttype_result == TDEBUG) {
- printf("%s: %i: TDEBUG is not supported\n", __func__, __LINE__);
+ if (ttype_result == TDEBUG || ttype_result == TINFO_WARN) {
+ printf("%s: %i: %s is not supported\n", __func__, __LINE__,
+ strttype(ttype));
abort();
}
- if (file && (ttype_result != TPASS && ttype_result != TINFO))
+ if (file && (ttype_result != TPASS && ttype_result != TINFO
+ && ttype_result != TINFO_WARN)) {
len = sprintf(tmesg, "%s:%d: ", file, lineno);
+ }
EXPAND_VAR_ARGS(tmesg + len, arg_fmt, USERMESG - len);
/*
@@ -198,7 +201,8 @@ static void tst_res__(const char *file, const int lineno, int ttype,
* Set the test case number and print the results, depending on the
* display type.
*/
- if (ttype_result == TWARN || ttype_result == TINFO) {
+ if (ttype_result == TWARN || ttype_result == TINFO ||
+ ttype_result == TINFO_WARN) {
tst_print(TCID, 0, ttype, tmesg);
} else {
if (tst_count < 0)
@@ -225,6 +225,9 @@ static void print_result(const char *file, const int lineno, int ttype,
case TINFO:
res = "TINFO";
break;
+ case TINFO_WARN:
+ res = "TINFO WARNING";
+ break;
case TDEBUG:
res = "TDEBUG";
break;
When replaced tst_res(TINFO, "WARNING: ...") with tst_res(TINFO_WARN, "..."), then: - output message is magenta (the same as for TWARN => more visible), - "WARNING" is printed by the library (unification), Signed-off-by: Petr Vorel <pvorel@suse.cz> --- include/tst_res_flags.h | 6 +++++- include/tst_test.h | 2 +- lib/newlib_tests/tst_res_flags.c | 1 + lib/tst_ansi_color.c | 1 + lib/tst_res.c | 12 ++++++++---- lib/tst_test.c | 3 +++ 6 files changed, 19 insertions(+), 6 deletions(-)