summaryrefslogtreecommitdiff
path: root/src/tests/ecore_con
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-04-11 10:38:21 -0700
committerCedric BAIL <cedric@osg.samsung.com>2018-05-24 16:02:17 -0700
commitccb5642eb9c122deac271da5f8b1353f46d73160 (patch)
tree9a0a93692425677f4853a6f1b8dadd6ee430c5ec /src/tests/ecore_con
parent36f8a70041a8a16249a07d5b7131d57a8a6ea95b (diff)
Revert "efl_add_ref - fis to use efl_add properly with a parent."
This reverts commit 2fb5cc3ad09f6aaf82b5d1131ac5ed22ed848bd4. Most of this change where wrong as they didn't affect the destruction of the object. efl_add_ref allow for manual handling of the lifecycle of the object and make sure it is still alive during destructor. efl_add will not allow you to access an object after invalidate also efl.parent.get will always return NULL once the object is invalidated. Differential Revision: https://phab.enlightenment.org/D6062
Diffstat (limited to 'src/tests/ecore_con')
-rw-r--r--src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c46
1 files changed, 23 insertions, 23 deletions
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 b44bd0b..bc4fa98 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
@@ -282,29 +282,29 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_ok)
282 282
283 addr.sin_port = htons(12345); 283 addr.sin_port = htons(12345);
284 addr.sin_addr.s_addr = htonl(0xabcdefafU); 284 addr.sin_addr.s_addr = htonl(0xabcdefafU);
285 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 285 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
286 efl_net_ip_address_family_set(efl_added, AF_INET), 286 efl_net_ip_address_family_set(efl_added, AF_INET),
287 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)), 287 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)),
288 efl_net_ip_address_set(efl_added, slice)); 288 efl_net_ip_address_set(efl_added, slice));
289 _ipv4_check(o, &addr); 289 _ipv4_check(o, &addr);
290 efl_del(o); 290 efl_unref(o);
291 291
292 addr.sin_port = htons(8081); 292 addr.sin_port = htons(8081);
293 addr.sin_addr.s_addr = htonl(0); 293 addr.sin_addr.s_addr = htonl(0);
294 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 294 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
295 efl_net_ip_address_family_set(efl_added, AF_INET), 295 efl_net_ip_address_family_set(efl_added, AF_INET),
296 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)), 296 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)),
297 efl_net_ip_address_set(efl_added, slice)); 297 efl_net_ip_address_set(efl_added, slice));
298 _ipv4_check(o, &addr); 298 _ipv4_check(o, &addr);
299 efl_del(o); 299 efl_unref(o);
300 300
301 addr.sin_port = htons(0); 301 addr.sin_port = htons(0);
302 addr.sin_addr.s_addr = htonl(0x12345678); 302 addr.sin_addr.s_addr = htonl(0x12345678);
303 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 303 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
304 efl_net_ip_address_family_set(efl_added, AF_INET), 304 efl_net_ip_address_family_set(efl_added, AF_INET),
305 efl_net_ip_address_set(efl_added, slice)); 305 efl_net_ip_address_set(efl_added, slice));
306 _ipv4_check(o, &addr); 306 _ipv4_check(o, &addr);
307 efl_del(o); 307 efl_unref(o);
308} 308}
309EFL_END_TEST 309EFL_END_TEST
310 310
@@ -319,46 +319,46 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_fail)
319 Eo *o; 319 Eo *o;
320 320
321 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true"); 321 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true");
322 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get()); 322 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL);
323 ck_assert_ptr_eq(o, NULL); 323 ck_assert_ptr_eq(o, NULL);
324 TRAP_ERRORS_FINISH(1); 324 TRAP_ERRORS_FINISH(1);
325 325
326 TRAP_ERRORS_BEGIN(eina_safety, ERR, NULL); 326 TRAP_ERRORS_BEGIN(eina_safety, ERR, NULL);
327 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 327 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
328 efl_net_ip_address_family_set(efl_added, 12345)); 328 efl_net_ip_address_family_set(efl_added, 12345));
329 ck_assert_ptr_eq(o, NULL); 329 ck_assert_ptr_eq(o, NULL);
330 TRAP_ERRORS_FINISH(2); 330 TRAP_ERRORS_FINISH(2);
331 331
332 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true"); 332 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true");
333 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 333 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
334 efl_net_ip_address_set(efl_added, wrong_slice)); 334 efl_net_ip_address_set(efl_added, wrong_slice));
335 ck_assert_ptr_eq(o, NULL); 335 ck_assert_ptr_eq(o, NULL);
336 TRAP_ERRORS_FINISH(2); 336 TRAP_ERRORS_FINISH(2);
337 337
338 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true"); 338 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true");
339 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 339 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
340 efl_net_ip_address_port_set(efl_added, 1234)); 340 efl_net_ip_address_port_set(efl_added, 1234));
341 ck_assert_ptr_eq(o, NULL); 341 ck_assert_ptr_eq(o, NULL);
342 TRAP_ERRORS_FINISH(2); 342 TRAP_ERRORS_FINISH(2);
343 343
344 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true"); 344 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: pd->addr.sa_family == 0 is true");
345 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 345 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
346 efl_net_ip_address_port_set(efl_added, 1234), 346 efl_net_ip_address_port_set(efl_added, 1234),
347 efl_net_ip_address_set(efl_added, wrong_slice)); 347 efl_net_ip_address_set(efl_added, wrong_slice));
348 ck_assert_ptr_eq(o, NULL); 348 ck_assert_ptr_eq(o, NULL);
349 TRAP_ERRORS_FINISH(3); 349 TRAP_ERRORS_FINISH(3);
350 350
351 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address.len is true"); 351 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address.len is true");
352 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 352 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
353 efl_net_ip_address_family_set(efl_added, AF_INET), 353 efl_net_ip_address_family_set(efl_added, AF_INET),
354 efl_net_ip_address_set(efl_added, wrong_slice)); 354 efl_net_ip_address_set(efl_added, wrong_slice));
355 _ipv4_check(o, &addr); 355 _ipv4_check(o, &addr);
356 efl_del(o); 356 efl_unref(o);
357 TRAP_ERRORS_FINISH(1); 357 TRAP_ERRORS_FINISH(1);
358 358
359 addr.sin_port = htons(12345); 359 addr.sin_port = htons(12345);
360 addr.sin_addr.s_addr = htonl(0xabcdefafU); 360 addr.sin_addr.s_addr = htonl(0xabcdefafU);
361 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 361 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
362 efl_net_ip_address_family_set(efl_added, AF_INET), 362 efl_net_ip_address_family_set(efl_added, AF_INET),
363 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)), 363 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin_port)),
364 efl_net_ip_address_set(efl_added, slice)); 364 efl_net_ip_address_set(efl_added, slice));
@@ -388,7 +388,7 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_fail)
388 efl_net_ip_address_set(o, slice); 388 efl_net_ip_address_set(o, slice);
389 TRAP_ERRORS_FINISH(1); 389 TRAP_ERRORS_FINISH(1);
390 390
391 efl_del(o); 391 efl_unref(o);
392} 392}
393EFL_END_TEST 393EFL_END_TEST
394 394
@@ -713,21 +713,21 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_ok)
713 713
714 addr.sin6_port = htons(12345); 714 addr.sin6_port = htons(12345);
715 _ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8); 715 _ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8);
716 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 716 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
717 efl_net_ip_address_family_set(efl_added, AF_INET6), 717 efl_net_ip_address_family_set(efl_added, AF_INET6),
718 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)), 718 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)),
719 efl_net_ip_address_set(efl_added, slice)); 719 efl_net_ip_address_set(efl_added, slice));
720 _ipv6_check(o, &addr); 720 _ipv6_check(o, &addr);
721 efl_del(o); 721 efl_unref(o);
722 722
723 addr.sin6_port = htons(8081); 723 addr.sin6_port = htons(8081);
724 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 0); 724 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 0);
725 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 725 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
726 efl_net_ip_address_family_set(efl_added, AF_INET6), 726 efl_net_ip_address_family_set(efl_added, AF_INET6),
727 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)), 727 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)),
728 efl_net_ip_address_set(efl_added, slice)); 728 efl_net_ip_address_set(efl_added, slice));
729 _ipv6_check(o, &addr); 729 _ipv6_check(o, &addr);
730 efl_del(o); 730 efl_unref(o);
731 731
732} 732}
733EFL_END_TEST 733EFL_END_TEST
@@ -745,16 +745,16 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_fail)
745 /* generic errors checked at ecore_test_efl_net_ip_address_ipv4_manual_fail */ 745 /* generic errors checked at ecore_test_efl_net_ip_address_ipv4_manual_fail */
746 746
747 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address.len is true"); 747 TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address.len is true");
748 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 748 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
749 efl_net_ip_address_family_set(efl_added, AF_INET6), 749 efl_net_ip_address_family_set(efl_added, AF_INET6),
750 efl_net_ip_address_set(efl_added, wrong_slice)); 750 efl_net_ip_address_set(efl_added, wrong_slice));
751 _ipv6_check(o, &addr); 751 _ipv6_check(o, &addr);
752 efl_del(o); 752 efl_unref(o);
753 TRAP_ERRORS_FINISH(1); 753 TRAP_ERRORS_FINISH(1);
754 754
755 addr.sin6_port = htons(12345); 755 addr.sin6_port = htons(12345);
756 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 1); 756 _ipv6_set(&addr, 0, 0, 0, 0, 0, 0, 0, 1);
757 o = efl_add(EFL_NET_IP_ADDRESS_CLASS, efl_main_loop_get(), 757 o = efl_add_ref(EFL_NET_IP_ADDRESS_CLASS, NULL,
758 efl_net_ip_address_family_set(efl_added, AF_INET6), 758 efl_net_ip_address_family_set(efl_added, AF_INET6),
759 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)), 759 efl_net_ip_address_port_set(efl_added, ntohs(addr.sin6_port)),
760 efl_net_ip_address_set(efl_added, slice)); 760 efl_net_ip_address_set(efl_added, slice));
@@ -784,7 +784,7 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_fail)
784 efl_net_ip_address_set(o, slice); 784 efl_net_ip_address_set(o, slice);
785 TRAP_ERRORS_FINISH(1); 785 TRAP_ERRORS_FINISH(1);
786 786
787 efl_del(o); 787 efl_unref(o);
788 788
789} 789}
790EFL_END_TEST 790EFL_END_TEST