From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Kamil Konieczny" <kamil.konieczny@linux.intel.com>,
"Mauro Carvalho Chehab" <mauro.chehab@linux.intel.com>,
"Sai Gowtham Ch" <sai.gowtham.ch@intel.com>,
"Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Subject: [PATCH v5 i-g-t] tests/device_reset: move later skips into subtests
Date: Wed, 8 May 2024 18:45:50 +0200 [thread overview]
Message-ID: <20240508164550.52434-1-kamil.konieczny@linux.intel.com> (raw)
It is safe to use skips just after igt_main() for skipping all
subtests but later on they produce logs and even if CI will
ignore that, such logs can mislead developers reading them.
Move a skip from middle of igt_main() code block into subtests
which needed them.
v2: add space after while (Kamil)
v3: remove macro in favor of function (Zbigniew)
v4: rename function and make it compact (Zbigniew)
v5: correct function behaviour after name change (Kamil)
Cc: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
Cc: Sai Gowtham Ch <sai.gowtham.ch@intel.com>
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
tests/device_reset.c | 46 ++++++++++++++++++++++++++++++++++++++------
1 file changed, 40 insertions(+), 6 deletions(-)
diff --git a/tests/device_reset.c b/tests/device_reset.c
index 583a59039..6a63a5925 100644
--- a/tests/device_reset.c
+++ b/tests/device_reset.c
@@ -299,6 +299,39 @@ static bool is_sysfs_cold_reset_supported(int slot_fd)
return true;
}
+/**
+ * has_cold_reset:
+ * @fd: opened sysfs pci slot descriptor
+ * @reason: fail description
+ *
+ * Check if device supports cold reset based on slot dir or sysfs file presence.
+ *
+ * Returns:
+ * false if cold reset not supported, also writes a reason for it
+ * true if supported
+ */
+static bool has_cold_reset(int slot_dir, const char **reason)
+{
+ static const char *no_slot = "Gfx Card does not support any pcie slot for cold reset";
+ static const char *not_supported = "Gfx Card does not support cold reset";
+
+ if (slot_dir < 0) {
+ if (reason)
+ *reason = no_slot;
+
+ return false;
+ }
+
+ if (!is_sysfs_cold_reset_supported(slot_dir)) {
+ if (reason)
+ *reason = not_supported;
+
+ return false;
+ }
+
+ return true;
+}
+
/* Unbind the driver from the device */
static void driver_unbind(struct device_fds *dev)
{
@@ -424,22 +457,23 @@ igt_main
healthcheck(&dev);
}
- igt_subtest_group {
- igt_fixture {
- igt_skip_on_f(dev.fds.slot_dir < 0, "Gfx Card does not support any "
- "pcie slot for cold reset\n");
- igt_skip_on(!is_sysfs_cold_reset_supported(dev.fds.slot_dir));
- }
+ igt_subtest_group {
igt_describe("Unbinds driver from device, initiates cold reset"
" then rebinds driver to device");
igt_subtest("unbind-cold-reset-rebind") {
+ const char *reason;
+
+ igt_skip_on_f(!has_cold_reset(dev.fds.slot_dir, &reason), "%s\n", reason);
unbind_reset_rebind(&dev, COLD_RESET);
healthcheck(&dev);
}
igt_describe("Cold Resets device with bound driver");
igt_subtest("cold-reset-bound") {
+ const char *reason;
+
+ igt_skip_on_f(!has_cold_reset(dev.fds.slot_dir, &reason), "%s\n", reason);
initiate_device_reset(&dev, COLD_RESET);
/*
* Cold reset will initiate card boot sequence again,
--
2.42.0
next reply other threads:[~2024-05-08 16:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-08 16:45 Kamil Konieczny [this message]
2024-05-08 18:25 ` ✓ Fi.CI.BAT: success for tests/device_reset: move later skips into subtests (rev5) Patchwork
2024-05-08 18:36 ` ✓ CI.xeBAT: " Patchwork
2024-05-09 4:57 ` ✗ CI.xeFULL: failure " Patchwork
2024-05-09 14:46 ` Kamil Konieczny
2024-05-09 8:43 ` ✗ Fi.CI.IGT: " Patchwork
2024-05-09 14:56 ` Kamil Konieczny
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=20240508164550.52434-1-kamil.konieczny@linux.intel.com \
--to=kamil.konieczny@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=mauro.chehab@linux.intel.com \
--cc=sai.gowtham.ch@intel.com \
--cc=zbigniew.kempczynski@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