All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH i-g-t 2/5] tests/kms_mmap_write_crc: Use the right fork helpers
Date: Thu, 18 Feb 2016 13:39:26 +0100	[thread overview]
Message-ID: <1455799169-15273-2-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1455799169-15273-1-git-send-email-daniel.vetter@ffwll.ch>

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
---
 tests/kms_mmap_write_crc.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/tests/kms_mmap_write_crc.c b/tests/kms_mmap_write_crc.c
index 6984bbd1f000..2e9a282d4293 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();
-- 
2.7.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-02-18 12:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 12:39 [PATCH i-g-t 1/5] lib/igt_kms: Don't disable exit handlers around set_vt_mode Daniel Vetter
2016-02-18 12:39 ` Daniel Vetter [this message]
2016-02-18 12:39 ` [PATCH i-g-t 3/5] gitignore: Add .dirstamp Daniel Vetter
2016-02-18 12:39 ` [PATCH i-g-t 4/5] lib/igt_core: remove igt_disable/enable_exit_handlers Daniel Vetter
2016-02-18 12:39 ` [PATCH i-g-t 5/5] lib: Unit test for exit handler Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455799169-15273-2-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.