[RFC i-g-t 4/5] tests/core_sysfs: Add GPU-agnostic sysfs testing
Peter Senna Tschudin
peter.senna at linux.intel.com
Wed May 14 17:51:36 UTC 2025
Introduces core_sysfs, a GPU-agnostic test designed to work with any
GPU, not limited to i915 and Xe.
The test scans the sysfs directory associated with the GPU, reads all
files, and discards the content.
Cc: marcin.bernatowicz at intel.com
Cc: himanshu.girotra at intel.com
Cc: aditya.chauhan at intel.com
Cc: pravalika.gurram at intel.com
Cc: sai.gowtham.ch at intel.com
Cc: ramadevi.gandi at intel.com
Cc: lucas.demarchi at intel.com
Cc: rodrigo.vivi at intel.com
Cc: kamil.konieczny at linux.intel.com
Cc: katarzyna.piecielska at intel.com
Signed-off-by: Peter Senna Tschudin <peter.senna at linux.intel.com>
---
tests/core_sysfs.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++
tests/meson.build | 1 +
2 files changed, 53 insertions(+)
create mode 100644 tests/core_sysfs.c
diff --git a/tests/core_sysfs.c b/tests/core_sysfs.c
new file mode 100644
index 000000000..9c408275e
--- /dev/null
+++ b/tests/core_sysfs.c
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+
+#include "igt.h"
+#include "igt_dir_explorer.h"
+#include "igt_sysfs.h"
+
+struct {
+ bool warn_on_not_hit;
+} opt = { 0 };
+
+/**
+ * TEST: sysfs test
+ * Description: Read entries from sysfs path.
+ * Category: Core
+ * Mega feature: General Core features
+ * Sub-category: uapi
+ * Functionality: sysfs
+ * Feature: core
+ * Test category: uapi
+ *
+ * SUBTEST: sysfs-read-all-entries
+ * Description: Read all entries from sysfs path
+ *
+ */
+
+IGT_TEST_DESCRIPTION("Read entries from sysfs paths.");
+
+igt_main
+{
+ int fd = -1;
+ int sysfs = -1;
+
+ igt_fixture {
+ fd = drm_open_driver_master(DRIVER_ANY);
+ sysfs = igt_sysfs_open(fd);
+ igt_require(sysfs >= 0);
+
+ kmstest_set_vt_graphics_mode();
+ }
+
+ igt_describe("Read all entries from sysfs path.");
+ igt_subtest("sysfs-read-all-entries")
+ igt_dir_explorer_read_and_discard_all(sysfs, 0);
+
+ igt_fixture {
+ close(sysfs);
+ drm_close_driver(fd);
+ }
+}
diff --git a/tests/meson.build b/tests/meson.build
index c7a689ab3..eac77fb81 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -8,6 +8,7 @@ test_progs = [
'core_hotunplug',
'core_setmaster',
'core_setmaster_vs_auth',
+ 'core_sysfs',
'dmabuf',
'dmabuf_sync_file',
'device_reset',
--
2.43.0
More information about the igt-dev
mailing list