From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] tests/kms_chamelium: chatty connector status assertions
Date: Tue, 23 Jul 2019 16:54:05 +0300 [thread overview]
Message-ID: <20190723135405.27164-1-simon.ser@intel.com> (raw)
This commit adds an error message to connector status assertions.
Signed-off-by: Simon Ser <simon.ser@intel.com>
---
I'll update the CI filters.
tests/kms_chamelium.c | 44 ++++++++++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 13 deletions(-)
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index b7d30a2d0f55..0dc26e7274dc 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -118,15 +118,25 @@ reprobe_connector(data_t *data, struct chamelium_port *port)
return status;
}
+static const char *connection_str(drmModeConnection c)
+{
+ switch (c) {
+ case DRM_MODE_CONNECTED:
+ return "connected";
+ case DRM_MODE_DISCONNECTED:
+ return "disconnected";
+ case DRM_MODE_UNKNOWNCONNECTION:
+ return "unknown";
+ }
+ assert(0); /* unreachable */
+}
+
static void
wait_for_connector(data_t *data, struct chamelium_port *port,
drmModeConnection status)
{
- bool finished = false;
-
- igt_debug("Waiting for %s to %sconnect...\n",
- chamelium_port_get_name(port),
- status == DRM_MODE_DISCONNECTED ? "dis" : "");
+ igt_debug("Waiting for %s to get %s...\n",
+ chamelium_port_get_name(port), connection_str(status));
/*
* Rely on simple reprobing so we don't fail tests that don't require
@@ -134,14 +144,14 @@ wait_for_connector(data_t *data, struct chamelium_port *port,
*/
igt_until_timeout(HOTPLUG_TIMEOUT) {
if (reprobe_connector(data, port) == status) {
- finished = true;
return;
}
usleep(50000);
}
- igt_assert(finished);
+ igt_assert_f(false, "Timed out waiting for %s to get %s\n",
+ chamelium_port_get_name(port), connection_str(status));
}
static int chamelium_vga_modes[][2] = {
@@ -234,6 +244,7 @@ test_basic_hotplug(data_t *data, struct chamelium_port *port, int toggle_count)
{
struct udev_monitor *mon = igt_watch_hotplug();
int i;
+ drmModeConnection status;
reset_state(data, NULL);
igt_hpd_storm_set_threshold(data->drm_fd, 0);
@@ -243,17 +254,24 @@ test_basic_hotplug(data_t *data, struct chamelium_port *port, int toggle_count)
/* Check if we get a sysfs hotplug event */
chamelium_plug(data->chamelium, port);
- igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
- igt_assert_eq(reprobe_connector(data, port),
- DRM_MODE_CONNECTED);
+ igt_assert_f(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT),
+ "Timed out waiting for hotplug uevent\n");
+ status = reprobe_connector(data, port);
+ igt_assert_f(status == DRM_MODE_CONNECTED,
+ "Invalid connector status after hotplug: "
+ "got %s, expected connected\n",
+ connection_str(status));
igt_flush_hotplugs(mon);
/* Now check if we get a hotplug from disconnection */
chamelium_unplug(data->chamelium, port);
- igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
- igt_assert_eq(reprobe_connector(data, port),
- DRM_MODE_DISCONNECTED);
+ igt_assert_f(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT),
+ "Timed out waiting for unplug uevent\n");
+ igt_assert_f(status == DRM_MODE_DISCONNECTED,
+ "Invalid connector status after hotplug: "
+ "got %s, expected disconnected\n",
+ connection_str(status));
}
igt_cleanup_hotplug(mon);
--
2.22.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-07-23 13:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-23 13:54 Simon Ser [this message]
2019-07-23 14:08 ` [igt-dev] ✗ GitLab.Pipeline: warning for tests/kms_chamelium: chatty connector status assertions Patchwork
2019-07-23 14:36 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
2019-08-15 10:36 ` Arkadiusz Hiler
2019-08-15 10:38 ` [igt-dev] [PATCH i-g-t] " Arkadiusz Hiler
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=20190723135405.27164-1-simon.ser@intel.com \
--to=simon.ser@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