From: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH v2 i-g-t] tests/kms_chamelium: Wait for chamelium being reachable after a suspend
Date: Mon, 19 Aug 2019 10:07:03 +0300 [thread overview]
Message-ID: <20190819070703.29958-1-arkadiusz.hiler@intel.com> (raw)
In-Reply-To: <20190816083523.4566-1-arkadiusz.hiler@intel.com>
Getting network back after waking up from suspend takes some time.
If it's not quick enough, it may cause any following chamelium_rpc
to fail.
This includes the chamelium port reset in exit handler:
igt_chamelium-CRITICAL: Test assertion failure function chamelium_rpc,
file ../lib/igt_chamelium.c:349:
igt_chamelium-CRITICAL: Failed assertion: !chamelium->env.fault_occurred
igt_chamelium-CRITICAL: Last errno: 113, No route to host
igt_chamelium-CRITICAL: Chamelium RPC call failed: libcurl failed to execute
the HTTP POST transaction, explaining:
Failed to connect to 192.168.1.224 port 9992: No route to host
Stack trace:
#0 ../lib/igt_core.c:1674 __igt_fail_assert()
#1 [chamelium_rpc+0x1ea]
#2 ../lib/igt_chamelium.c:2274 chamelium_reset()
#3 ../lib/igt_chamelium.c:2361 chamelium_deinit()
#4 ../lib/igt_core.c:2124 call_exit_handlers()
So let's wait for Chamelium to be reachable after each suspend_autoresume.
v2: Bump the network timeout to 20s,
the slowest observed bring-up was 17s. (Petri)
Do not DECREF if we get NULL from __chmelium_rpc(). (Simon & CI)
Cc: Simon Ser <simon.ser@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109380
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
lib/igt_chamelium.c | 26 ++++++++++++++++++++++++++
lib/igt_chamelium.h | 1 +
tests/kms_chamelium.c | 4 +++-
3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 1c0e1b39..1b03a103 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -351,6 +351,32 @@ static xmlrpc_value *chamelium_rpc(struct chamelium *chamelium,
return res;
}
+static bool __chamelium_is_reachable(struct chamelium *chamelium)
+{
+ xmlrpc_value *res;
+
+ /* GetSupportedInputs does not require a port and is harmless */
+ res = __chamelium_rpc(chamelium, NULL, "GetSupportedInputs", "()");
+
+ if (res != NULL)
+ xmlrpc_DECREF(res);
+
+ if (chamelium->env.fault_occurred)
+ igt_debug("Chamelium RPC call failed: %s\n",
+ chamelium->env.fault_string);
+
+ return !chamelium->env.fault_occurred;
+}
+
+void chamelium_wait_reachable(struct chamelium *chamelium, int timeout)
+{
+ bool chamelium_online = igt_wait(__chamelium_is_reachable(chamelium),
+ timeout * 1000, 100);
+
+ igt_assert_f(chamelium_online,
+ "Couldn't connect to Chamelium for %ds", timeout);
+}
+
/**
* chamelium_plug:
* @chamelium: The Chamelium instance to use
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index 1cc5e2d8..08705a9d 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -112,6 +112,7 @@ drmModeConnector *chamelium_port_get_connector(struct chamelium *chamelium,
bool reprobe);
const char *chamelium_port_get_name(struct chamelium_port *port);
+void chamelium_wait_reachable(struct chamelium *chamelium, int timeout);
void chamelium_plug(struct chamelium *chamelium, struct chamelium_port *port);
void chamelium_unplug(struct chamelium *chamelium, struct chamelium_port *port);
bool chamelium_is_plugged(struct chamelium *chamelium,
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 0cf1bfbd..ce5ab967 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -57,6 +57,7 @@ typedef struct {
} data_t;
#define HOTPLUG_TIMEOUT 20 /* seconds */
+#define ONLINE_TIMEOUT 20 /* seconds */
#define HPD_STORM_PULSE_INTERVAL_DP 100 /* ms */
#define HPD_STORM_PULSE_INTERVAL_HDMI 200 /* ms */
@@ -368,6 +369,7 @@ try_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
igt_system_suspend_autoresume(state, test);
igt_assert(wait_for_hotplug(mon, &timeout));
+ chamelium_wait_reachable(data->chamelium, ONLINE_TIMEOUT);
if (port) {
igt_assert_eq(reprobe_connector(data, port), target_state);
@@ -473,8 +475,8 @@ test_suspend_resume_edid_change(data_t *data, struct chamelium_port *port,
igt_flush_hotplugs(mon);
igt_system_suspend_autoresume(state, test);
-
igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
+ chamelium_wait_reachable(data->chamelium, ONLINE_TIMEOUT);
get_connectors_link_status_failed(data, link_status_failed[1]);
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-08-19 7:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 8:35 [igt-dev] [PATCH i-g-t] tests/kms_chamelium: Wait for chamelium being reachable after a suspend Arkadiusz Hiler
2019-08-16 8:46 ` Petri Latvala
2019-08-16 9:08 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-08-16 14:28 ` Ser, Simon
2019-08-16 19:53 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-08-19 7:07 ` Arkadiusz Hiler [this message]
2019-08-19 8:13 ` [igt-dev] [PATCH v2 i-g-t] " Ser, Simon
2019-08-19 7:35 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_chamelium: Wait for chamelium being reachable after a suspend (rev2) Patchwork
2019-08-19 10:12 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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=20190819070703.29958-1-arkadiusz.hiler@intel.com \
--to=arkadiusz.hiler@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