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>
This commit is contained in:
Marc-André Lureau 2019-07-09 23:24:11 +04:00
parent 71714178fa
commit e7b6ba4186
2 changed files with 14 additions and 5 deletions

View File

@ -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-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/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-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$(EXESUF): tests/test-aio.o $(test-block-obj-y)
tests/test-aio-multithread$(EXESUF): tests/test-aio-multithread.o $(test-block-obj-y) tests/test-aio-multithread$(EXESUF): tests/test-aio-multithread.o $(test-block-obj-y)

View File

@ -15,6 +15,7 @@
#include "io/channel-socket.h" #include "io/channel-socket.h"
#include "qapi/qobject-input-visitor.h" #include "qapi/qobject-input-visitor.h"
#include "qapi/qapi-visit-sockets.h" #include "qapi/qapi-visit-sockets.h"
#include "socket-helpers.h"
static bool quit; static bool quit;
@ -1356,11 +1357,17 @@ static void char_hotswap_test(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
bool has_ipv4, has_ipv6;
qemu_init_main_loop(&error_abort); qemu_init_main_loop(&error_abort);
socket_init(); socket_init();
g_test_init(&argc, &argv, NULL); g_test_init(&argc, &argv, NULL);
if (socket_check_protocol_support(&has_ipv4, &has_ipv6) < 0) {
return -1;
}
module_call_init(MODULE_INIT_QOM); module_call_init(MODULE_INIT_QOM);
qemu_add_opts(&qemu_chardev_opts); 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, \ g_test_add_data_func("/char/socket/client/wait-conn-fdpass/" # name, \
&client6 ##name, char_socket_client_test) &client6 ##name, char_socket_client_test)
SOCKET_SERVER_TEST(tcp, &tcpaddr); if (has_ipv4) {
SOCKET_CLIENT_TEST(tcp, &tcpaddr); SOCKET_SERVER_TEST(tcp, &tcpaddr);
g_test_add_data_func("/char/socket/server/two-clients/tcp", &tcpaddr, SOCKET_CLIENT_TEST(tcp, &tcpaddr);
char_socket_server_two_clients_test); g_test_add_data_func("/char/socket/server/two-clients/tcp", &tcpaddr,
char_socket_server_two_clients_test);
}
#ifndef WIN32 #ifndef WIN32
SOCKET_SERVER_TEST(unix, &unixaddr); SOCKET_SERVER_TEST(unix, &unixaddr);
SOCKET_CLIENT_TEST(unix, &unixaddr); SOCKET_CLIENT_TEST(unix, &unixaddr);