All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [v3 1/6] tests/kms_pipe_crc_basic: Convert tests to dynamic
Date: Tue, 10 May 2022 13:31:58 +0530	[thread overview]
Message-ID: <20220510080203.3319182-2-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20220510080203.3319182-1-bhanuprakash.modem@intel.com>

Convert the existing subtests to dynamic subtests at pipe level.

V2:
* Fix typos: s/hand/hang/, s/TEST_NONE/TEST_BASIC, etc..

Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_pipe_crc_basic.c | 111 ++++++++++++++++++++++---------------
 1 file changed, 65 insertions(+), 46 deletions(-)

diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 0861c46d..9b3fecee 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -59,8 +59,13 @@ static void test_bad_source(data_t *data)
 
 #define N_CRCS	3
 
-#define TEST_SEQUENCE (1<<0)
-#define TEST_NONBLOCK (1<<1)
+enum {
+	TEST_BASIC = 0,
+	TEST_SEQUENCE = 1 << 0,
+	TEST_NONBLOCK = 1 << 1,
+	TEST_SUSPEND = 1 << 2,
+	TEST_HANG = 1 << 3,
+};
 
 static void test_read_crc(data_t *data, enum pipe pipe, unsigned flags)
 {
@@ -270,6 +275,25 @@ data_t data = {0, };
 igt_main
 {
 	enum pipe pipe;
+	struct {
+		const char *name;
+		unsigned flags;
+		const char *desc;
+	} tests[] = {
+		{ "read-crc", TEST_BASIC,
+			"Test for pipe CRC reads." },
+		{ "read-crc-frame-sequence", TEST_SEQUENCE,
+			"Tests the pipe CRC read and ensure frame sequence." },
+		{ "nonblocking-crc", TEST_NONBLOCK,
+			"Test for O_NONBLOCK CRC reads." },
+		{ "nonblocking-crc-frame-sequence", TEST_SEQUENCE | TEST_NONBLOCK,
+			"Test for O_NONBLOCK CRC reads and ensure frame sequence." },
+		{ "suspend-read-crc", TEST_SUSPEND,
+			"Suspend test for pipe CRC reads." },
+		{ "hang-read-crc", TEST_HANG,
+			"Hang test for pipe CRC read." },
+	};
+	int i;
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
@@ -286,54 +310,49 @@ igt_main
 	igt_subtest("bad-source")
 		test_bad_source(&data);
 
-	for_each_pipe_static(pipe) {
-		igt_describe("Test for pipe CRC reads.");
-		igt_subtest_f("read-crc-pipe-%s", kmstest_pipe_name(pipe))
-			test_read_crc(&data, pipe, 0);
-
-		igt_describe("Tests the pipe CRC read and ensure frame sequence.");
-		igt_subtest_f("read-crc-pipe-%s-frame-sequence", kmstest_pipe_name(pipe))
-			test_read_crc(&data, pipe, TEST_SEQUENCE);
-
-		igt_describe("Test for O_NONBLOCK CRC reads.");
-		igt_subtest_f("nonblocking-crc-pipe-%s", kmstest_pipe_name(pipe))
-			test_read_crc(&data, pipe, TEST_NONBLOCK);
-
-		igt_describe("Test for O_NONBLOCK CRC reads and ensure frame sequence.");
-		igt_subtest_f("nonblocking-crc-pipe-%s-frame-sequence", kmstest_pipe_name(pipe))
-			test_read_crc(&data, pipe, TEST_SEQUENCE | TEST_NONBLOCK);
-
-		igt_describe("Suspend test for pipe CRC reads");
-		igt_subtest_f("suspend-read-crc-pipe-%s", kmstest_pipe_name(pipe)) {
-			test_read_crc(&data, pipe, 0);
-
-			igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
-						      SUSPEND_TEST_NONE);
-
-			test_read_crc(&data, pipe, 0);
+	for (i = 0; i < ARRAY_SIZE(tests); i++) {
+		igt_describe(tests[i].desc);
+		igt_subtest_with_dynamic(tests[i].name) {
+			for_each_pipe(&data.display, pipe) {
+				igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe)) {
+					if (tests[i].flags & TEST_SUSPEND) {
+						test_read_crc(&data, pipe, 0);
+
+						igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
+									      SUSPEND_TEST_NONE);
+
+						test_read_crc(&data, pipe, 0);
+					} else if (tests[i].flags & TEST_SUSPEND) {
+						igt_hang_t hang = igt_allow_hang(data.drm_fd, 0, 0);
+
+						test_read_crc(&data, pipe, 0);
+						igt_force_gpu_reset(data.drm_fd);
+						test_read_crc(&data, pipe, 0);
+
+						igt_disallow_hang(data.drm_fd, hang);
+					} else {
+						test_read_crc(&data, pipe, tests[i].flags);
+					}
+				}
+			}
 		}
+	}
 
-		igt_describe("Check that disabling CRCs on a CRTC after having disabled the CRTC "
-			     "does not cause issues.");
-		igt_subtest_f("disable-crc-after-crtc-pipe-%s", kmstest_pipe_name(pipe))
-			test_disable_crc_after_crtc(&data, pipe);
-
-		igt_describe("Hang test for pipe CRC read");
-		igt_subtest_f("hang-read-crc-pipe-%s", kmstest_pipe_name(pipe)) {
-			igt_hang_t hang = igt_allow_hang(data.drm_fd, 0, 0);
-
-			test_read_crc(&data, pipe, 0);
-
-			igt_force_gpu_reset(data.drm_fd);
-
-			test_read_crc(&data, pipe, 0);
-
-			igt_disallow_hang(data.drm_fd, hang);
+	igt_describe("Check that disabling CRCs on a CRTC after having disabled the CRTC "
+		     "does not cause issues.");
+	igt_subtest_with_dynamic("disable-crc-after-crtc") {
+		for_each_pipe(&data.display, pipe) {
+			igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe))
+				test_disable_crc_after_crtc(&data, pipe);
 		}
+	}
 
-		igt_describe("Basic sanity check for CRC mismatches");
-		igt_subtest_f("compare-crc-sanitycheck-pipe-%s", kmstest_pipe_name(pipe))
-			test_compare_crc(&data, pipe);
+	igt_describe("Basic sanity check for CRC mismatches");
+	igt_subtest_with_dynamic("compare-crc-sanitycheck") {
+		for_each_pipe(&data.display, pipe) {
+			igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe))
+				test_compare_crc(&data, pipe);
+		}
 	}
 
 	igt_fixture {
-- 
2.35.1

  reply	other threads:[~2022-05-10  8:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10  8:01 [igt-dev] [v3 0/6] Convert subtests to dynamic Bhanuprakash Modem
2022-05-10  8:01 ` Bhanuprakash Modem [this message]
2022-05-10  8:01 ` [igt-dev] [v3 2/6] tests/kms_cursor_legacy: Convert tests " Bhanuprakash Modem
2022-05-10  8:02 ` [igt-dev] [v3 3/6] tests/kms_cursor_edge_walk: " Bhanuprakash Modem
2022-05-10  8:02 ` [igt-dev] [v3 4/6] tests/kms_cursor_crc: " Bhanuprakash Modem
2022-05-10  8:02 ` [igt-dev] [v3 5/6] tests/kms_color: " Bhanuprakash Modem
2022-05-11  2:10   ` Bhanuprakash Modem
2022-05-10  8:02 ` [igt-dev] [v3 6/6] tests/intel-ci: Rename tests in BAT Bhanuprakash Modem
2022-05-10  9:04 ` [igt-dev] ✓ Fi.CI.BAT: success for Convert subtests to dynamic (rev4) Patchwork
2022-05-10 16:35 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-05-11  3:00 ` [igt-dev] ✗ Fi.CI.BAT: failure for Convert subtests to dynamic (rev5) Patchwork
2022-05-11  4:30   ` Modem, Bhanuprakash
2022-05-11 23:03     ` Vudum, Lakshminarayana
2022-05-11 15:17 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2022-05-11 18:27 ` [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=20220510080203.3319182-2-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@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.