summaryrefslogtreecommitdiffhomepage
path: root/src/tests
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-06-17 14:49:58 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-06-18 18:39:00 +0200
commit9a21aae6d36ee514858b5dd4d1ed2b94c37a2fbd (patch)
tree92d832b9ad7a95a41c33f174fcf16b7687b86dd0 /src/tests
parent55c348237b8e5031b18e9d4a3037ad5f9c2445ae (diff)
qemu: show signal when failing
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/qemu/init.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/tests/qemu/init.c b/src/tests/qemu/init.c
index 0c3f843..51e5dde 100644
--- a/src/tests/qemu/init.c
+++ b/src/tests/qemu/init.c
@@ -158,7 +158,7 @@ static void kmod_selftests(void)
}
fclose(file);
if (!success) {
- puts("\x1b[31m\x1b[1m[-] Tests failed! :-(\x1b[0m");
+ puts("\x1b[31m\x1b[1m[-] Tests failed! \u2639\x1b[0m");
poweroff();
}
}
@@ -203,8 +203,19 @@ static void launch_tests(void)
if (write(fd, "success\n", 8) != 8)
panic("write(success_dev)");
close(fd);
- } else
- puts("\x1b[31m\x1b[1m[-] Tests failed! :-(\x1b[0m");
+ } else {
+ const char *why = "unknown cause";
+ int what = -1;
+
+ if (WIFEXITED(status)) {
+ why = "exit code";
+ what = WEXITSTATUS(status);
+ } else if (WIFSIGNALED(status)) {
+ why = "signal";
+ what = WTERMSIG(status);
+ }
+ printf("\x1b[31m\x1b[1m[-] Tests failed with %s %d! \u2639\x1b[0m\n", why, what);
+ }
}
static void ensure_console(void)