[PATCH i-g-t v2 5/5] tests/intel/xe_fault_injection: Do not assert if the captured error is not same as injected error.

Francois Dugast francois.dugast at intel.com
Wed Mar 5 11:53:15 UTC 2025


On Wed, Feb 19, 2025 at 01:04:45PM +0530, Satyanarayana K V P wrote:
> In the current implementation, test asserts if the captured error is not same as
> injected error. It is a possible that the error received is translated to other
> error which can be returned to application.
> 
> Try to unbind the device at the end of inject_fault_probe() as this can be
> executed in a loop if IGT_FAULT_INJECT_ITERATION environment variable is set.
> 
> 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>
> ---
>  tests/intel/xe_fault_injection.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
> index cf0337733..82e338965 100644
> --- a/tests/intel/xe_fault_injection.c
> +++ b/tests/intel/xe_fault_injection.c
> @@ -227,8 +227,8 @@ inject_fault_probe(int fd, char pci_slot[], const char function_name[])
>  	injection_list_do(INJECTION_LIST_ADD, function_name);
>  	set_retval(function_name, INJECT_ERRNO);
>  	xe_sysfs_driver_do(fd, pci_slot, XE_SYSFS_DRIVER_TRY_BIND);
> -	igt_assert_eq(-errno, INJECT_ERRNO);
>  	injection_list_do(INJECTION_LIST_REMOVE, function_name);
> +	xe_sysfs_driver_do(fd, pci_slot, XE_SYSFS_DRIVER_TRY_UNBIND);

Those should be 2 separate patches.

1. Try driver unbind after fault injection during probe
2. Accept returned error different than injected one

I am fine with 1. as it is, just the one line.

However removing the assert in 2. is not acceptable. This assert *IS*
the real test performed for existing fault injection tests. If we
remove it then we will not be able to detect when probing does not
behave as expected in case of failure.

We need a more flexible solution to your problem, such as adding one
parameter to inject_fault_probe() with the expected returned error
code.

Francois

>  }
>  
>  /**
> -- 
> 2.35.3
> 


More information about the igt-dev mailing list