summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSatyanarayana K V P <satyanarayana.k.v.p@intel.com>2025-04-22 15:59:41 +0530
committerLukasz Laguna <lukasz.laguna@intel.com>2025-04-24 08:05:05 +0200
commitdd2889d12316b479d3a0d34f940827e6a443e595 (patch)
treee825a80572dc205af372953128a01d7429dbcf5c
parentea51fd3fd20c39b0569a32f24a926049c86d52fb (diff)
tests/intel/xe_fault_injection: Return result from inject_fault_probe()
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@intel.com> Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
-rw-r--r--tests/intel/xe_fault_injection.c10
1 files 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));
for (const struct section *s = guc_fail_functions; s->name; s++)
igt_subtest_f("probe-fail-guc-%s", s->name) {