From 55c4abe6672fb99cb848a87ff1e975cbc573c5b7 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 5 Jul 2022 20:34:00 -0400 Subject: qemu-wrapper: Print out test name correctly on test timeout Signed-off-by: Kent Overstreet --- lib/qemu-wrapper.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib/qemu-wrapper.c') diff --git a/lib/qemu-wrapper.c b/lib/qemu-wrapper.c index 51f7691..4a2be97 100644 --- a/lib/qemu-wrapper.c +++ b/lib/qemu-wrapper.c @@ -39,13 +39,13 @@ static char *mprintf(const char *fmt, ...) static pid_t child; static int childfd; -static char *testname; +static char *current_test; static unsigned long timeout; static void alarm_handler(int sig) { char *msg = mprintf("========= FAILED TIMEOUT %s in %lus\n", - testname ?: "(no test)", timeout); + current_test ?: "(no test)", timeout); if (write(childfd, msg, strlen(msg)) != strlen(msg)) die("write error in alarm handler"); @@ -258,13 +258,12 @@ again: update_watchdog(line); - testname = test_starts(line); + char *testname = test_starts(line); + /* If a test is starting, close logfile for previous test: */ if (test_logfile && testname) { fclose(test_logfile); test_logfile = NULL; - free(testname); - testname = NULL; } if (test_logfile) @@ -279,8 +278,8 @@ again: if (testname) { test_logfile = log_open(logdir, basename, testname); - free(testname); - testname = NULL; + free(current_test); + current_test = testname; } if (exit_on_failure && str_starts_with(line, "TEST FAILED")) -- cgit v1.2.3