From: Daniel Vetter Date: Wed, 11 Sep 2013 12:03:47 +0000 (+0200) Subject: tests/gem_persisten_relocs: Update like gem_reloc_vs_pug X-Git-Tag: intel-gpu-tools-1.4~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1978aecf1d22f21265d64099e70565d6e5e384cc;p=platform%2Fupstream%2Fintel-gpu-tools.git tests/gem_persisten_relocs: Update like gem_reloc_vs_pug Signed-off-by: Daniel Vetter --- diff --git a/tests/gem_persistent_relocs.c b/tests/gem_persistent_relocs.c index bc1d52a..b76d770 100644 --- a/tests/gem_persistent_relocs.c +++ b/tests/gem_persistent_relocs.c @@ -284,10 +284,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"; @@ -299,10 +298,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); @@ -325,13 +321,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; @@ -370,7 +361,7 @@ int main(int argc, char **argv) flags & INTERRUPT ? "-interruptible" : "", flags & FAULTING ? "-faulting-reloc" : "", flags & THRASH ? "-thrashing" : "", - flags & THRASH ? "-thrash-inactive" : "") + flags & THRASH_INACTIVE ? "-thrash-inactive" : "") do_forked_test(fd, flags); }