forked from enlightenment/efl
tests - make ecore con test suite reliable and work
basically ecore_con's test suite was broken. ipv6 checks were broken. you now need to set an env var to get ipv6 tested. using eocre_con to detetc it didnt init eina or ecore_con and if you do init these then the other tests that check return values from these fail... so make it an env var if you want to test ipv6. now it's reliable and works!
This commit is contained in:
parent
2b91a48d72
commit
e1605e6405
|
@ -520,6 +520,7 @@ START_TEST(ecore_test_ecore_con_shutdown_bef_init)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
eina_init();
|
||||||
ret = ecore_con_shutdown();
|
ret = ecore_con_shutdown();
|
||||||
fail_if(ret != 0);
|
fail_if(ret != 0);
|
||||||
|
|
||||||
|
@ -528,6 +529,7 @@ START_TEST(ecore_test_ecore_con_shutdown_bef_init)
|
||||||
|
|
||||||
ret = ecore_con_shutdown();
|
ret = ecore_con_shutdown();
|
||||||
fail_if(ret != 0);
|
fail_if(ret != 0);
|
||||||
|
eina_shutdown();
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
|
@ -717,34 +717,6 @@ END_TEST
|
||||||
|
|
||||||
/* IPv6 *****************************************************************/
|
/* IPv6 *****************************************************************/
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_ipv6_enabled(void)
|
|
||||||
{
|
|
||||||
SOCKET fd;
|
|
||||||
struct sockaddr_in6 addr = {
|
|
||||||
.sin6_family = AF_INET6,
|
|
||||||
};
|
|
||||||
int r;
|
|
||||||
|
|
||||||
fd = socket(AF_INET6, SOCK_STREAM, 0);
|
|
||||||
if (fd == INVALID_SOCKET)
|
|
||||||
{
|
|
||||||
Eina_Error err = efl_net_socket_error_get();
|
|
||||||
fprintf(stderr, "WARNING: failed socket(AF_INET6, SOCK_STREAM, 0): %s\n", eina_error_msg_get(err));
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = bind(fd, &addr, sizeof(addr));
|
|
||||||
if (r != 0)
|
|
||||||
{
|
|
||||||
Eina_Error err = efl_net_socket_error_get();
|
|
||||||
fprintf(stderr, "WARNING: failed bind(" SOCKET_FMT ", {.sin6_family=AF_INET6, .sin6_addr={0}, .sin6_port=0}, sizeof(struct sockaddr_in6)): %s\n", fd, eina_error_msg_get(err));
|
|
||||||
}
|
|
||||||
|
|
||||||
closesocket(fd);
|
|
||||||
return r == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ipv6_check(Eo *o, const struct sockaddr_in6 *addr)
|
_ipv6_check(Eo *o, const struct sockaddr_in6 *addr)
|
||||||
{
|
{
|
||||||
|
@ -1294,9 +1266,12 @@ void ecore_con_test_efl_net_ip_address(TCase *tc)
|
||||||
tcase_add_test(tc, ecore_test_efl_net_ip_address_ipv4_resolve_fail);
|
tcase_add_test(tc, ecore_test_efl_net_ip_address_ipv4_resolve_fail);
|
||||||
tcase_add_test(tc, ecore_test_efl_net_ip_address_ipv4_checks);
|
tcase_add_test(tc, ecore_test_efl_net_ip_address_ipv4_checks);
|
||||||
|
|
||||||
if (!_ipv6_enabled())
|
if (!getenv("EFL_TEST_ECORE_CON_IPV6"))
|
||||||
{
|
{
|
||||||
fputs("\nWARNING: your system has IPv6 disabled. Skipping IPv6 tests!\n\n", stderr);
|
fputs("\nWARNING: your system has IPv6 disabled. Skipping IPv6 tests!\n\n"
|
||||||
|
"\nexport EFL_TEST_ECORE_CON_IPV6=1\n"
|
||||||
|
"\nTo enable it\n",
|
||||||
|
stderr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue