public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tests/kms_chamelium: chatty connector status assertions
@ 2019-07-23 13:54 Simon Ser
  2019-07-23 14:08 ` [igt-dev] ✗ GitLab.Pipeline: warning for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Simon Ser @ 2019-07-23 13:54 UTC (permalink / raw)
  To: igt-dev

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-08-15 10:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-23 13:54 [igt-dev] [PATCH i-g-t] tests/kms_chamelium: chatty connector status assertions Simon Ser
2019-07-23 14:08 ` [igt-dev] ✗ GitLab.Pipeline: warning for " 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox