From 7db67aaea842e4eb852ed9edbd0941b67648951b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 6 Oct 2016 15:42:03 +0900 Subject: [PATCH] eo: Test deadlock after finalize (shared objects) This is a test case for 258cfbbe8013b50a7d3f89ab863dab73fce Unfortunately there are many other functions that we should be testing, not just efl_finalized_get(). --- src/tests/eo/suite/eo_test_general.c | 30 +++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c index 73418337d0..e08d69699a 100644 --- a/src/tests/eo/suite/eo_test_general.c +++ b/src/tests/eo/suite/eo_test_general.c @@ -4,6 +4,11 @@ #include +#ifndef _WIN32 +# include +# include +#endif + #include #include "eo_suite.h" @@ -1373,6 +1378,9 @@ thr1(void *data, Eina_Thread t EINA_UNUSED) Eo *obj = efl_add(DOMAIN_CLASS, NULL); printf("ADD2 DONE = %p\n", obj); + printf("VERIFY finalized_get()\n"); + fail_if(!efl_finalized_get(d->objs)); + printf("SET ON LOCAL\n"); domain_a_set(obj, 1234); fail_if(domain_a_get(obj) != 1234); @@ -1410,6 +1418,15 @@ thr1(void *data, Eina_Thread t EINA_UNUSED) return NULL; } +#ifndef _WIN32 +static void +_timeout(int val EINA_UNUSED) +{ + printf("TIMED OUT!\n"); + exit(-1); +} +#endif + START_TEST(eo_domain) { Eo *obj, *objs; @@ -1417,6 +1434,11 @@ START_TEST(eo_domain) printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); efl_object_init(); +#ifndef _WIN32 + signal(SIGALRM, _timeout); + alarm(10); +#endif + fail_if(efl_domain_get() != EFL_ID_DOMAIN_MAIN); fail_if(efl_domain_switch(EFL_ID_DOMAIN_THREAD) != EINA_TRUE); @@ -1459,7 +1481,7 @@ START_TEST(eo_domain) efl_domain_current_push(EFL_ID_DOMAIN_SHARED); printf("ADDS\n"); - objs = efl_add(DOMAIN_CLASS, NULL); + objs = efl_add(DOMAIN_CLASS, NULL, domain_a_set(efl_added, 42)); printf("ADDS DONE = %p\n", objs); efl_domain_current_pop(); @@ -1484,11 +1506,17 @@ START_TEST(eo_domain) eina_thread_join(t); printf("JOIN DONE\n"); + printf("DELETING OBJECTS\n"); efl_del(obj); efl_del(objs); efl_object_shutdown(); printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); + +#ifndef _WIN32 + alarm(0); + signal(SIGALRM, NULL); +#endif } END_TEST