[PATCH i-g-t] tests/intel: skip subtests using "mocs" debugfs if it's not present
Kamil Konieczny
kamil.konieczny at linux.intel.com
Mon May 26 15:46:02 UTC 2025
Hi Lukasz,
On 2025-05-26 at 09:27:23 +0200, Lukasz Laguna wrote:
> 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>
> ---
> 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..e757141cb 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 \"mocs\" debugfs entry\n");
Good idea, imho just print which one you couldn't open:
"Failed to open required debugfs entry: %s\n", path);
Same apply below.
Regards,
Kamil
>
> /* 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..6cf532a88 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 \"mocs\" debugfs entry\n");
> +
> 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