Skip to content

Commit

Permalink
test-char: skip tcp tests if ipv4 check failed
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
  • Loading branch information
elmarco committed Aug 22, 2019
1 parent 7171417 commit e7b6ba4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ tests/check-qlit$(EXESUF): tests/check-qlit.o $(test-util-obj-y)
tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(test-qom-obj-y)
tests/check-qom-proplist$(EXESUF): tests/check-qom-proplist.o $(test-qom-obj-y)

tests/test-char$(EXESUF): tests/test-char.o $(test-util-obj-y) $(qtest-obj-y) $(test-io-obj-y) $(chardev-obj-y)
tests/test-char$(EXESUF): tests/test-char.o $(test-util-obj-y) $(qtest-obj-y) $(test-io-obj-y) $(chardev-obj-y) tests/socket-helpers.o
tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(test-block-obj-y)
tests/test-aio$(EXESUF): tests/test-aio.o $(test-block-obj-y)
tests/test-aio-multithread$(EXESUF): tests/test-aio-multithread.o $(test-block-obj-y)
Expand Down
17 changes: 13 additions & 4 deletions tests/test-char.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e7b6ba4

Please sign in to comment.