]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
io: wait for incoming client in socket test
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 8 Mar 2016 15:26:39 +0000 (15:26 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 10 Mar 2016 17:10:18 +0000 (17:10 +0000)
Exercise the GSource code for server sockets by calling
qio_channel_wait() prior to accepting the incoming client.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tests/test-io-channel-socket.c

index 4c16da1add23b28b5ba73d84358fc6b20d2ddb0d..ae665f5ea01284999d944a21d392ed46c6e43bda 100644 (file)
@@ -114,6 +114,7 @@ static void test_io_channel_setup_sync(SocketAddress *listen_addr,
         QIO_CHANNEL_SOCKET(*src), connect_addr, &error_abort);
     qio_channel_set_delay(*src, false);
 
+    qio_channel_wait(QIO_CHANNEL(lioc), G_IO_IN);
     *dst = QIO_CHANNEL(qio_channel_socket_accept(lioc, &error_abort));
     g_assert(*dst);
 
@@ -181,6 +182,7 @@ static void test_io_channel_setup_async(SocketAddress *listen_addr,
 
     g_assert(!data.err);
 
+    qio_channel_wait(QIO_CHANNEL(lioc), G_IO_IN);
     *dst = QIO_CHANNEL(qio_channel_socket_accept(lioc, &error_abort));
     g_assert(*dst);