[igt-dev] [PATCH i-g-t v2 1/2] tests/kms_flip: Set duration for subtest from command line
Mika Kahola
mika.kahola at intel.com
Wed Jun 13 11:30:37 UTC 2018
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 0 seconds meaning that the subtest is run only once.
The patch reduces the kms_flip binary mode execution time on Geminilake from
1189 seconds down to 307 seconds with default subtest duration.
No functional changes on subtests.
Signed-off-by: Mika Kahola <mika.kahola at intel.com>
---
tests/kms_flip.c | 113 +++++++++++++++++++++++++++++++++++++------------------
1 file changed, 77 insertions(+), 36 deletions(-)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 3d6fe94..09aaac2 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;
@@ -1518,56 +1527,89 @@ 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,
+ { TEST_VBLANK | TEST_CHECK_TS, "wf_vblank-ts-check" },
+ { TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_CHECK_TS,
"blocking-wf_vblank" },
- { 30, TEST_VBLANK | TEST_VBLANK_ABSOLUTE,
+ { TEST_VBLANK | TEST_VBLANK_ABSOLUTE,
"absolute-wf_vblank" },
- { 30, TEST_VBLANK | TEST_VBLANK_BLOCK | TEST_VBLANK_ABSOLUTE,
+ { 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,
+ { TEST_FLIP | TEST_BASIC, "plain-flip" },
+ { TEST_FLIP | TEST_EBUSY , "busy-flip" },
+ { TEST_FLIP | TEST_FENCE_STRESS , "flip-vs-fences" },
+ { TEST_FLIP | TEST_CHECK_TS, "plain-flip-ts-check" },
+ { 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,
+ { TEST_FLIP | TEST_RMFB | TEST_MODESET , "flip-vs-rmfb" },
+ { TEST_FLIP | TEST_DPMS | TEST_EINVAL | TEST_BASIC, "flip-vs-dpms" },
+ { TEST_FLIP | TEST_PAN, "flip-vs-panning" },
+ { TEST_FLIP | TEST_MODESET | TEST_EINVAL | TEST_BASIC, "flip-vs-modeset" },
+ { 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,
+ { TEST_FLIP | TEST_VBLANK | TEST_VBLANK_ABSOLUTE |
+ TEST_CHECK_TS, "flip-vs-absolute-wf_vblank" },
+ { 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" },
+ { TEST_FLIP | TEST_VBLANK | TEST_VBLANK_BLOCK |
+ TEST_CHECK_TS, "flip-vs-blocking-wf-vblank" },
+ { TEST_FLIP | TEST_MODESET | TEST_HANG | TEST_NOEVENT, "flip-vs-modeset-vs-hang" },
+ { TEST_FLIP | TEST_PAN | TEST_HANG, "flip-vs-panning-vs-hang" },
+ { TEST_FLIP | TEST_EINVAL | TEST_FB_BAD_TILING, "flip-vs-bad-tiling" },
- { 1, TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP,
+ { TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP,
"flip-vs-dpms-off-vs-modeset" },
- { 1, TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP | TEST_SINGLE_BUFFER,
+ { 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_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" },
- { 0, TEST_BO_TOOBIG | TEST_NO_2X_OUTPUT, "bo-too-big" },
+ { TEST_FLIP | TEST_NO_2X_OUTPUT | TEST_DPMS_OFF_OTHERS , "dpms-off-confusion" },
+ { TEST_ENOENT | TEST_NOEVENT, "nonexisting-fb" },
+ { TEST_DPMS_OFF | TEST_DPMS | TEST_VBLANK_RACE, "dpms-vs-vblank-race" },
+ { TEST_MODESET | TEST_VBLANK_RACE, "modeset-vs-vblank-race" },
+ { 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);
@@ -1592,7 +1634,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(opt.duration, tests[i].flags);
if (tests[i].flags & TEST_NO_2X_OUTPUT)
continue;
@@ -1602,7 +1644,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(opt.duration, tests[i].flags);
}
igt_fork_signal_helper();
@@ -1614,7 +1656,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(opt.duration, tests[i].flags);
if (tests[i].flags & TEST_NO_2X_OUTPUT)
continue;
@@ -1624,7 +1666,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(opt.duration, tests[i].flags);
}
igt_stop_signal_helper();
@@ -1632,6 +1674,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
More information about the igt-dev
mailing list