[igt-dev] [PATCH i-g-t] tests/kms_chamelium: Wait for chamelium being reachable after a suspend
Petri Latvala
petri.latvala at intel.com
Fri Aug 16 08:46:00 UTC 2019
On Fri, Aug 16, 2019 at 11:35:23AM +0300, Arkadiusz Hiler wrote:
> 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.
>
> Cc: Simon Ser <simon.ser at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109380
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> ---
> lib/igt_chamelium.c | 21 +++++++++++++++++++++
> lib/igt_chamelium.h | 1 +
> tests/kms_chamelium.c | 4 +++-
> 3 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
> index 1c0e1b39..bb1420c3 100644
> --- a/lib/igt_chamelium.c
> +++ b/lib/igt_chamelium.c
> @@ -351,6 +351,27 @@ static xmlrpc_value *chamelium_rpc(struct chamelium *chamelium,
> return res;
> }
>
> +static bool __chamelium_is_reachable(struct chamelium *chamelium)
> +{
> + /* GetSupportedInputs does not require a port and is harmless */
> + xmlrpc_DECREF(__chamelium_rpc(chamelium, NULL, "GetSupportedInputs", "()"));
> +
> + 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..357d9f35 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 10 /* seconds */
When I was testing abort-on-network-down stuff, 10 seconds wasn't
enough, worst case was 17 seconds iirc.
--
Petri Latvala
More information about the igt-dev
mailing list