s390/test_unwind: add WARN if tests failed

Trigger a warning if any of unwinder tests fail. This should help to
prevent quiet ignoring of test results when panic_on_warn is enabled.

Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
Vasily Gorbik 2021-04-09 00:31:47 +02:00 committed by Heiko Carstens
parent f169f42130
commit 9d42a4d3e2

View File

@ -296,16 +296,18 @@ static int test_unwind_flags(int flags)
static int test_unwind_init(void) static int test_unwind_init(void)
{ {
int ret = 0; int failed = 0;
int total = 0;
#define TEST(flags) \ #define TEST(flags) \
do { \ do { \
pr_info("[ RUN ] " #flags "\n"); \ pr_info("[ RUN ] " #flags "\n"); \
total++; \
if (!test_unwind_flags((flags))) { \ if (!test_unwind_flags((flags))) { \
pr_info("[ OK ] " #flags "\n"); \ pr_info("[ OK ] " #flags "\n"); \
} else { \ } else { \
pr_err("[ FAILED ] " #flags "\n"); \ pr_err("[ FAILED ] " #flags "\n"); \
ret = -EINVAL; \ failed++; \
} \ } \
} while (0) } while (0)
@ -336,7 +338,8 @@ do { \
#endif #endif
#undef TEST #undef TEST
return ret; WARN(failed, "%d of %d unwinder tests failed", failed, total);
return failed ? -EINVAL : 0;
} }
static void test_unwind_exit(void) static void test_unwind_exit(void)