[PATCH i-g-t] tests/xe_fault_injection: Skip OA test if Xe OA interface is not available

Goyal, Nakshtra nakshtra.goyal at intel.com
Thu Apr 24 10:03:39 UTC 2025


> Handle the case where the Xe OA interface is not available by checking for
> ENODEV and skipping the test gracefully. This avoids test failures on platforms
> where the OA feature is not supported.
> 
> No functional change to platforms where the interface is present.
> 
> Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
> Cc: Jakub Kolakowski <jakub1.kolakowski at intel.com>
> Cc: Nakshtra Goyal <nakshtra.goyal at intel.com>
> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>

LGTM.
Reviewed-by: Nakshtra Goyal <nakshtra.goyal at intel.com>
> ---
>  tests/intel/xe_fault_injection.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
> index 24d3df572..42b467e73 100644
> --- a/tests/intel/xe_fault_injection.c
> +++ b/tests/intel/xe_fault_injection.c
> @@ -349,6 +349,7 @@ oa_add_config_fail(int fd, int sysfs, int devid, const
> char function_name[])
>  	uint32_t mux_regs[] = { SAMPLE_MUX_REG, 0x0 };
>  	struct drm_xe_oa_config config;
>  	const char *uuid = "01234567-0123-0123-0123-0123456789ab";
> +	int ret;
> 
>  	snprintf(path, sizeof(path), "metrics/%s/id", uuid);
>  	/* Destroy previous configuration if present */ @@ -361,7 +362,10
> @@ oa_add_config_fail(int fd, int sysfs, int devid, const char function_name[])
>  	config.n_regs = 1;
>  	config.regs_ptr = to_user_pointer(mux_regs);
> 
> -	igt_assert_lt(0, intel_xe_perf_ioctl(fd,
> DRM_XE_OBSERVATION_OP_ADD_CONFIG, &config));
> +	ret = intel_xe_perf_ioctl(fd,
> DRM_XE_OBSERVATION_OP_ADD_CONFIG, &config);
> +	igt_skip_on_f(ret == -1 && errno == ENODEV, "Xe OA interface not
> +available\n");
> +
> +	igt_assert_lt(0, ret);
>  	igt_assert(igt_sysfs_scanf(sysfs, path, "%" PRIu64, &config_id) == 1);
>  	igt_assert_eq(intel_xe_perf_ioctl(fd,
> DRM_XE_OBSERVATION_OP_REMOVE_CONFIG, &config_id), 0);
> 
> --
> 2.31.1



More information about the igt-dev mailing list