summaryrefslogtreecommitdiff
path: root/tests/gem_reloc_vs_gpu.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-09-10 15:29:17 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-09-10 17:40:06 +0200
commit7c25e8cff15587712ce92f16b61b154080744fe4 (patch)
tree961e7df3c3d4b651297885bd8755e7bf45641a6a /tests/gem_reloc_vs_gpu.c
parentedd723457c5b3488a26167087f8b3b3045944804 (diff)
tests/gem_reloc_vs_gpu: use igt_fork_helper
Now we do a waitpid instead of a simple wait which could eat the "wrong" child ... Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests/gem_reloc_vs_gpu.c')
-rw-r--r--tests/gem_reloc_vs_gpu.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/tests/gem_reloc_vs_gpu.c b/tests/gem_reloc_vs_gpu.c
index 9f85e9cdc..8c28cbc97 100644
--- a/tests/gem_reloc_vs_gpu.c
+++ b/tests/gem_reloc_vs_gpu.c
@@ -281,10 +281,9 @@ static void do_test(int fd, bool faulting_reloc)
static void do_forked_test(int fd, unsigned flags)
{
int num_threads = sysconf(_SC_NPROCESSORS_ONLN);
- pid_t pid = -1;
+ struct igt_helper_process thrasher;
if (flags & (THRASH | THRASH_INACTIVE)) {
- sighandler_t oldsig;
char fname[FILENAME_MAX];
int drop_caches_fd;
const char *data = THRASH_INACTIVE ? "0xf" : "0x7";
@@ -296,10 +295,7 @@ static void do_forked_test(int fd, unsigned flags)
drop_caches_fd = open(fname, O_WRONLY);
igt_require(drop_caches_fd >= 0);
- oldsig = signal(SIGQUIT, SIG_DFL);
- pid = fork();
- signal(SIGQUIT, oldsig);
- if (pid == 0) {
+ igt_fork_helper(&thrasher) {
while (1) {
usleep(1000);
igt_assert(write(drop_caches_fd, data, strlen(data) + 1) == strlen(data) + 1);
@@ -322,13 +318,8 @@ static void do_forked_test(int fd, unsigned flags)
}
igt_waitchildren();
-
- if (pid != -1) {
- int exitcode;
-
- kill(pid, SIGQUIT);
- wait(&exitcode);
- }
+ if (flags & (THRASH | THRASH_INACTIVE))
+ igt_stop_helper(&thrasher);
}
int fd;