[igt-dev] [PATCH v3 1/8] tests/fbdev: Move existing tests into separate subgroups

Thomas Zimmermann tzimmermann at suse.de
Tue Nov 10 07:50:55 UTC 2020


Move the existing tests into subgroups for testing modesetting and
accessing the framebuffer.

v3:
	* put igt_describe() before igt_subtest() and igt_subtest_group()
	  (Petri)

Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 tests/fbdev.c | 53 ++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 40 insertions(+), 13 deletions(-)

diff --git a/tests/fbdev.c b/tests/fbdev.c
index e5efeb93..46641fea 100644
--- a/tests/fbdev.c
+++ b/tests/fbdev.c
@@ -37,28 +37,17 @@
 
 #include "igt.h"
 
-igt_main
+static void mode_tests(int fd)
 {
 	struct fb_var_screeninfo var_info;
 	struct fb_fix_screeninfo fix_info;
-	int fd = -1;
 
-	/*
-	 * Should this test focus on the fbdev independent of any drm driver,
-	 * or should it look for fbdev of a particular device?
-	 */
 	igt_fixture {
-		fd = open("/dev/fb0", O_RDWR);
-		if (fd < 0) {
-			drm_load_module(DRIVER_ANY);
-			fd = open("/dev/fb0", O_RDWR);
-		}
-		igt_require_f(fd != -1, "/dev/fb0\n");
-
 		igt_require(ioctl(fd, FBIOGET_VSCREENINFO, &var_info) == 0);
 		igt_require(ioctl(fd, FBIOGET_FSCREENINFO, &fix_info) == 0);
 	}
 
+	igt_describe("Check if screeninfo is valid");
 	igt_subtest("info") {
 		unsigned long size;
 
@@ -69,7 +58,17 @@ igt_main
 			     fix_info.line_length,
 			     fix_info.smem_len);
 	}
+}
+
+static void framebuffer_tests(int fd)
+{
+	struct fb_fix_screeninfo fix_info;
 
+	igt_fixture {
+		igt_require(ioctl(fd, FBIOGET_FSCREENINFO, &fix_info) == 0);
+	}
+
+	igt_describe("Check mmap operations on framebuffer memory");
 	igt_subtest("mmap") {
 		void *map;
 
@@ -82,6 +81,34 @@ igt_main
 		memset(map, 0, fix_info.smem_len);
 		munmap(map, fix_info.smem_len);
 	}
+}
+
+igt_main
+{
+	int fd = -1;
+
+	/*
+	 * Should this test focus on the fbdev independent of any drm driver,
+	 * or should it look for fbdev of a particular device?
+	 */
+	igt_fixture {
+		fd = open("/dev/fb0", O_RDWR);
+		if (fd < 0) {
+			drm_load_module(DRIVER_ANY);
+			fd = open("/dev/fb0", O_RDWR);
+		}
+		igt_require_f(fd != -1, "/dev/fb0\n");
+	}
+
+	igt_describe("Check modesetting");
+	igt_subtest_group {
+		mode_tests(fd);
+	}
+
+	igt_describe("Check framebuffer access");
+	igt_subtest_group {
+		framebuffer_tests(fd);
+	}
 
 	igt_fixture {
 		close(fd);
-- 
2.29.2



More information about the igt-dev mailing list