diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-03-15 23:00:33 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-03-15 23:06:29 +0000 |
commit | 520b6f7fbb6cb7dc99d689cc6c073fae1ccc8e7f (patch) | |
tree | 695f86562df099fc57e133c9e879e7123efa7b6b /tests/sw_sync.c | |
parent | 5a7c7575b5bb9542f722ed6ba095b9d62609cd56 (diff) |
sw_sync: Wait until the end
If we allow a fork-helper to exit normally before the parent tries to
reap the helper (fork-helpers are intended to be only used for
persistent background loads), then the helper unhelpful aborts because
the child exited cleanly.
Simplify by not using the so called helpers at all.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108889
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/sw_sync.c')
-rw-r--r-- | tests/sw_sync.c | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/tests/sw_sync.c b/tests/sw_sync.c index ac4caf8b..26457ce7 100644 --- a/tests/sw_sync.c +++ b/tests/sw_sync.c @@ -171,21 +171,16 @@ static void test_sync_busy(void) static void test_sync_busy_fork_unixsocket(void) { - struct igt_helper_process proc = {}; int fence; int timeline; - int skip = 0; int sv[2]; + igt_require(socketpair(AF_UNIX, SOCK_DGRAM, 0, sv) == 0); + timeline = sw_sync_timeline_create(); fence = sw_sync_timeline_create_fence(timeline, 1); - if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sv) != 0) { - skip = 1; - goto out; - } - - igt_fork_helper(&proc) { + igt_fork(child, 1) { /* Child process */ int socket = sv[1]; int socket_timeline; @@ -202,8 +197,7 @@ static void test_sync_busy_fork_unixsocket(void) msg.msg_control = c_buffer; msg.msg_controllen = sizeof(c_buffer); - if (recvmsg(socket, &msg, 0) < 0) - _Exit(1); + igt_assert(recvmsg(socket, &msg, 0) == 0); cmsg = CMSG_FIRSTHDR(&msg); data = CMSG_DATA(cmsg); @@ -239,49 +233,39 @@ static void test_sync_busy_fork_unixsocket(void) igt_assert_f(sync_fence_wait(fence, 0) == -ETIME, "Fence signaled (it should not have been signalled yet)\n"); - if (sendmsg(socket, &msg, 0) < 0) { - skip = 1; - } else { - igt_assert_f(sync_fence_wait(fence, 2*1000) == 0, - "Fence not signaled (timeline value 1 fence seqno 1)\n"); - } + igt_assert(sendmsg(socket, &msg, 0) == 0); + + igt_assert_f(sync_fence_wait(fence, 2*1000) == 0, + "Fence not signaled (timeline value 1 fence seqno 1)\n"); } - igt_stop_helper(&proc); + igt_waitchildren(); -out: close(fence); close(timeline); - igt_require(!skip); } static void test_sync_busy_fork(void) { - struct igt_helper_process proc = {}; - int fence; - int timeline; - int skip = 0; + int timeline = sw_sync_timeline_create(); + int fence = sw_sync_timeline_create_fence(timeline, 1); - timeline = sw_sync_timeline_create(); - fence = sw_sync_timeline_create_fence(timeline, 1); + igt_assert_f(sync_fence_wait(fence, 0) == -ETIME, + "Fence signaled (it should not have been signalled yet)\n"); - igt_fork_helper(&proc) { + igt_fork(child, 1) { usleep(1*1000*1000); /* Advance timeline from 0 -> 1 */ sw_sync_timeline_inc(timeline, 1); } - igt_assert_f(sync_fence_wait(fence, 0) == -ETIME, - "Fence signaled (it should not have been signalled yet)\n"); - igt_assert_f(sync_fence_wait(fence, 2*1000) == 0, "Fence not signaled (timeline value 1 fence seqno 1)\n"); - igt_stop_helper(&proc); + igt_waitchildren(); close(fence); close(timeline); - igt_require(!skip); } static void test_sync_merge_invalid(void) |