diff options
author | Markus Armbruster <armbru@redhat.com> | 2024-02-03 09:02:26 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2024-02-14 07:45:08 +0100 |
commit | f396da77ca59cc67fedb54fe4ea22fbb961270d3 (patch) | |
tree | 3e5bd861697486fd159320eae040d97e515427f6 /tests/unit | |
parent | a58c439a2d2c07ec05429d8774d75faeef4eac1e (diff) |
tests/unit/test-char: Fix qemu_socket(), make_udp_socket() check
qemu_socket() and make_udp_socket() return a file descriptor on
success, -1 on failure. The check misinterprets 0 as failure. Fix
that.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240203080228.2766159-3-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/test-char.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/unit/test-char.c b/tests/unit/test-char.c index 2aea49c3b6..f273ce5226 100644 --- a/tests/unit/test-char.c +++ b/tests/unit/test-char.c @@ -556,7 +556,7 @@ static int make_udp_socket(int *port) socklen_t alen = sizeof(addr); int ret, sock = qemu_socket(PF_INET, SOCK_DGRAM, 0); - g_assert_cmpint(sock, >, 0); + g_assert_cmpint(sock, >=, 0); addr.sin_family = AF_INET ; addr.sin_addr.s_addr = htonl(INADDR_ANY); addr.sin_port = 0; @@ -1407,7 +1407,7 @@ static void char_hotswap_test(void) int port; int sock = make_udp_socket(&port); - g_assert_cmpint(sock, >, 0); + g_assert_cmpint(sock, >=, 0); chr_args = g_strdup_printf("udp:127.0.0.1:%d", port); |