[igt-dev] [RFC PATCH 5/5] lib/core: report subtests that hit an igt_warning as WARNING

Daniel Vetter daniel.vetter at ffwll.ch
Thu Jan 18 13:59:55 UTC 2018


This is another piece of prep work to push the detection of dmesg
warnings into igt itself, so that we can correctly report dmesg
issue on a per-subtest basis even when running the entire binary.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 lib/igt_core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 65b394581e8f..d61d32295bb2 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1021,6 +1021,7 @@ void __igt_subtest_group_restore(int save)
 static bool skipped_one = false;
 static bool succeeded_one = false;
 static bool failed_one = false;
+static bool warned = false;
 
 static void exit_subtest(const char *) __attribute__((noreturn));
 static void exit_subtest(const char *result)
@@ -1037,6 +1038,7 @@ static void exit_subtest(const char *result)
 	igt_terminate_spin_batches();
 
 	in_subtest = NULL;
+	warned = false;
 	siglongjmp(igt_subtest_jmpbuf, 1);
 }
 
@@ -1126,7 +1128,7 @@ void igt_success(void)
 {
 	succeeded_one = true;
 	if (in_subtest)
-		exit_subtest("SUCCESS");
+		exit_subtest(warned ? "WARNING" : "SUCCESS");
 }
 
 /**
@@ -2120,6 +2122,9 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
 	if (list_subtests && level <= IGT_LOG_WARN)
 		return;
 
+	if (level >= IGT_LOG_WARN)
+		warned = true;
+
 	if (vasprintf(&line, format, args) == -1)
 		return;
 
-- 
2.14.3



More information about the igt-dev mailing list