[PATCH i-g-t v8 3/3] tests/intel/xe_fault_injection: Return result from inject_fault_probe()
Bernatowicz, Marcin
marcin.bernatowicz at linux.intel.com
Tue Apr 22 11:13:06 UTC 2025
On 4/22/2025 12:29 PM, Satyanarayana K V P wrote:
> In the current implementation, test asserts if the captured error is not same as
> injected error. It is possible that the error received is translated to other
> error which can be returned to application and in some scenarios driver retries
> in case of failure and so, no error might be captured.
>
> Considering above cases, not asserting the test in inject_fault_probe(), but
> returning error to the caller. Caller can check and assert if needed.
>
> Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p at intel.com>
> ---
> Cc: Michał Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Francois Dugast <francois.dugast at intel.com>
> Cc: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>
> ---
> tests/intel/xe_fault_injection.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
> index ced613896..98a414bd3 100644
> --- a/tests/intel/xe_fault_injection.c
> +++ b/tests/intel/xe_fault_injection.c
> @@ -224,9 +224,10 @@ static void set_retval(const char function_name[], long long retval)
> * @xe_wa_init: xe_wa_init
> * @xe_wopcm_init: xe_wopcm_init
> */
> -static void
> +static int
> inject_fault_probe(int fd, char pci_slot[], const char function_name[])
> {
> + int err = 0;
> igt_info("Injecting error \"%s\" (%d) in function \"%s\"\n",
> strerror(-INJECT_ERRNO), INJECT_ERRNO, function_name);
>
> @@ -236,8 +237,10 @@ inject_fault_probe(int fd, char pci_slot[], const char function_name[])
>
> igt_kmod_bind("xe", pci_slot);
>
> - igt_assert_eq(-errno, INJECT_ERRNO);
> + err = -errno;
> injection_list_remove(function_name);
> +
> + return err;
> }
>
> /**
> @@ -579,7 +582,8 @@ igt_main_args("I:", NULL, help_str, opt_handler, NULL)
>
> for (const struct section *s = probe_fail_functions; s->name; s++)
> igt_subtest_f("inject-fault-probe-function-%s", s->name)
> - inject_fault_probe(fd, pci_slot, s->name);
> + igt_assert_eq(INJECT_ERRNO, inject_fault_probe(fd,
> + pci_slot, s->name));
LGTM,
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>
>
> for (const struct section *s = guc_fail_functions; s->name; s++)
> igt_subtest_f("probe-fail-guc-%s", s->name) {
More information about the igt-dev
mailing list