From 8448579c594f7443a99788b8a813763d2159f971 Mon Sep 17 00:00:00 2001 From: Jens Georg Date: Sat, 18 Feb 2023 13:57:17 +0100 Subject: tests: Check if bind() to the same TCP port errors If not, skip the corresponding test --- tests/test-context.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test-context.c b/tests/test-context.c index e781455..1b73e01 100644 --- a/tests/test-context.c +++ b/tests/test-context.c @@ -269,6 +269,21 @@ test_gupnp_context_error_when_bound () const char *address = g_uri_get_host (uris->data); int port = g_uri_get_port (uris->data); + SoupServer *s = soup_server_new (NULL, NULL); + soup_server_listen_local (server, + port, + SOUP_SERVER_LISTEN_IPV4_ONLY, + &error); + + g_object_unref (s); + + if (error == NULL) { + g_object_unref (server); + // Skip the test, for some reason it is possible to bind to the + // same TCP port twice here + return; + } + g_test_expect_message ( "gupnp-context", G_LOG_LEVEL_WARNING, -- cgit v1.2.1