aboutsummaryrefslogtreecommitdiff
path: root/tests/test-char.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-07-09 23:24:11 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2019-08-22 17:30:25 +0400
commite7b6ba4186f243f149b0d8cddc129fe681ba3912 (patch)
tree3178a49c9a739a34e54cc59ee976092d10ec5f65 /tests/test-char.c
parent71714178fa35dff1b9afc0762501c81360f7db82 (diff)
test-char: skip tcp tests if ipv4 check failed
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'tests/test-char.c')
-rw-r--r--tests/test-char.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/test-char.c b/tests/test-char.c
index f9440cdcfd..2dde620afc 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -15,6 +15,7 @@
#include "io/channel-socket.h"
#include "qapi/qobject-input-visitor.h"
#include "qapi/qapi-visit-sockets.h"
+#include "socket-helpers.h"
static bool quit;
@@ -1356,11 +1357,17 @@ static void char_hotswap_test(void)
int main(int argc, char **argv)
{
+ bool has_ipv4, has_ipv6;
+
qemu_init_main_loop(&error_abort);
socket_init();
g_test_init(&argc, &argv, NULL);
+ if (socket_check_protocol_support(&has_ipv4, &has_ipv6) < 0) {
+ return -1;
+ }
+
module_call_init(MODULE_INIT_QOM);
qemu_add_opts(&qemu_chardev_opts);
@@ -1438,10 +1445,12 @@ int main(int argc, char **argv)
g_test_add_data_func("/char/socket/client/wait-conn-fdpass/" # name, \
&client6 ##name, char_socket_client_test)
- SOCKET_SERVER_TEST(tcp, &tcpaddr);
- SOCKET_CLIENT_TEST(tcp, &tcpaddr);
- g_test_add_data_func("/char/socket/server/two-clients/tcp", &tcpaddr,
- char_socket_server_two_clients_test);
+ if (has_ipv4) {
+ SOCKET_SERVER_TEST(tcp, &tcpaddr);
+ SOCKET_CLIENT_TEST(tcp, &tcpaddr);
+ g_test_add_data_func("/char/socket/server/two-clients/tcp", &tcpaddr,
+ char_socket_server_two_clients_test);
+ }
#ifndef WIN32
SOCKET_SERVER_TEST(unix, &unixaddr);
SOCKET_CLIENT_TEST(unix, &unixaddr);