From 36c493fd6af6baa8ddfa2f239fee5dbf07f064c8 Mon Sep 17 00:00:00 2001 From: Christiano Haesbaert Date: Mon, 11 Nov 2024 16:35:18 +0100 Subject: [PATCH] Display signal exit condition of child test process If a child gets killed due a signal, we would basically be left wondering why as there was nothing printed out except "failed". This follows the same wording as init.c. --- init.c | 4 ++-- quark-test.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/init.c b/init.c index 66247be..30330b4 100644 --- a/init.c +++ b/init.c @@ -110,8 +110,8 @@ main(int argc, char *argv[]) if (WIFEXITED(status)) printf("%s exited with %d\n", argv[0], WEXITSTATUS(status)); else if (WIFSIGNALED(status)) - printf("%s exited with signal %d (SIG%s)\n", argv[0], - WTERMSIG(status), sigabbrev_np(WTERMSIG(status))); + printf("%s exited with signal %d (%s)\n", argv[0], + WTERMSIG(status), strsignal(WTERMSIG(status))); else if (WCOREDUMP(status)) printf("%s core dumped\n", argv[0]); else diff --git a/quark-test.c b/quark-test.c index 1a7ec2e..04d7334 100644 --- a/quark-test.c +++ b/quark-test.c @@ -628,6 +628,11 @@ run_test(const struct test *t, struct quark_queue_attr *qa) color(x); } fflush(stdout); + if (WIFSIGNALED(status)) + fprintf(stderr, "exited with signal %d (%s)\n", + WTERMSIG(status), strsignal(WTERMSIG(status))); + else if (WCOREDUMP(status)) + fprintf(stderr, "core dumped\n"); /* * Children exited, close the stream and print it out.