summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2023-02-18 13:57:17 +0100
committerJens Georg <mail@jensge.org>2023-02-18 13:57:17 +0100
commit8448579c594f7443a99788b8a813763d2159f971 (patch)
tree03c69b400f4865018248f1a74fcb35d7e4f23c6c
parent74b07819e8ed6a159eda906f06b1e0d45225f069 (diff)
downloadgupnp-8448579c594f7443a99788b8a813763d2159f971.tar.gz
tests: Check if bind() to the same TCP port errors
If not, skip the corresponding test
-rw-r--r--tests/test-context.c15
1 files changed, 15 insertions, 0 deletions
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,