[igt-dev] [PATCH i-g-t] tests/i915/kms_legacy_colorkey: Create dynamic subtests

Mohammed Thasleem mohammed.thasleem at intel.com
Tue May 17 10:54:48 UTC 2022


Modified kms_legacy_colorkey to include dynamic test cases.

Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
---
 tests/i915/kms_legacy_colorkey.c | 50 ++++++++++++++++++++++----------
 1 file changed, 35 insertions(+), 15 deletions(-)

diff --git a/tests/i915/kms_legacy_colorkey.c b/tests/i915/kms_legacy_colorkey.c
index de9610a7..8c609d4f 100644
--- a/tests/i915/kms_legacy_colorkey.c
+++ b/tests/i915/kms_legacy_colorkey.c
@@ -38,33 +38,53 @@ static void test_plane(uint32_t plane_id, int expected_ret)
 	struct drm_intel_sprite_colorkey ckey = {
 		.plane_id = plane_id,
 	};
-
 	igt_assert(drmCommandWrite(drm_fd, DRM_I915_SET_SPRITE_COLORKEY, &ckey,
 				   sizeof(ckey)) == expected_ret);
 }
 
-igt_simple_main
+igt_main
 {
-	drm_fd = drm_open_driver_master(DRIVER_INTEL);
 
-	kmstest_set_vt_graphics_mode();
+	igt_fixture {
 
-	igt_display_require(&display, drm_fd);
+		drm_fd = drm_open_driver_master(DRIVER_INTEL);
 
-	for_each_pipe(&display, p) {
-		for_each_plane_on_pipe(&display, p, plane) {
-			bool is_valid = (plane->type == DRM_PLANE_TYPE_PRIMARY ||
-			                 plane->type == DRM_PLANE_TYPE_CURSOR);
-			test_plane(plane->drm_plane->plane_id,
-				   is_valid ? -ENOENT : 0);
+		kmstest_set_vt_graphics_mode();
 
-			max_id = max(max_id, plane->drm_plane->plane_id);
+		igt_display_require(&display, drm_fd);
+		for_each_pipe(&display, p) {
+			for_each_plane_on_pipe(&display, p, plane) {
+				max_id = max(max_id, plane->drm_plane->plane_id);
+			}
 		}
+
 	}
+	igt_describe("check valid and invalid plane ID's\n");
 
+	igt_subtest_with_dynamic("basic") {
+		for_each_pipe(&display, p) {
+			igt_dynamic_f("pipe-%s", kmstest_pipe_name(p)) {
+				for_each_plane_on_pipe(&display, p, plane) {
+					bool is_valid = (plane->type == DRM_PLANE_TYPE_PRIMARY ||
+							 plane->type == DRM_PLANE_TYPE_CURSOR);
+
+					test_plane(plane->drm_plane->plane_id,
+						   is_valid ? -ENOENT : 0);
+				}
+			}
+		}
+	}
 	/* try some invalid IDs too */
-	test_plane(0, -ENOENT);
-	test_plane(max_id + 1, -ENOENT);
+	igt_describe("check invalid plane id's zero and outrange\n");
+	igt_subtest_with_dynamic("invalid") {
+		igt_dynamic("zero")
+			test_plane(0, -ENOENT);
+		igt_dynamic("outrange")
+			test_plane(max_id + 1, -ENOENT);
+	}
 
-	igt_display_fini(&display);
+	igt_fixture {
+		igt_display_fini(&display);
+		close(drm_fd);
+	}
 }
-- 
2.25.1



More information about the igt-dev mailing list