From 1c068c4f11a8f0b12a9b49b54c212315d8f1b347 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 19 Feb 2019 08:57:13 +0100 Subject: lib/tests: add internal_assert_wexited/wsignaled And convert everything over. igt_segfault needed a bit of care to differentiate between a real death-by-signal and igt_exit mapping a child process signal death to an exit code. Reviewed-by: Chris Wilson Signed-off-by: Daniel Vetter --- lib/tests/igt_segfault.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'lib/tests/igt_segfault.c') diff --git a/lib/tests/igt_segfault.c b/lib/tests/igt_segfault.c index bfbbff56..2a24531a 100644 --- a/lib/tests/igt_segfault.c +++ b/lib/tests/igt_segfault.c @@ -94,10 +94,7 @@ static int do_fork(void) errno == EINTR) ; - if(WIFSIGNALED(status)) - return WTERMSIG(status) + 128; - - return WEXITSTATUS(status); + return status; } } @@ -109,20 +106,20 @@ int main(int argc, char **argv) runc=false; igt_info("Simple test.\n"); fflush(stdout); - internal_assert(WTERMSIG(do_fork()) == SIGSEGV); + internal_assert_wsignaled(do_fork(), SIGSEGV); /* Test crash in a single subtest is reported */ simple = false; igt_info("Single subtest.\n"); fflush(stdout); - internal_assert(WTERMSIG(do_fork()) == SIGSEGV); + internal_assert_wexited(do_fork(), SIGSEGV + 128); /* Test crash in a subtest following a pass is reported */ simple = false; runa=true; igt_info("Passing then crashing subtest.\n"); fflush(stdout); - internal_assert(WTERMSIG(do_fork()) == SIGSEGV); + internal_assert_wexited(do_fork(), SIGSEGV + 128); /* Test crash in a subtest preceeding a pass is reported */ simple = false; @@ -130,8 +127,7 @@ int main(int argc, char **argv) runc=true; igt_info("Crashing then passing subtest.\n"); fflush(stdout); - internal_assert(WTERMSIG(do_fork()) == SIGSEGV); + internal_assert_wexited(do_fork(), SIGSEGV + 128); return 0; } - -- cgit v1.2.3