[PATCH i-g-t v2] tests/intel: skip subtests using "mocs" debugfs if it's not present
Lukasz Laguna
lukasz.laguna at intel.com
Tue May 27 07:58:00 UTC 2025
The "mocs" debugfs entry is expected to be missing on VFs, so instead of
asserting its presence, skip the subtests if it is not available.
Signed-off-by: Lukasz Laguna <lukasz.laguna at intel.com>
---
v2:
- use %s to print required debugfs entry (Kamil)
---
tests/intel/xe_exec_reset.c | 11 +++++++----
tests/intel/xe_pm.c | 4 +++-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/tests/intel/xe_exec_reset.c b/tests/intel/xe_exec_reset.c
index 67b7bb826..7ae53c679 100644
--- a/tests/intel/xe_exec_reset.c
+++ b/tests/intel/xe_exec_reset.c
@@ -597,19 +597,22 @@ static void
gt_mocs_reset(int fd, int gt)
{
char path[256];
+ char *mocs_content_pre, *mocs_contents_post;
+
+ sprintf(path, "gt%d/mocs", gt);
+ igt_require_f(igt_debugfs_exists(fd, path, O_RDONLY),
+ "Failed to open required debugfs entry: %s\n", path);
/* Mocs debugfs contents before and after GT reset.
* Allocate memory to store 10k characters sufficient enough
* to store global mocs and lncf mocs data.
*/
- char *mocs_content_pre = (char *)malloc(10000 * sizeof(char));
- char *mocs_contents_post = (char *)malloc(10000 * sizeof(char));
+ mocs_content_pre = (char *)malloc(10000 * sizeof(char));
+ mocs_contents_post = (char *)malloc(10000 * sizeof(char));
igt_assert(mocs_content_pre);
igt_assert(mocs_contents_post);
- sprintf(path, "gt%d/mocs", gt);
- igt_assert(igt_debugfs_exists(fd, path, O_RDONLY));
igt_debugfs_dump(fd, path);
igt_debugfs_read(fd, path, mocs_content_pre);
diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
index 6eb21d5ec..7e9324eec 100644
--- a/tests/intel/xe_pm.c
+++ b/tests/intel/xe_pm.c
@@ -743,7 +743,9 @@ static void test_mocs_suspend_resume(device_t device, enum igt_suspend_state s_s
igt_debug("Running on GT%d\n", gt);
sprintf(path, "gt%d/mocs", gt);
- igt_assert(igt_debugfs_exists(device.fd_xe, path, O_RDONLY));
+ igt_require_f(igt_debugfs_exists(device.fd_xe, path, O_RDONLY),
+ "Failed to open required debugfs entry: %s\n", path);
+
igt_debugfs_dump(device.fd_xe, path);
igt_debugfs_read(device.fd_xe, path, mocs_content_pre);
--
2.40.0
More information about the igt-dev
mailing list