[igt-dev] [PATCH i-g-t 1/4] lib: Print subtest starting/ending line to stderr too

Petri Latvala petri.latvala at intel.com
Mon Apr 30 09:28:45 UTC 2018


when instructed via the environment. This is needed for the new test
runner to properly assign stderr output to the correct subtest.

Signed-off-by: Petri Latvala <petri.latvala at intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
Cc: Tomi Sarvela <tomi.p.sarvela at intel.com>
Cc: Martin Peres <martin.peres at linux.intel.com>
---
 lib/igt_core.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 5092a3f0..da149c10 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -305,6 +305,8 @@ GKeyFile *igt_key_file;
 
 char *igt_frame_dump_path;
 
+static bool stderr_needs_sentinel = false;
+
 const char *igt_test_name(void)
 {
 	return command_str;
@@ -649,6 +651,8 @@ static void common_init_env(void)
 	}
 
 	igt_frame_dump_path = getenv("IGT_FRAME_DUMP_PATH");
+
+	stderr_needs_sentinel = getenv("IGT_SENTINEL_ON_STDERR") != NULL;
 }
 
 static int common_init(int *argc, char **argv,
@@ -932,7 +936,10 @@ bool __igt_run_subtest(const char *subtest_name)
 
 	igt_kmsg(KMSG_INFO "%s: starting subtest %s\n",
 		 command_str, subtest_name);
-	igt_debug("Starting subtest: %s\n", subtest_name);
+	igt_info("Starting subtest: %s\n", subtest_name);
+	fflush(stdout);
+	if (stderr_needs_sentinel)
+		fprintf(stderr, "Starting subtest: %s\n", subtest_name);
 
 	_igt_log_buffer_reset();
 
@@ -987,6 +994,9 @@ static void exit_subtest(const char *result)
 		 in_subtest, result, time_elapsed(&subtest_time, &now),
 		 (!__igt_plain_output) ? "\x1b[0m" : "");
 	fflush(stdout);
+	if (stderr_needs_sentinel)
+		fprintf(stderr, "Subtest %s: %s (%.3fs)\n",
+			in_subtest, result, time_elapsed(&subtest_time, &now));
 
 	igt_terminate_spin_batches();
 
-- 
2.14.1



More information about the igt-dev mailing list