summaryrefslogtreecommitdiff
path: root/tests/kms_mmap_write_crc.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2016-02-18 00:17:11 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-03-08 17:12:04 +0100
commitc644c551777a1867b45bd4bc0f83fa333ac5af29 (patch)
tree4c33781c149dae9042cedb13944e7d2b49b9afc3 /tests/kms_mmap_write_crc.c
parent771dbb06b52247ce86222b0d88c7ee48616c7a22 (diff)
tests/kms_mmap_write_crc: Use the right fork helpers
For a background task the fork helpers are more appropriate, since we can explicitly cancel children. Also, anything that does real work is supposed to be in fixtures. Cc: Tiago Vignatti <tiago.vignatti@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> -- Tiago, can you pls check that I haven't broken anythig? Thanks, Daniel
Diffstat (limited to 'tests/kms_mmap_write_crc.c')
-rw-r--r--tests/kms_mmap_write_crc.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/tests/kms_mmap_write_crc.c b/tests/kms_mmap_write_crc.c
index ae026b61..fce0471d 100644
--- a/tests/kms_mmap_write_crc.c
+++ b/tests/kms_mmap_write_crc.c
@@ -243,6 +243,8 @@ static void run_test(data_t *data)
igt_skip("no valid crtc/connector combinations found\n");
}
+struct igt_helper_process hog;
+
/**
* fork_cpuhog_helper:
*
@@ -250,15 +252,9 @@ static void run_test(data_t *data)
* fill the CPU caches with random information so they can get stalled,
* provoking incoherency with the GPU most likely.
*/
-static void fork_cpuhog_helper(void) {
-
- /* TODO: if the parent is about to die before its child, e.g.
- * igt_assert_crc_equal() fails, there will be a boring exit handler
- * waiting the child to exit also. A workaround is to simply disable that
- * handler, buy this needs to be fixed properly in an elegant way. */
- igt_disable_exit_handler();
-
- igt_fork(hog, 1) {
+static void fork_cpuhog_helper(void)
+{
+ igt_fork_helper(&hog) {
while (1) {
usleep(10); /* quite ramdom really. */
@@ -297,16 +293,19 @@ int main(int argc, char **argv)
igt_require_pipe_crc();
igt_display_init(&data.display, data.drm_fd);
+
+ fork_cpuhog_helper();
}
igt_info("Using %d rounds for the test\n", ROUNDS);
- fork_cpuhog_helper();
for (i = 0; i < ROUNDS; i++)
run_test(&data);
igt_fixture {
igt_display_fini(&data.display);
+
+ igt_stop_helper(&hog);
}
igt_exit();