[PATCH i-g-t v2 3/3] tests/core_getversion: test all drm devices

Kamil Konieczny kamil.konieczny at linux.intel.com
Wed Feb 21 10:29:29 UTC 2024


Create multigpu subtest and check all drm devices.

v2: add define for number of max tested cards (Helen)

Cc: Helen Koike <helen.koike at collabora.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 tests/core_getversion.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tests/core_getversion.c b/tests/core_getversion.c
index 8b95e2ce4..1311e8dc5 100644
--- a/tests/core_getversion.c
+++ b/tests/core_getversion.c
@@ -40,11 +40,17 @@
  *
  * SUBTEST: basic
  * Description: Tests GET_VERSION ioctl of the first device.
+ *
+ * SUBTEST: multigpu
+ * Description: Tests GET_VERSION ioctl for all drm devices.
  */
 
 IGT_TEST_DESCRIPTION("Tests the DRM_IOCTL_GET_VERSION ioctl and libdrm's "
 		     "drmGetVersion() interface to it.");
 
+/* constant same as in drmtest.c */
+#define MAX_DRM_CARDS 16
+
 static void check(int fd, char *dst, int len)
 {
 	drmVersionPtr v;
@@ -78,6 +84,21 @@ igt_main
 		igt_info("0: %s\n", info);
 	}
 
+	igt_describe("Check GET_VERSION ioctl for all drm devices.");
+	igt_subtest("multigpu") {
+		int fd2;
+
+		for (int i = 0; i < MAX_DRM_CARDS; ++i) {
+			fd2 = __drm_open_driver_another(i, DRIVER_ANY);
+			if (fd2 == -1)
+				break;
+
+			check(fd2, info, sizeof(info));
+			igt_info("%d: %s\n", i, info);
+			drm_close_driver(fd2);
+		}
+	}
+
 	igt_fixture
 		drm_close_driver(fd);
 }
-- 
2.42.0



More information about the igt-dev mailing list