Igt-dev Archive on 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 3/3] tests/i915/i915_pm_backlight: Create dynamic subtests
Date: Tue, 15 Nov 2022 11:46:02 +0530	[thread overview]
Message-ID: <1668492962-3418-4-git-send-email-nidhi1.gupta@intel.com> (raw)
In-Reply-To: <1668492962-3418-1-git-send-email-nidhi1.gupta@intel.com>

-Modified the test to include dynamic subtests.
-Replaced all asserts and igt_require inside
 dynamic subtests, as skip is not allowed in
 dynamic structure.

Signed-off-by: Nidhi Gupta <nidhi1.gupta@intel.com>
---
 tests/i915/i915_pm_backlight.c | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/tests/i915/i915_pm_backlight.c b/tests/i915/i915_pm_backlight.c
index 41ec215..ab2787c 100644
--- a/tests/i915/i915_pm_backlight.c
+++ b/tests/i915/i915_pm_backlight.c
@@ -165,20 +165,25 @@ static void test_fade(struct context *context)
 	}
 }
 
-static void
+static int
 check_dpms(igt_output_t *output)
 {
-	igt_require(igt_setup_runtime_pm(output->display->drm_fd));
+	if ((igt_setup_runtime_pm(output->display->drm_fd)) == 0)
+		return -errno;
 
 	kmstest_set_connector_dpms(output->display->drm_fd,
 				   output->config.connector,
 				   DRM_MODE_DPMS_OFF);
-	igt_require(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+	if ((igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED)) == 0)
+		return -errno;
 
 	kmstest_set_connector_dpms(output->display->drm_fd,
 				   output->config.connector,
 				   DRM_MODE_DPMS_ON);
-	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE));
+	if ((igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE)) == 0)
+		return -errno;
+
+	return 1;
 }
 
 static void
@@ -227,7 +232,7 @@ static void test_setup(igt_display_t display, igt_output_t *output)
 igt_main
 {
 	int old[NUM_EDP_OUTPUTS], fd;
-	int i = 0;
+	int i = 0, ret = 0;
 	igt_display_t display;
 	igt_output_t *output;
 	char file_path_n[PATH_MAX] = "";
@@ -303,24 +308,29 @@ igt_main
 
 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
 		igt_describe(tests[i].desc);
-		igt_subtest(tests[i].name) {
+		igt_subtest_with_dynamic(tests[i].name) {
 			for (int j = 0; j < (dual_edp ? 2 : 1); j++) {
 				test_setup(display, &contexts->output[j]);
 
 				if (backlight_read(&old[j], "brightness", &contexts[j]))
 					continue;
 
-				if (tests[i].flags == TEST_DPMS)
-					check_dpms(contexts[j].output);
+				if (tests[i].flags == TEST_DPMS) {
+					ret = check_dpms(contexts[j].output);
+					if (ret == 0)
+						continue;
+				}
 
 				if (tests[i].flags == TEST_SUSPEND)
 					check_suspend(contexts[j].output);
 
-				igt_assert(backlight_read(&contexts[j].max, "max_brightness", &contexts[j]) > -1);
-				tests[i].test_t(&contexts[j]);
+				igt_dynamic_f("%s", igt_output_name(contexts[j].output)) {
+					igt_assert(backlight_read(&contexts[j].max, "max_brightness", &contexts[j]) > -1);
+					tests[i].test_t(&contexts[j]);
+				}
+				test_cleanup(&display, output);
 			}
-
-			test_cleanup(&display, output);
+			/* TODO: Add tests for dual eDP. */
 		}
 	}
 
-- 
1.9.1

  parent reply	other threads:[~2022-11-15  6:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  6:15 [igt-dev] [PATCH 0/3] Add new subtest and test cleanup Nidhi Gupta
2022-11-15  6:16 ` [igt-dev] [PATCH 1/3] tests/i915/i915_pm_backlight: Add new subtest to validate dual panel backlight Nidhi Gupta
2022-11-15 10:54   ` Hogander, Jouni
2022-11-15  6:16 ` [igt-dev] [PATCH 2/3] tests/i915/i915_pm_backlight: Add a common structure for all subtests Nidhi Gupta
2022-11-15 10:14   ` Hogander, Jouni
2022-11-15  6:16 ` Nidhi Gupta [this message]
2022-11-15 10:49   ` [igt-dev] [PATCH 3/3] tests/i915/i915_pm_backlight: Create dynamic subtests Hogander, Jouni
2022-11-15  6:51 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add new subtest and test cleanup (rev2) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2022-11-15 13:00 [igt-dev] [PATCH 0/3] Add new subtest and test cleanup Nidhi Gupta
2022-11-15 13:00 ` [igt-dev] [PATCH 3/3] tests/i915/i915_pm_backlight: Create dynamic subtests Nidhi Gupta
2022-11-15 14:46   ` Hogander, Jouni

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=1668492962-3418-4-git-send-email-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox