summaryrefslogtreecommitdiff
path: root/src/tests/ecore_con
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-29 14:56:57 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-29 14:56:57 +0900
commite1605e6405cc73837497bb8c961a7220dd6916fa (patch)
tree16bd5d78f834331b4d6ee67ebffbdfc18beb156e /src/tests/ecore_con
parent2b91a48d72071e195b691156a5755cb7e76fdc37 (diff)
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!
Diffstat (limited to 'src/tests/ecore_con')
-rw-r--r--src/tests/ecore_con/ecore_con_test_ecore_con.c2
-rw-r--r--src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c35
2 files changed, 7 insertions, 30 deletions
diff --git a/src/tests/ecore_con/ecore_con_test_ecore_con.c b/src/tests/ecore_con/ecore_con_test_ecore_con.c
index 1a9ada6..87522c0 100644
--- a/src/tests/ecore_con/ecore_con_test_ecore_con.c
+++ b/src/tests/ecore_con/ecore_con_test_ecore_con.c
@@ -520,6 +520,7 @@ START_TEST(ecore_test_ecore_con_shutdown_bef_init)
520{ 520{
521 int ret; 521 int ret;
522 522
523 eina_init();
523 ret = ecore_con_shutdown(); 524 ret = ecore_con_shutdown();
524 fail_if(ret != 0); 525 fail_if(ret != 0);
525 526
@@ -528,6 +529,7 @@ START_TEST(ecore_test_ecore_con_shutdown_bef_init)
528 529
529 ret = ecore_con_shutdown(); 530 ret = ecore_con_shutdown();
530 fail_if(ret != 0); 531 fail_if(ret != 0);
532 eina_shutdown();
531} 533}
532END_TEST 534END_TEST
533 535
diff --git a/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c b/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
index 6dba477..5bb8ddb 100644
--- a/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
+++ b/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
@@ -717,34 +717,6 @@ END_TEST
717 717
718/* IPv6 *****************************************************************/ 718/* IPv6 *****************************************************************/
719 719
720static Eina_Bool
721_ipv6_enabled(void)
722{
723 SOCKET fd;
724 struct sockaddr_in6 addr = {
725 .sin6_family = AF_INET6,
726 };
727 int r;
728
729 fd = socket(AF_INET6, SOCK_STREAM, 0);
730 if (fd == INVALID_SOCKET)
731 {
732 Eina_Error err = efl_net_socket_error_get();
733 fprintf(stderr, "WARNING: failed socket(AF_INET6, SOCK_STREAM, 0): %s\n", eina_error_msg_get(err));
734 return EINA_FALSE;
735 }
736
737 r = bind(fd, &addr, sizeof(addr));
738 if (r != 0)
739 {
740 Eina_Error err = efl_net_socket_error_get();
741 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));
742 }
743
744 closesocket(fd);
745 return r == 0;
746}
747
748static void 720static void
749_ipv6_check(Eo *o, const struct sockaddr_in6 *addr) 721_ipv6_check(Eo *o, const struct sockaddr_in6 *addr)
750{ 722{
@@ -1294,9 +1266,12 @@ void ecore_con_test_efl_net_ip_address(TCase *tc)
1294 tcase_add_test(tc, ecore_test_efl_net_ip_address_ipv4_resolve_fail); 1266 tcase_add_test(tc, ecore_test_efl_net_ip_address_ipv4_resolve_fail);
1295 tcase_add_test(tc, ecore_test_efl_net_ip_address_ipv4_checks); 1267 tcase_add_test(tc, ecore_test_efl_net_ip_address_ipv4_checks);
1296 1268
1297 if (!_ipv6_enabled()) 1269 if (!getenv("EFL_TEST_ECORE_CON_IPV6"))
1298 { 1270 {
1299 fputs("\nWARNING: your system has IPv6 disabled. Skipping IPv6 tests!\n\n", stderr); 1271 fputs("\nWARNING: your system has IPv6 disabled. Skipping IPv6 tests!\n\n"
1272 "\nexport EFL_TEST_ECORE_CON_IPV6=1\n"
1273 "\nTo enable it\n",
1274 stderr);
1300 return; 1275 return;
1301 } 1276 }
1302 1277