All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nidhi Gupta <nidhi1.gupta@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Nidhi Gupta <nidhi1.gupta@intel.com>
Subject: [igt-dev] [PATCH 1/2] tests/kms_writeback: Convert tests to dynamic
Date: Thu, 22 Sep 2022 06:28:18 +0530	[thread overview]
Message-ID: <20220922005819.25253-2-nidhi1.gupta@intel.com> (raw)
In-Reply-To: <20220922005819.25253-1-nidhi1.gupta@intel.com>

Convert the existing subtests to dynamic subtests.

Signed-off-by: Nidhi Gupta <nidhi1.gupta@intel.com>
---
 tests/kms_writeback.c | 57 +++++++++++++++++++++++++++++++------------
 1 file changed, 42 insertions(+), 15 deletions(-)

diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
index 9d134585..3781fa34 100644
--- a/tests/kms_writeback.c
+++ b/tests/kms_writeback.c
@@ -214,32 +214,38 @@ static void test_invalid_parameters(igt_output_t *output, igt_fb_t *valid_fb, ig
 		uint32_t fb_id;
 		bool ptr_valid;
 		int32_t *out_fence_ptr;
+		const char *name;
 	} invalid_tests[] = {
 		{
 			/* No output buffer, but the WRITEBACK_OUT_FENCE_PTR set. */
 			.fb_id = 0,
 			.ptr_valid = true,
 			.out_fence_ptr = &out_fence,
+			.name = "WRITEBACK_OUT_FENCE_PTR-set",
 		},
 		{
 			/* Invalid output buffer. */
 			.fb_id = invalid_fb->fb_id,
 			.ptr_valid = true,
 			.out_fence_ptr = &out_fence,
+			.name = "Invalid-output-buffer",
 		},
 		{
 			/* Invalid WRITEBACK_OUT_FENCE_PTR. */
 			.fb_id = valid_fb->fb_id,
 			.ptr_valid = false,
 			.out_fence_ptr = (int32_t *)0x8,
+			.name = "Invalid-WRITEBACK_OUT_FENCE_PTR",
 		},
 	};
 
 	for (i = 0; i < ARRAY_SIZE(invalid_tests); i++) {
-		ret = do_writeback_test(output, invalid_tests[i].fb_id,
-					invalid_tests[i].out_fence_ptr,
-					invalid_tests[i].ptr_valid);
-		igt_assert(ret != 0);
+		igt_dynamic_f("%s", invalid_tests[i].name) {
+			ret = do_writeback_test(output, invalid_tests[i].fb_id,
+						invalid_tests[i].out_fence_ptr,
+						invalid_tests[i].ptr_valid);
+			igt_assert(ret != 0);
+		}
 	}
 }
 
@@ -247,18 +253,39 @@ static void writeback_fb_id(igt_output_t *output, igt_fb_t *valid_fb, igt_fb_t *
 {
 
 	int ret;
+	struct {
+		const char *name;
+		uint32_t fb_id;
+		int i, expected_ret;
+	} fb_id_tests[] = {
 
-	/* Invalid object for WRITEBACK_FB_ID */
-	ret = do_writeback_test(output, output->id, NULL, false);
-	igt_assert(ret == -EINVAL);
+		{
+			.name = "Invalid-object",
+			.fb_id = output->id,
+			.expected_ret = -EINVAL,
+		},
+
+		{
+			.name = "Zero-WRITEBACK_FB_ID",
+			.fb_id = 0,
+			.expected_ret = 0,
+		},
+
+		{
+			.name = "Valid-output-buffer",
+			.fb_id = valid_fb->fb_id,
+			.expected_ret = 0,
+		},
+	};
+
+	for (int i = 0; i < ARRAY_SIZE(fb_id_tests); i++) {
+		igt_dynamic_f("%s", fb_id_tests[i].name) {
+			ret = do_writeback_test(output, fb_id_tests[i].fb_id, NULL, false);
+			igt_assert(ret == fb_id_tests[i].expected_ret);
+		}
+	}
 
-	/* Zero WRITEBACK_FB_ID */
-	ret = do_writeback_test(output, 0, NULL, false);
-	igt_assert(ret == 0);
 
-	/* Valid output buffer */
-	ret = do_writeback_test(output, valid_fb->fb_id, NULL, false);
-	igt_assert(ret == 0);
 }
 
 static void fill_fb(igt_fb_t *fb, uint32_t pixel)
@@ -553,7 +580,7 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 	igt_describe("Writeback has a couple of parameters linked together"
 		     "(output framebuffer and fence); this test goes through"
 		     "the combination of possible bad options");
-	igt_subtest("writeback-invalid-parameters") {
+	igt_subtest_with_dynamic("writeback-invalid-parameters") {
 		igt_fb_t invalid_output_fb;
 
 		igt_skip_on(data.dump_check || data.list_modes);
@@ -570,7 +597,7 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 	}
 
 	igt_describe("Validate WRITEBACK_FB_ID with valid and invalid options");
-	igt_subtest("writeback-fb-id") {
+	igt_subtest_with_dynamic("writeback-fb-id") {
 		igt_fb_t output_fb;
 
 		igt_skip_on(data.dump_check || data.list_modes);
-- 
2.36.0

  reply	other threads:[~2022-09-22  1:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22  0:58 [igt-dev] [PATCH 0/2] tests/kms_writeback: Test cleanup Nidhi Gupta
2022-09-22  0:58 ` Nidhi Gupta [this message]
2022-09-22 10:18   ` [igt-dev] [PATCH 1/2] tests/kms_writeback: Convert tests to dynamic Modem, Bhanuprakash
2022-09-22  0:58 ` [igt-dev] [PATCH 2/2] tests/kms_writeback: Test cleanup Nidhi Gupta
2022-09-22 10:02   ` Modem, Bhanuprakash
2022-09-22 13:22 ` [igt-dev] ✗ Fi.CI.BUILD: failure for tests/kms_writeback: Test Cleanup (rev3) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2022-09-08  8:48 [igt-dev] [PATCH 0/2] tests/kms_writeback: Test cleanup Nidhi Gupta
2022-09-08  8:48 ` [igt-dev] [PATCH 1/2] tests/kms_writeback: Convert tests to dynamic Nidhi Gupta
2022-09-08 18:03   ` Jessica Zhang
2022-08-25 21:06 [igt-dev] [PATCH 0/2] tests/kms_writeback: Test Cleanup Nidhi Gupta
2022-08-25 21:06 ` [igt-dev] [PATCH 1/2] tests/kms_writeback: Convert tests to dynamic Nidhi Gupta
2022-08-26 18:15   ` Jessica Zhang

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=20220922005819.25253-2-nidhi1.gupta@intel.com \
    --to=nidhi1.gupta@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.