From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Subject: [PATCH i-g-t v2 7/8] tests/core_hotunplug: Check health once after subtest
Date: Mon, 5 Aug 2024 16:37:10 +0200 [thread overview]
Message-ID: <20240805143713.76034-8-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20240805143713.76034-1-kamil.konieczny@linux.intel.com>
Currently health checks and recovery are performed in fixtures
outside of subtest and even without any subtest running. Whats
more, after one subtest fail, all other checks will fail and
will print quite a few logs.
Lets try to lower number of checks to those really needed and
do them only once per fixture, which should make reading logs
easier.
v2: drop new var from test priv structure, update subject and
description, change second macro parameter name to 'y'
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
tests/core_hotunplug.c | 108 +++++++++++++++++++++++++----------------
1 file changed, 67 insertions(+), 41 deletions(-)
diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index 7f17f4423..51edee985 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -84,6 +84,9 @@
IGT_TEST_DESCRIPTION("Examine behavior of a driver on device hot unplug");
+#define ACTION_RECOVER (1 << 0)
+#define ACTION_POST_CHECK (1 << 1)
+
struct hotunplug {
struct {
int drm;
@@ -515,7 +518,6 @@ static void recover(struct hotunplug *priv)
bool late_close = priv->fd.drm >= 0;
cleanup(priv);
-
if (!priv->failure && late_close)
igt_ignore_warn(healthcheck(priv, false));
@@ -671,6 +673,19 @@ static void hotreplug_lateclose(struct hotunplug *priv)
}
/* Main */
+#define RECOVER(x) igt_fixture { \
+ if (x) { \
+ x = false; \
+ recover(&priv); \
+ } \
+ }
+
+#define POST_CHECK(y) igt_fixture { \
+ if (y) { \
+ y = false; \
+ post_healthcheck(&priv); \
+ } \
+ }
igt_main
{
@@ -682,6 +697,8 @@ igt_main
.snd_driver = NULL,
.chipset = DRIVER_ANY,
};
+ bool needs_recover = false;
+ bool needs_post_check = false;
igt_fixture {
int fd_drm;
@@ -717,100 +734,109 @@ igt_main
igt_subtest_group {
igt_describe("Check if the driver can be cleanly unbound from a device believed to be closed, then rebound");
- igt_subtest("unbind-rebind")
+ igt_subtest("unbind-rebind") {
+ needs_recover = true;
+ needs_post_check = true;
unbind_rebind(&priv);
+ }
- igt_fixture
- recover(&priv);
+ RECOVER(needs_recover);
}
- igt_fixture
- post_healthcheck(&priv);
+ POST_CHECK(needs_post_check);
igt_subtest_group {
igt_describe("Check if a device believed to be closed can be cleanly unplugged, then restored");
- igt_subtest("unplug-rescan")
+ igt_subtest("unplug-rescan") {
+ needs_recover = true;
+ needs_post_check = true;
unplug_rescan(&priv);
+ }
- igt_fixture
- recover(&priv);
+ RECOVER(needs_recover);
}
- igt_fixture
- post_healthcheck(&priv);
+ POST_CHECK(needs_post_check);
igt_subtest_group {
igt_describe("Check if the driver can be cleanly unbound from an open device, then released and rebound");
- igt_subtest("hotunbind-rebind")
+ igt_subtest("hotunbind-rebind") {
+ needs_recover = true;
+ needs_post_check = true;
hotunbind_rebind(&priv);
+ }
- igt_fixture
- recover(&priv);
+ RECOVER(needs_recover);
}
- igt_fixture
- post_healthcheck(&priv);
+ POST_CHECK(needs_post_check);
igt_subtest_group {
igt_describe("Check if an open device can be cleanly unplugged, then released and restored");
- igt_subtest("hotunplug-rescan")
+ igt_subtest("hotunplug-rescan") {
+ needs_recover = true;
+ needs_post_check = true;
hotunplug_rescan(&priv);
+ }
- igt_fixture
- recover(&priv);
+ RECOVER(needs_recover);
}
- igt_fixture
- post_healthcheck(&priv);
+ POST_CHECK(needs_post_check);
igt_subtest_group {
igt_describe("Check if the driver can be cleanly rebound to a device with a still open hot unbound driver instance");
- igt_subtest("hotrebind")
+ igt_subtest("hotrebind") {
+ needs_recover = true;
+ needs_post_check = true;
hotrebind(&priv);
+ }
- igt_fixture
- recover(&priv);
+ RECOVER(needs_recover);
}
- igt_fixture
- post_healthcheck(&priv);
+ POST_CHECK(needs_post_check);
igt_subtest_group {
igt_describe("Check if a hot unplugged and still open device can be cleanly restored");
- igt_subtest("hotreplug")
+ igt_subtest("hotreplug") {
+ needs_recover = true;
+ needs_post_check = true;
hotreplug(&priv);
+ }
- igt_fixture
- recover(&priv);
+ RECOVER(needs_recover);
}
- igt_fixture
- post_healthcheck(&priv);
+ POST_CHECK(needs_post_check);
igt_subtest_group {
igt_describe("Check if a hot unbound driver instance still open after hot rebind can be cleanly released");
- igt_subtest("hotrebind-lateclose")
+ igt_subtest("hotrebind-lateclose") {
+ needs_recover = true;
+ needs_post_check = true;
hotrebind_lateclose(&priv);
+ }
- igt_fixture
- recover(&priv);
+ RECOVER(needs_recover);
}
- igt_fixture
- post_healthcheck(&priv);
+ POST_CHECK(needs_post_check);
igt_subtest_group {
igt_describe("Check if an instance of a still open while hot replugged device can be cleanly released");
- igt_subtest("hotreplug-lateclose")
+ igt_subtest("hotreplug-lateclose") {
+ needs_recover = true;
+ needs_post_check = true;
hotreplug_lateclose(&priv);
+ }
- igt_fixture
- recover(&priv);
+ RECOVER(needs_recover);
}
igt_fixture {
- post_healthcheck(&priv);
-
+ if (needs_post_check)
+ post_healthcheck(&priv);
igt_ignore_warn(close(priv.fd.sysfs_bus));
igt_ignore_warn(close(priv.fd.sysfs_drv));
}
--
2.43.0
next prev parent reply other threads:[~2024-08-05 14:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 14:37 [PATCH i-g-t v2 0/8] tests/core_hotunplug: Make it fail only once Kamil Konieczny
2024-08-05 14:37 ` [PATCH i-g-t v2 1/8] lib/drmtest: add function for retriving chipset Kamil Konieczny
2024-08-05 14:37 ` [PATCH i-g-t v2 2/8] tests/core_hotunplug: set known chipset before tests Kamil Konieczny
2024-08-05 14:37 ` [PATCH i-g-t v2 3/8] lib/drmtest: Allow to get drm device name Kamil Konieczny
2024-08-05 14:37 ` [PATCH i-g-t v2 4/8] tests/core_hotunplug: Open the same driver Kamil Konieczny
2024-08-05 14:37 ` [PATCH i-g-t v2 5/8] tests/core_hotunplug: Fix device close Kamil Konieczny
2024-08-05 14:37 ` [PATCH i-g-t v2 6/8] tests/core_hotunplug: Skip if no render available Kamil Konieczny
2024-08-05 14:37 ` Kamil Konieczny [this message]
2024-08-07 12:26 ` [PATCH i-g-t v2 7/8] tests/core_hotunplug: Check health once after subtest Andrzej Hajda
2024-08-05 14:37 ` [PATCH i-g-t v2 8/8] tests/core_hotunplug: Print info between steps Kamil Konieczny
2024-08-07 12:58 ` Andrzej Hajda
2024-08-05 15:20 ` ✓ CI.xeBAT: success for tests/core_hotunplug: Make it fail only once Patchwork
2024-08-05 15:31 ` ✓ Fi.CI.BAT: " Patchwork
2024-08-05 16:25 ` ✗ CI.xeFULL: failure " Patchwork
2024-08-05 18:45 ` Kamil Konieczny
2024-08-05 23:51 ` ✗ Fi.CI.IGT: " Patchwork
2024-08-06 12:51 ` 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=20240805143713.76034-8-kamil.konieczny@linux.intel.com \
--to=kamil.konieczny@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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