Skip to contentSkip to conversation

tests/kms_writeback: Test cleanup

PATCH New Nidhi Gupta 2 participants 5 messages Sep 27, 2022 – Sep 28, 2022

lore
Share & tools
lore
#0 lore raw

cover tests/kms_writeback: Test cleanup

From: Jeevan B <[email protected]>

*** BLURB HERE ***

Nidhi Gupta (2):
tests/kms_writeback: Test cleanup
tests/kms_writeback: Convert tests to dynamic

 tests/kms_writeback.c | 63 ++++++++++++++++++++++++++++---------------
 1 file changed, 42 insertions(+), 21 deletions(-)
Signature · 1 line
2.36.0
#1 lore raw

PATCH 1/2 tests/kms_writeback: Test cleanup

Sanitize the system state before starting the subtest.

---
 tests/kms_writeback.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
tests/kms_writeback.c +3 -5
index 9d134585..708fa5cd 100644
@@ -494,10 +494,12 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 
 		kmstest_set_vt_graphics_mode();
 
-		igt_display_require(&display, display.drm_fd);
+		igt_display_reset(display);
 
 		igt_require(display.is_atomic);
 
+		igt_skip_on(data.dump_check || data.list_modes);
+
 		output = kms_writeback_get_output(&display);
 		igt_require(output);
 
@@ -533,7 +535,6 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 		drmModePropertyBlobRes *formats_blob;
 		const char *valid_chars;
 
-		igt_skip_on(data.dump_check || data.list_modes);
 		formats_blob = get_writeback_formats_blob(output);
 		valid_chars = "01234568 ABCGNRUVXY";
 
@@ -556,7 +557,6 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 	igt_subtest("writeback-invalid-parameters") {
 		igt_fb_t invalid_output_fb;
 
-		igt_skip_on(data.dump_check || data.list_modes);
 		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay / 2,
 				      mode.vdisplay / 2,
 				      DRM_FORMAT_XRGB8888,
@@ -573,7 +573,6 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 	igt_subtest("writeback-fb-id") {
 		igt_fb_t output_fb;
 
-		igt_skip_on(data.dump_check || data.list_modes);
 		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
 				      DRM_FORMAT_XRGB8888,
 				      DRM_FORMAT_MOD_LINEAR,
@@ -589,7 +588,6 @@ igt_main_args("b:c:dl", long_options, help_str, opt_handler, NULL)
 	igt_subtest("writeback-check-output") {
 		igt_fb_t output_fb;
 
-		igt_skip_on(data.dump_check || data.list_modes);
 		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
 				      DRM_FORMAT_XRGB8888,
 				      igt_fb_mod_to_tiling(0),
Signature · 1 line
2.36.0
#2 lore raw

PATCH 2/2 tests/kms_writeback: Convert tests to dynamic

In reply to Nidhi Gupta

Convert the existing subtests to dynamic subtests.

---
 tests/kms_writeback.c | 55 ++++++++++++++++++++++++++++++-------------
 1 file changed, 39 insertions(+), 16 deletions(-)
tests/kms_writeback.c +39 -16
index 708fa5cd..5159ff7b 100644
@@ -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,35 @@ 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);
-
-	/* Zero WRITEBACK_FB_ID */
-	ret = do_writeback_test(output, 0, NULL, false);
-	igt_assert(ret == 0);
+		{
+			.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,
+		},
+	};
 
-	/* Valid output buffer */
-	ret = do_writeback_test(output, valid_fb->fb_id, NULL, false);
-	igt_assert(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);
+		}
+	}
 }
 
 static void fill_fb(igt_fb_t *fb, uint32_t pixel)
@@ -554,7 +577,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;
 
 		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay / 2,
@@ -570,7 +593,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;
 
 		fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
Signature · 1 line
2.36.0
#3 lore raw

[igt-dev] ✗ Fi.CI.BUILD: failure for tests/kms_writeback: Test Cleanup (rev4)

In reply to Nidhi Gupta
== Series Details ==

== Series Details ==

Series: tests/kms_writeback: Test Cleanup (rev4)
URL : https://patchwork.freedesktop.org/series/107764/
State : failure

== Summary ==

IGT patchset build failed on latest successful build 5e232c77cd762147e0882c337a984121fabb1c75 tests/kms_chamelium: Fix common suspend/hibernate

#4 lore raw

[igt-dev] ✗ Fi.CI.BUILD: failure for tests/kms_writeback: Test Cleanup (rev5)

In reply to Nidhi Gupta
== Series Details ==

== Series Details ==

Series: tests/kms_writeback: Test Cleanup (rev5)
URL : https://patchwork.freedesktop.org/series/107764/
State : failure

== Summary ==

IGT patchset build failed on latest successful build 5f29c9369550164b35b65baaaeba4b370f434cf1 i915/gem_spin_batch: Typo fix

ninja: Entering directory `-j1'
ninja: fatal: chdir to '-j1' - No such file or directory