Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pranay Samala <pranay.samala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: karthik.b.s@intel.com, sameer.lattannavar@intel.com,
	pranay.samala@intel.com
Subject: [PATCH i-g-t v3 2/3] tests/kms_hdr: Move test_fini() for proper cleanup
Date: Wed,  6 May 2026 09:45:26 +0530	[thread overview]
Message-ID: <20260506041527.56862-3-pranay.samala@intel.com> (raw)
In-Reply-To: <20260506041527.56862-1-pranay.samala@intel.com>

Move test_fini() out of individual test functions to right
after the igt_dynamic_f() block.

Previously, if an igt_require_f() or igt_assert() inside
the dynamic subtest caused a skip or failure, test_fini()
would never execute since the longjmp exits the dynamic block.
By placing test_fini() after igt_dynamic_f(), cleanup
(pipe_crc free, fb removal, display reset) is guaranteed to
run regardless of how the dynamic subtest exits.

v2:
- Remove cleanup label (Karthik)

v3:
- Rebase

Signed-off-by: Pranay Samala <pranay.samala@intel.com>
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
---
 tests/kms_hdr.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c
index 3cd14c074..ded375a23 100644
--- a/tests/kms_hdr.c
+++ b/tests/kms_hdr.c
@@ -236,8 +236,6 @@ static void test_bpc_switch_on_output(data_t *data, igt_crtc_t *crtc,
 
 	/* CRC capture is clamped to 8bpc, so capture should match. */
 	igt_assert_crc_equal(&ref_crc, &new_crc);
-
-	test_fini(data);
 }
 
 /* Returns true if an output supports max bpc property. */
@@ -299,6 +297,7 @@ static void test_bpc_switch(data_t *data, uint32_t flags)
 					      test_bpc_switch_on_output(data,
 								       crtc,
 								       output, hdr_test_formats[i], flags);
+				test_fini(data);
 			}
 
 			/* One pipe is enough */
@@ -384,7 +383,7 @@ static void test_static_toggle(data_t *data, igt_crtc_t *crtc,
 	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 	if (flags & TEST_INVALID_HDR) {
 		igt_assert_eq(system("dmesg|tail -n 1000|grep -E \"Unknown EOTF [0-9]+\""), 0);
-		goto cleanup;
+		return;
 	}
 
 	if (flags & TEST_BRIGHTNESS) {
@@ -419,9 +418,6 @@ static void test_static_toggle(data_t *data, igt_crtc_t *crtc,
 		igt_force_dsc_disable(data->fd, data->output->name);
 		igt_assert(igt_is_force_dsc_disabled(data->fd, data->output->name));
 	}
-
-cleanup:
-	test_fini(data);
 }
 
 static void test_static_swap(data_t *data, igt_crtc_t *crtc,
@@ -511,8 +507,6 @@ static void test_static_swap(data_t *data, igt_crtc_t *crtc,
 		igt_force_dsc_disable(data->fd, data->output->name);
 		igt_assert(igt_is_force_dsc_disabled(data->fd, data->output->name));
 	}
-
-	test_fini(data);
 }
 
 static void test_invalid_metadata_sizes(data_t *data)
@@ -526,8 +520,6 @@ static void test_invalid_metadata_sizes(data_t *data)
 	igt_assert_eq(set_invalid_hdr_output_metadata(data, &hdr, metadata_size + 1), -EINVAL);
 	igt_assert_eq(set_invalid_hdr_output_metadata(data, &hdr, metadata_size - 1), -EINVAL);
 	igt_assert_eq(set_invalid_hdr_output_metadata(data, &hdr, metadata_size * 2), -EINVAL);
-
-	test_fini(data);
 }
 
 static void test_hdr(data_t *data, uint32_t flags)
@@ -635,6 +627,8 @@ static void test_hdr(data_t *data, uint32_t flags)
 					if (flags & TEST_INVALID_METADATA_SIZES)
 						test_invalid_metadata_sizes(data);
 				}
+
+				test_fini(data);
 			}
 
 			/* One pipe is enough */
-- 
2.34.1


  parent reply	other threads:[~2026-05-06  4:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06  4:15 [PATCH i-g-t v3 0/3] Fix incorrect skips and improve cleanup Pranay Samala
2026-05-06  4:15 ` [PATCH i-g-t v3 1/3] tests/kms_hdr: Move framebuffer into data_t for centralized cleanup Pranay Samala
2026-05-06  4:15 ` Pranay Samala [this message]
2026-05-06  4:15 ` [PATCH i-g-t v3 3/3] tests/kms_hdr: Move capability checks inside dynamic subtests Pranay Samala
2026-05-06  4:50 ` ✓ i915.CI.BAT: success for Fix incorrect skips and improve cleanup (rev3) Patchwork
2026-05-06  4:54 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-06  7:00 ` ✗ i915.CI.Full: failure " Patchwork
2026-05-06  7:52 ` ✗ Xe.CI.FULL: " Patchwork
2026-05-06 12:54 ` ✓ i915.CI.Full: success " 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=20260506041527.56862-3-pranay.samala@intel.com \
    --to=pranay.samala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karthik.b.s@intel.com \
    --cc=sameer.lattannavar@intel.com \
    /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