From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
Francois Dugast <francois.dugast@intel.com>,
Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Subject: [PATCH i-g-t 1/2] tests/intel/xe_fault_injection: Return probe result from inject_fault_probe
Date: Thu, 17 Apr 2025 15:13:11 +0200 [thread overview]
Message-ID: <20250417131312.1016503-2-marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <20250417131312.1016503-1-marcin.bernatowicz@linux.intel.com>
Refactor inject_fault_probe() to return the result of the probe instead
of asserting internally. This defers the decision of whether to assert
or how to handle the result to the caller.
This change allows more flexibility for test cases that may expect the
probe to succeed despite an injected fault. If strict checking is still
desired, a wrapper such as:
static void assert_inject_fault_probe(...) {
igt_assert_eq(INJECT_ERRNO, inject_fault_probe(...));
}
can be introduced to preserve the old behavior.
Follow-up patches will demonstrate use cases where fault injection does
not cause the probe to fail, justifying this change in behavior.
Cc: Francois Dugast <francois.dugast@intel.com>
Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
---
tests/intel/xe_fault_injection.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
index 24d3df572..dc8005dc8 100644
--- a/tests/intel/xe_fault_injection.c
+++ b/tests/intel/xe_fault_injection.c
@@ -186,9 +186,11 @@ 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);
@@ -197,9 +199,10 @@ inject_fault_probe(int fd, char pci_slot[], const char function_name[])
set_retval(function_name, INJECT_ERRNO);
igt_kmod_bind("xe", pci_slot);
-
- igt_assert_eq(-errno, INJECT_ERRNO);
+ err = -errno;
injection_list_remove(function_name);
+
+ return err;
}
/**
@@ -478,7 +481,7 @@ igt_main
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));
igt_fixture {
close(sysfs);
--
2.31.1
next prev parent reply other threads:[~2025-04-17 13:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-17 13:13 [PATCH i-g-t 0/2] xe_fault_injection: Improve probe fault injection handling Marcin Bernatowicz
2025-04-17 13:13 ` Marcin Bernatowicz [this message]
2025-04-17 13:13 ` [PATCH i-g-t 2/2] tests/intel/xe_fault_injection: Make inject-fault-probe-function* tests VF-aware Marcin Bernatowicz
2025-04-17 14:51 ` ✗ Xe.CI.BAT: failure for xe_fault_injection: Improve probe fault injection handling Patchwork
2025-04-25 10:05 ` Bernatowicz, Marcin
2025-04-17 14:58 ` ✓ i915.CI.BAT: success " Patchwork
2025-04-18 2:57 ` ✗ i915.CI.Full: failure " Patchwork
2025-04-18 7:08 ` ✗ Xe.CI.Full: " Patchwork
2025-04-25 10:07 ` Bernatowicz, Marcin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250417131312.1016503-2-marcin.bernatowicz@linux.intel.com \
--to=marcin.bernatowicz@linux.intel.com \
--cc=francois.dugast@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=satyanarayana.k.v.p@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox