From 2b804c33e7511a3036b5f86d6b8a8ae806120c10 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 29 Mar 2016 17:19:31 +0100 Subject: [PATCH] lib: Tidy error message for a helper process who unexpectedly dies Transform gem_exec_suspend: igt_core.c:1429: igt_stop_helper: Assertion `(((signed char) ((((__extension__ (((union { __typeof(status) __in; int __i; }) { .__in = (status) }).__i))) & 0x7f) + 1) >> 1) > 0) && (((__extension__ (((union { __typeof(status) __in; int __i; }) { .__in = (status) }).__i))) & 0x7f) == (proc->use_SIGKILL ? 9 : 15)' failed. into (gem_exec_suspend:16589) igt-core-DEBUG: Helper died too early with status=0 gem_exec_suspend: igt_core.c:1437: igt_stop_helper: Assertion `helper_was_alive(proc, status)' failed. Signed-off-by: Chris Wilson --- lib/igt_core.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/igt_core.c b/lib/igt_core.c index 1f9be7d0..832361b0 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -1305,6 +1305,13 @@ int igt_wait_helper(struct igt_helper_process *proc) return status; } +static bool helper_was_alive(struct igt_helper_process *proc, + int status) +{ + return (WIFSIGNALED(status) && + WTERMSIG(status) == (proc->use_SIGKILL ? SIGKILL : SIGTERM)); +} + /** * igt_stop_helper: * @proc: #igt_helper_process structure @@ -1320,8 +1327,9 @@ void igt_stop_helper(struct igt_helper_process *proc) kill(proc->pid, proc->use_SIGKILL ? SIGKILL : SIGTERM); status = igt_wait_helper(proc); - assert(WIFSIGNALED(status) && - WTERMSIG(status) == (proc->use_SIGKILL ? SIGKILL : SIGTERM)); + if (!helper_was_alive(proc, status)) + igt_debug("Helper died too early with status=%d\n", status); + assert(helper_was_alive(proc, status)); } static void children_exit_handler(int sig)