[Spice-devel] [PATCH spice-server v3 16/32] test-leaks: Use socket compatibility layer
Frediano Ziglio
fziglio at redhat.com
Mon Jan 7 18:01:59 UTC 2019
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/tests/test-leaks.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/server/tests/test-leaks.c b/server/tests/test-leaks.c
index 64130c22..98f9cb67 100644
--- a/server/tests/test-leaks.c
+++ b/server/tests/test-leaks.c
@@ -35,6 +35,7 @@
#include "test-glib-compat.h"
#include "basic-event-loop.h"
#include "test-display-base.h"
+#include "sys-socket.h"
#define PKI_DIR SPICE_TOP_SRCDIR "/server/tests/pki/"
@@ -43,7 +44,7 @@ static void server_leaks(void)
int result;
SpiceCoreInterface *core;
SpiceServer *server = spice_server_new();
- int sv[2];
+ socket_t sv[2];
g_assert_nonnull(server);
@@ -69,12 +70,12 @@ static void server_leaks(void)
/* spice_server_add_ssl_client should not leak when it's given a disconnected socket */
g_test_expect_message(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*SSL_accept failed*");
- g_assert_cmpint(socketpair(AF_LOCAL, SOCK_STREAM, 0, sv), ==, 0);
- close(sv[1]);
- result = spice_server_add_ssl_client(server, sv[0], 1);
+ g_assert_cmpint(socket_newpair(SOCK_STREAM, 0, sv), ==, 0);
+ socket_close(sv[1]);
+ result = spice_server_add_ssl_client(server, socket_get_raw(sv[0]), 1);
g_assert_cmpint(result, ==, -1);
/* if the function fails, it should not close the socket */
- g_assert_cmpint(close(sv[0]), ==, 0);
+ g_assert_cmpint(socket_close(sv[0]), ==, 0);
spice_server_destroy(server);
basic_event_loop_destroy();
--
2.20.1
More information about the Spice-devel
mailing list