All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kahola <mika.kahola@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v3 1/2] tests/kms_flip: Set duration for subtest from command line
Date: Thu,  9 Aug 2018 13:12:33 +0300	[thread overview]
Message-ID: <1533809554-27925-2-git-send-email-mika.kahola@intel.com> (raw)
In-Reply-To: <1533809554-27925-1-git-send-email-mika.kahola@intel.com>

To reduce the execution time of kms_flip test on CI, let's move subtest
duration parameter as command line option. The default subtest duration
is 3 seconds for test that require jitter computation and for the rest
of the subtests are run only once.

v2: Run each subtest only once (default action)
v3: Reduces default timeout for tests that require jitter computation (Ville)

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 tests/kms_flip.c | 108 ++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 75 insertions(+), 33 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 393d690..4cd1951 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -82,6 +82,8 @@
 #define DRM_CAP_TIMESTAMP_MONOTONIC 6
 #endif
 
+#define MAX_DURATION            60
+
 drmModeRes *resources;
 int drm_fd;
 static drm_intel_bufmgr *bufmgr;
@@ -95,6 +97,13 @@ static drmModeConnector *last_connector;
 
 uint32_t *fb_ptr;
 
+/* Command line parameters. */
+struct {
+	int duration;
+} opt = {
+	.duration = 0,
+};
+
 struct type_name {
 	int type;
 	const char *name;
@@ -1521,56 +1530,90 @@ static void test_nonblocking_read(int in)
 	close(fd);
 }
 
+static int opt_handler(int option, int option_index, void *input)
+{
+	switch (option) {
+	case 'd':
+		opt.duration = strtol(optarg, NULL, 0);
+
+		if (opt.duration > MAX_DURATION) {
+			igt_debug("limiting test duration from %ds to %ds\n",
+				  opt.duration, MAX_DURATION);
+			opt.duration = MAX_DURATION;
+		}
+
+		if (opt.duration < 0) {
+			igt_debug("limiting test duration from %ds to %ds\n",
+				  opt.duration, 0);
+			opt.duration = 0;
+		}
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	return 0;
+}
+
+const char *help_str =
+	"  --duration test duration in seconds (default 0s)\n";
+
 int main(int argc, char **argv)
 {
+	struct option long_options[] = {
+		{ "duration", required_argument, NULL, 'd'},
+		{ 0, 0, 0, 0 }
+	};
+
 	struct {
 		int duration;
 		int flags;
 		const char *name;
 	} tests[] = {
-		{ 30, TEST_VBLANK | TEST_CHECK_TS, "wf_vblank-ts-check" },
-		{ 30, TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_CHECK_TS,
+		{ 3, TEST_VBLANK | TEST_CHECK_TS, "wf_vblank-ts-check" },
+		{ 3, TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_CHECK_TS,
 					"blocking-wf_vblank" },
-		{ 30,  TEST_VBLANK | TEST_VBLANK_ABSOLUTE,
+		{ 3, TEST_VBLANK | TEST_VBLANK_ABSOLUTE,
 					"absolute-wf_vblank" },
-		{ 30,  TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_VBLANK_ABSOLUTE,
+		{ 3, TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_VBLANK_ABSOLUTE,
 					"blocking-absolute-wf_vblank" },
-		{ 10, TEST_FLIP | TEST_BASIC, "plain-flip" },
-		{ 30, TEST_FLIP | TEST_EBUSY , "busy-flip" },
-		{ 30, TEST_FLIP | TEST_FENCE_STRESS , "flip-vs-fences" },
-		{ 30, TEST_FLIP | TEST_CHECK_TS, "plain-flip-ts-check" },
-		{ 30, TEST_FLIP | TEST_CHECK_TS | TEST_FB_RECREATE,
+		{ 3, TEST_FLIP | TEST_BASIC, "plain-flip" },
+		{ 3, TEST_FLIP | TEST_EBUSY , "busy-flip" },
+		{ 3, TEST_FLIP | TEST_FENCE_STRESS , "flip-vs-fences" },
+		{ 3, TEST_FLIP | TEST_CHECK_TS, "plain-flip-ts-check" },
+		{ 3, TEST_FLIP | TEST_CHECK_TS | TEST_FB_RECREATE,
 			"plain-flip-fb-recreate" },
-		{ 30, TEST_FLIP | TEST_RMFB | TEST_MODESET , "flip-vs-rmfb" },
-		{ 20, TEST_FLIP | TEST_DPMS | TEST_EINVAL | TEST_BASIC, "flip-vs-dpms" },
-		{ 30,  TEST_FLIP | TEST_PAN, "flip-vs-panning" },
-		{ 20, TEST_FLIP | TEST_MODESET | TEST_EINVAL | TEST_BASIC, "flip-vs-modeset" },
-		{ 30,  TEST_FLIP | TEST_VBLANK_EXPIRED_SEQ,
+		{ 3, TEST_FLIP | TEST_RMFB | TEST_MODESET , "flip-vs-rmfb" },
+		{ 3, TEST_FLIP | TEST_DPMS | TEST_EINVAL | TEST_BASIC, "flip-vs-dpms" },
+		{ 3, TEST_FLIP | TEST_PAN, "flip-vs-panning" },
+		{ 3, TEST_FLIP | TEST_MODESET | TEST_EINVAL | TEST_BASIC, "flip-vs-modeset" },
+		{ 3, TEST_FLIP | TEST_VBLANK_EXPIRED_SEQ,
 					"flip-vs-expired-vblank" },
 
-		{ 30, TEST_FLIP | TEST_VBLANK | TEST_VBLANK_ABSOLUTE |
-		      TEST_CHECK_TS, "flip-vs-absolute-wf_vblank" },
-		{ 10, TEST_FLIP | TEST_VBLANK | TEST_CHECK_TS | TEST_BASIC,
+		{ 3, TEST_FLIP | TEST_VBLANK | TEST_VBLANK_ABSOLUTE |
+		  TEST_CHECK_TS, "flip-vs-absolute-wf_vblank" },
+		{ 3, TEST_FLIP | TEST_VBLANK | TEST_CHECK_TS | TEST_BASIC,
 					"flip-vs-wf_vblank" },
-		{ 30, TEST_FLIP | TEST_VBLANK | TEST_VBLANK_BLOCK |
-			TEST_CHECK_TS, "flip-vs-blocking-wf-vblank" },
-		{ 30, TEST_FLIP | TEST_MODESET | TEST_HANG | TEST_NOEVENT, "flip-vs-modeset-vs-hang" },
-		{ 30, TEST_FLIP | TEST_PAN | TEST_HANG, "flip-vs-panning-vs-hang" },
-		{ 1, TEST_FLIP | TEST_EINVAL | TEST_FB_BAD_TILING, "flip-vs-bad-tiling" },
+		{ 3, TEST_FLIP | TEST_VBLANK | TEST_VBLANK_BLOCK |
+		  TEST_CHECK_TS, "flip-vs-blocking-wf-vblank" },
+		{ 3, TEST_FLIP | TEST_MODESET | TEST_HANG | TEST_NOEVENT, "flip-vs-modeset-vs-hang" },
+		{ 3, TEST_FLIP | TEST_PAN | TEST_HANG, "flip-vs-panning-vs-hang" },
+		{ 3, TEST_FLIP | TEST_EINVAL | TEST_FB_BAD_TILING, "flip-vs-bad-tiling" },
 
-		{ 1, TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP,
+		{ 0, TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP,
 					"flip-vs-dpms-off-vs-modeset" },
-		{ 1, TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP | TEST_SINGLE_BUFFER,
+		{ 0, TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP | TEST_SINGLE_BUFFER,
 					"single-buffer-flip-vs-dpms-off-vs-modeset" },
-		{ 30, TEST_FLIP | TEST_NO_2X_OUTPUT | TEST_DPMS_OFF_OTHERS , "dpms-off-confusion" },
+		{ 0, TEST_FLIP | TEST_NO_2X_OUTPUT | TEST_DPMS_OFF_OTHERS , "dpms-off-confusion" },
 		{ 0, TEST_ENOENT | TEST_NOEVENT, "nonexisting-fb" },
-		{ 10, TEST_DPMS_OFF | TEST_DPMS | TEST_VBLANK_RACE, "dpms-vs-vblank-race" },
-		{ 10, TEST_MODESET | TEST_VBLANK_RACE, "modeset-vs-vblank-race" },
+		{ 3, TEST_DPMS_OFF | TEST_DPMS | TEST_VBLANK_RACE, "dpms-vs-vblank-race" },
+		{ 3, TEST_MODESET | TEST_VBLANK_RACE, "modeset-vs-vblank-race" },
 		{ 0, TEST_BO_TOOBIG | TEST_NO_2X_OUTPUT, "bo-too-big" },
 	};
 	int i;
 
-	igt_subtest_init(argc, argv);
+	igt_subtest_init_parse_opts(&argc, argv, "", long_options, help_str,
+				    opt_handler, NULL);
 
 	igt_fixture {
 		drm_fd = drm_open_driver_master(DRIVER_ANY);
@@ -1595,7 +1638,7 @@ int main(int argc, char **argv)
 		igt_subtest_f("%s%s",
 			      tests[i].flags & TEST_BASIC ? "basic-" : "",
 			      tests[i].name)
-			run_test(tests[i].duration, tests[i].flags);
+			run_test(max(opt.duration, tests[i].duration), tests[i].flags);
 
 		if (tests[i].flags & TEST_NO_2X_OUTPUT)
 			continue;
@@ -1605,7 +1648,7 @@ int main(int argc, char **argv)
 			continue;
 
 		igt_subtest_f( "2x-%s", tests[i].name)
-			run_pair(tests[i].duration, tests[i].flags);
+			run_pair(max(opt.duration, tests[i].duration), tests[i].flags);
 	}
 
 	igt_fork_signal_helper();
@@ -1617,7 +1660,7 @@ int main(int argc, char **argv)
 			continue;
 
 		igt_subtest_f( "%s-interruptible", tests[i].name)
-			run_test(tests[i].duration, tests[i].flags);
+			run_test(max(opt.duration, tests[i].duration), tests[i].flags);
 
 		if (tests[i].flags & TEST_NO_2X_OUTPUT)
 			continue;
@@ -1627,7 +1670,7 @@ int main(int argc, char **argv)
 			continue;
 
 		igt_subtest_f( "2x-%s-interruptible", tests[i].name)
-			run_pair(tests[i].duration, tests[i].flags);
+			run_pair(max(opt.duration, tests[i].duration), tests[i].flags);
 	}
 	igt_stop_signal_helper();
 
@@ -1635,6 +1678,5 @@ int main(int argc, char **argv)
 	 * Let drm_fd leak, since it's needed by the dpms restore
 	 * exit_handler and igt_exit() won't return.
 	 */
-
 	igt_exit();
 }
-- 
2.7.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-08-09 10:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 10:12 [igt-dev] [PATCH i-g-t v3 0/2] tests/kms_flip: Binary mode optimizations Mika Kahola
2018-08-09 10:12 ` Mika Kahola [this message]
2018-08-09 10:20   ` [igt-dev] [PATCH i-g-t v3 1/2] tests/kms_flip: Set duration for subtest from command line Chris Wilson
2018-08-09 11:29     ` Mika Kahola
2018-11-08 11:47   ` Maarten Lankhorst
2018-11-08 12:45     ` Kahola, Mika
2018-11-08 13:11       ` Maarten Lankhorst
2018-11-08 14:41         ` Kahola, Mika
2018-08-09 10:12 ` [igt-dev] [PATCH i-g-t v3 2/2] tests/kms_flip: Change 2x tests execution order Mika Kahola
2018-11-08 11:16   ` Maarten Lankhorst
2018-08-09 11:09 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_flip: Binary mode optimizations (rev4) Patchwork
2018-08-09 12:21 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=1533809554-27925-2-git-send-email-mika.kahola@intel.com \
    --to=mika.kahola@intel.com \
    --cc=igt-dev@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.