From 26b336f81128b6c51e2757381c19d8cdf0b2c369 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 3 Dec 2013 13:07:28 +0100 Subject: [PATCH] lib: Don't put functional code into asserts Android apparently compiles with NDEBUG. Which is strongly advised against, since the big pile of asserts mostly check correct usage of the helper code in testcases. Signed-off-by: Daniel Vetter --- lib/drmtest.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index 3130334..94fa686 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -1106,13 +1106,14 @@ static void fork_helper_exit_handler(int sig) { for (int i = 0; i < ARRAY_SIZE(helper_process_pids); i++) { pid_t pid = helper_process_pids[i]; - int status; + int status, ret; if (pid != -1) { /* Someone forgot to fill up the array? */ assert(pid != 0); - assert(kill(pid, SIGQUIT) == 0); + ret = kill(pid, SIGQUIT); + assert(ret == 0); while (waitpid(pid, &status, 0) == -1 && errno == EINTR) ; @@ -1174,12 +1175,13 @@ bool __igt_fork_helper(struct igt_helper_process *proc) */ void igt_stop_helper(struct igt_helper_process *proc) { - int status; + int status, ret; assert(proc->running); - assert(kill(proc->pid, - proc->use_SIGKILL ? SIGKILL : SIGQUIT) == 0); + ret = kill(proc->pid, + proc->use_SIGKILL ? SIGKILL : SIGQUIT); + assert(ret == 0); while (waitpid(proc->pid, &status, 0) == -1 && errno == EINTR) ; @@ -1194,11 +1196,14 @@ void igt_stop_helper(struct igt_helper_process *proc) static void children_exit_handler(int sig) { + int ret; + assert(!test_child); for (int nc = 0; nc < num_test_children; nc++) { int status = -1; - assert(kill(test_children[nc], SIGQUIT) == 0); + ret = kill(test_children[nc], SIGQUIT); + assert(ret == 0); while (waitpid(test_children[nc], &status, 0) == -1 && errno == EINTR) -- 2.7.4