diff options
author | Stefan Hajnoczi | 2017-05-09 21:49:08 +0200 |
---|---|---|
committer | Stefan Hajnoczi | 2017-05-09 21:49:14 +0200 |
commit | 76d20ea0f1b26ebd5da2f5fb2fdf3250cde887bb (patch) | |
tree | bcb0e4a8f29bdcfa0f5785a09608bff57a82107c /tests/test-io-channel-socket.c | |
parent | Merge remote-tracking branch 'aurel32/tags/pull-tcg-mips-20170506' into staging (diff) | |
parent | qmp-shell: improve help (diff) | |
download | qemu-76d20ea0f1b26ebd5da2f5fb2fdf3250cde887bb.tar.gz qemu-76d20ea0f1b26ebd5da2f5fb2fdf3250cde887bb.tar.xz qemu-76d20ea0f1b26ebd5da2f5fb2fdf3250cde887bb.zip |
Merge remote-tracking branch 'armbru/tags/pull-qapi-2017-05-04-v3' into staging
QAPI patches for 2017-05-04
# gpg: Signature made Tue 09 May 2017 03:16:12 AM EDT
# gpg: using RSA key 0x3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* armbru/tags/pull-qapi-2017-05-04-v3: (28 commits)
qmp-shell: improve help
qmp-shell: don't show version greeting if unavailable
qmp-shell: Cope with query-commands error
qmp-shell: add -N option to skip negotiate
qmp-shell: add persistent command history
qobject-input-visitor: Catch misuse of end_struct vs. end_list
qapi: Document intended use of @name within alternate visits
qobject-input-visitor: Document full_name_nth()
qmp: Improve QMP dispatch error messages
sockets: Delete unused helper socket_address_crumple()
sockets: Limit SocketAddressLegacy to external interfaces
sockets: Rename SocketAddressFlat to SocketAddress
sockets: Rename SocketAddress to SocketAddressLegacy
qapi: New QAPI_CLONE_MEMBERS()
sockets: Prepare inet_parse() for flattened SocketAddress
sockets: Prepare vsock_parse() for flattened SocketAddress
test-qga: Actually test 0xff sync bytes
fdc-test: Avoid deprecated 'change' command
QemuOpts: Simplify qemu_opts_to_qdict()
block: Simplify bdrv_append_temp_snapshot() logic
...
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/test-io-channel-socket.c')
-rw-r--r-- | tests/test-io-channel-socket.c | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c index c5c131479c..d357cd2a8e 100644 --- a/tests/test-io-channel-socket.c +++ b/tests/test-io-channel-socket.c @@ -125,12 +125,12 @@ static void test_io_channel_setup_sync(SocketAddress *listen_addr, lioc = qio_channel_socket_new(); qio_channel_socket_listen_sync(lioc, listen_addr, &error_abort); - if (listen_addr->type == SOCKET_ADDRESS_KIND_INET) { + if (listen_addr->type == SOCKET_ADDRESS_TYPE_INET) { SocketAddress *laddr = qio_channel_socket_get_local_address( lioc, &error_abort); - g_free(connect_addr->u.inet.data->port); - connect_addr->u.inet.data->port = g_strdup(laddr->u.inet.data->port); + g_free(connect_addr->u.inet.port); + connect_addr->u.inet.port = g_strdup(laddr->u.inet.port); qapi_free_SocketAddress(laddr); } @@ -186,12 +186,12 @@ static void test_io_channel_setup_async(SocketAddress *listen_addr, g_assert(!data.err); - if (listen_addr->type == SOCKET_ADDRESS_KIND_INET) { + if (listen_addr->type == SOCKET_ADDRESS_TYPE_INET) { SocketAddress *laddr = qio_channel_socket_get_local_address( lioc, &error_abort); - g_free(connect_addr->u.inet.data->port); - connect_addr->u.inet.data->port = g_strdup(laddr->u.inet.data->port); + g_free(connect_addr->u.inet.port); + connect_addr->u.inet.port = g_strdup(laddr->u.inet.port); qapi_free_SocketAddress(laddr); } @@ -300,16 +300,14 @@ static void test_io_channel_ipv4(bool async) SocketAddress *listen_addr = g_new0(SocketAddress, 1); SocketAddress *connect_addr = g_new0(SocketAddress, 1); - listen_addr->type = SOCKET_ADDRESS_KIND_INET; - listen_addr->u.inet.data = g_new(InetSocketAddress, 1); - *listen_addr->u.inet.data = (InetSocketAddress) { + listen_addr->type = SOCKET_ADDRESS_TYPE_INET; + listen_addr->u.inet = (InetSocketAddress) { .host = g_strdup("127.0.0.1"), .port = NULL, /* Auto-select */ }; - connect_addr->type = SOCKET_ADDRESS_KIND_INET; - connect_addr->u.inet.data = g_new(InetSocketAddress, 1); - *connect_addr->u.inet.data = (InetSocketAddress) { + connect_addr->type = SOCKET_ADDRESS_TYPE_INET; + connect_addr->u.inet = (InetSocketAddress) { .host = g_strdup("127.0.0.1"), .port = NULL, /* Filled in later */ }; @@ -338,16 +336,14 @@ static void test_io_channel_ipv6(bool async) SocketAddress *listen_addr = g_new0(SocketAddress, 1); SocketAddress *connect_addr = g_new0(SocketAddress, 1); - listen_addr->type = SOCKET_ADDRESS_KIND_INET; - listen_addr->u.inet.data = g_new(InetSocketAddress, 1); - *listen_addr->u.inet.data = (InetSocketAddress) { + listen_addr->type = SOCKET_ADDRESS_TYPE_INET; + listen_addr->u.inet = (InetSocketAddress) { .host = g_strdup("::1"), .port = NULL, /* Auto-select */ }; - connect_addr->type = SOCKET_ADDRESS_KIND_INET; - connect_addr->u.inet.data = g_new(InetSocketAddress, 1); - *connect_addr->u.inet.data = (InetSocketAddress) { + connect_addr->type = SOCKET_ADDRESS_TYPE_INET; + connect_addr->u.inet = (InetSocketAddress) { .host = g_strdup("::1"), .port = NULL, /* Filled in later */ }; @@ -378,13 +374,11 @@ static void test_io_channel_unix(bool async) SocketAddress *connect_addr = g_new0(SocketAddress, 1); #define TEST_SOCKET "test-io-channel-socket.sock" - listen_addr->type = SOCKET_ADDRESS_KIND_UNIX; - listen_addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); - listen_addr->u.q_unix.data->path = g_strdup(TEST_SOCKET); + listen_addr->type = SOCKET_ADDRESS_TYPE_UNIX; + listen_addr->u.q_unix.path = g_strdup(TEST_SOCKET); - connect_addr->type = SOCKET_ADDRESS_KIND_UNIX; - connect_addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); - connect_addr->u.q_unix.data->path = g_strdup(TEST_SOCKET); + connect_addr->type = SOCKET_ADDRESS_TYPE_UNIX; + connect_addr->u.q_unix.path = g_strdup(TEST_SOCKET); test_io_channel(async, listen_addr, connect_addr, true); @@ -427,13 +421,11 @@ static void test_io_channel_unix_fd_pass(void) fdsend[1] = testfd; fdsend[2] = testfd; - listen_addr->type = SOCKET_ADDRESS_KIND_UNIX; - listen_addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); - listen_addr->u.q_unix.data->path = g_strdup(TEST_SOCKET); + listen_addr->type = SOCKET_ADDRESS_TYPE_UNIX; + listen_addr->u.q_unix.path = g_strdup(TEST_SOCKET); - connect_addr->type = SOCKET_ADDRESS_KIND_UNIX; - connect_addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); - connect_addr->u.q_unix.data->path = g_strdup(TEST_SOCKET); + connect_addr->type = SOCKET_ADDRESS_TYPE_UNIX; + connect_addr->u.q_unix.path = g_strdup(TEST_SOCKET); test_io_channel_setup_sync(listen_addr, connect_addr, &src, &dst); |