diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-07-05 20:34:00 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-07-07 23:52:08 -0400 |
commit | 55c4abe6672fb99cb848a87ff1e975cbc573c5b7 (patch) | |
tree | cf7593331211a0c7a4997c7e1b6bb05b02ba22ab /lib/qemu-wrapper.c | |
parent | 9ef14dc6ca29316eb88cb325f100bfb87c18c3a9 (diff) |
qemu-wrapper: Print out test name correctly on test timeout
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'lib/qemu-wrapper.c')
-rw-r--r-- | lib/qemu-wrapper.c | 13 |
1 files changed, 6 insertions, 7 deletions
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")) |