diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2019-02-19 08:57:13 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2019-02-20 13:58:04 +0100 |
commit | 1c068c4f11a8f0b12a9b49b54c212315d8f1b347 (patch) | |
tree | 69d1a4797540fccf70372b10aa435cc9877f3ff9 /lib/tests/igt_tests_common.h | |
parent | 4494052aa3c8f95c2b21acc4a1273fc4431bb71e (diff) |
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 <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/tests/igt_tests_common.h')
-rw-r--r-- | lib/tests/igt_tests_common.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/tests/igt_tests_common.h b/lib/tests/igt_tests_common.h index 9b347a45..e66ee37c 100644 --- a/lib/tests/igt_tests_common.h +++ b/lib/tests/igt_tests_common.h @@ -35,4 +35,15 @@ */ #define internal_assert assert +static inline void internal_assert_wexited(int wstatus, int exitcode) +{ + internal_assert(WIFEXITED(wstatus) && + WEXITSTATUS(wstatus) == exitcode); +} + +static inline void internal_assert_wsignaled(int wstatus, int signal) +{ + internal_assert(WIFSIGNALED(wstatus) && + WTERMSIG(wstatus) == signal); +} #endif |