tests/ecore-con: add a global timeout timer for all tests

Summary:
it's possible for many tests in this suite to hang indefinitely, so ensure
that they terminate eventually instead of holding up the build

ref T6838

Reviewers: stefan_schmidt, bu5hm4n, devilhorns, Hermet

Reviewed By: Hermet

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T6838

Differential Revision: https://phab.enlightenment.org/D6542
This commit is contained in:
Mike Blumenkrantz 2018-07-10 11:06:53 +09:00 committed by Hermet Park
parent 86cea88353
commit 53fa0c1520
1 changed files with 15 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include "ecore_con_suite.h"
#include "../efl_check.h"
#include <Ecore.h>
#include <Ecore_Con.h>
static const Efl_Test_Case etc[] = {
@ -14,13 +15,27 @@ static const Efl_Test_Case etc[] = {
{ NULL, NULL }
};
#define TIMEOUT 10.0
static Ecore_Timer *timeout_timer;
static Eina_Bool
_timeout_timer(void *d EINA_UNUSED)
{
timeout_timer = NULL;
ck_abort_msg("Timeout exceeded!");
return EINA_FALSE;
}
SUITE_INIT(ecore_con)
{
ck_assert_int_eq(ecore_con_init(), 1);
timeout_timer = ecore_timer_add(TIMEOUT, _timeout_timer, NULL);
}
SUITE_SHUTDOWN(ecore_con)
{
if (timeout_timer) ecore_timer_del(timeout_timer);
timeout_timer = NULL;
ck_assert_int_eq(ecore_con_shutdown(), 0);
}