Skip to contentSkip to conversation

kms_flip_event_leak: Create dynamic subtests

PATCH Superseded Jeevan B 2 participants 2 messages Sep 20, 2022

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Jeevan B

author
#0 lore raw

PATCH v3 1/1 kms_flip_event_leak: Create dynamic subtests

Converting the existing subtests to dynamic subtests.

v2: Add igt_dispaly_require_output and igt_display_reset and update the test name. (Bhanu)

---
 tests/kms_flip_event_leak.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
tests/kms_flip_event_leak.c +18 -11
index ac201293..99b1e345 100644
@@ -48,6 +48,7 @@ static void test(data_t *data, enum pipe pipe, igt_output_t *output)
 	struct igt_fb fb[2];
 	int fd, ret;
 
+	igt_display_reset(&data->display);
 	/* select the pipe we want to use */
 	igt_output_set_pipe(output, pipe);
 
@@ -89,24 +90,30 @@ static void test(data_t *data, enum pipe pipe, igt_output_t *output)
 	igt_remove_fb(data->drm_fd, &fb[0]);
 }
 
-igt_simple_main
+igt_main
 {
 	data_t data = {};
 	igt_output_t *output;
-	int valid_tests = 0;
 	enum pipe pipe;
 
-	data.drm_fd = drm_open_driver_master(DRIVER_ANY);
-	kmstest_set_vt_graphics_mode();
+	igt_fixture {
+		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		kmstest_set_vt_graphics_mode();
 
-	igt_display_require(&data.display, data.drm_fd);
-
-	for_each_pipe_with_valid_output(&data.display, pipe, output) {
-		test(&data, pipe, output);
-		valid_tests++;
+		igt_display_require(&data.display, data.drm_fd);
+		igt_display_require_output(&data.display);
 	}
 
-	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 
-	igt_display_fini(&data.display);
+	igt_subtest_with_dynamic("kms_flip_event_leak_basic") {
+		for_each_pipe_with_valid_output(&data.display, pipe, output) {
+			igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
+				test(&data, pipe, output);
+			}
+		}
+	}
+
+	igt_fixture {
+		igt_display_fini(&data.display);
+	}
 }
Signature · 1 line
2.36.0
#1 lore raw
Quoted 44 lines · Jeevan B

Converting the existing subtests to dynamic subtests.

v2: Add igt_dispaly_require_output and igt_display_reset and update the test name. (Bhanu)

---
 tests/kms_flip_event_leak.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
tests/kms_flip_event_leak.c +5 -7
index ac201293..99b1e345 100644
@@ -48,6 +48,7 @@ static void test(data_t *data, enum pipe pipe, igt_output_t *output)
 	struct igt_fb fb[2];
 	int fd, ret;
 
+	igt_display_reset(&data->display);
 	/* select the pipe we want to use */
 	igt_output_set_pipe(output, pipe);
 
@@ -89,24 +90,30 @@ static void test(data_t *data, enum pipe pipe, igt_output_t *output)
 	igt_remove_fb(data->drm_fd, &fb[0]);
 }
 
-igt_simple_main
+igt_main
 {
 	data_t data = {};
 	igt_output_t *output;
-	int valid_tests = 0;
 	enum pipe pipe;
 
-	data.drm_fd = drm_open_driver_master(DRIVER_ANY);
-	kmstest_set_vt_graphics_mode();
+	igt_fixture {
+		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		kmstest_set_vt_graphics_mode();
 
-	igt_display_require(&data.display, data.drm_fd);
-
-	for_each_pipe_with_valid_output(&data.display, pipe, output) {

tests/kms_flip_event_leak.c static void test(data_t *data, enum pipe pipe, igt_output_t *output) · line 108

Quoted 10 lines
tests/kms_flip_event_leak.c +3 -4
-		test(&data, pipe, output);
-		valid_tests++;
+		igt_display_require(&data.display, data.drm_fd);
+		igt_display_require_output(&data.display);
 	}
 
-	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 
-	igt_display_fini(&data.display);
+	igt_subtest_with_dynamic("kms_flip_event_leak_basic") {

This ends up being igt@kms_flip_event_leak@kms_flip_event_leak_basic. Just call this subtest "basic", don't repeat.

Signature · 1 line
Petri Latvala
Quoted 14 lines
tests/kms_flip_event_leak.c +10 -0
+		for_each_pipe_with_valid_output(&data.display, pipe, output) {
+			igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
+				test(&data, pipe, output);
+			}
+		}
+	}
+
+	igt_fixture {
+		igt_display_fini(&data.display);
+	}
 }
Signature · 1 line
2.36.0