tests/elm: fail tests if unexpected warnings or errors occur

Summary:
warnings and errors should never occur in unit tests unless they are
intentionally triggered. this will help catch regressions
Depends on D9256

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9257
This commit is contained in:
Mike Blumenkrantz 2019-07-10 13:57:40 -04:00
parent 65c47edc3d
commit f5c03fe194
4 changed files with 10 additions and 5 deletions

View File

@ -7,6 +7,8 @@
#include "../efl_check.h"
#include "suite_helpers.h"
extern Eina_Bool abort_on_warnings;
static const Efl_Test_Case etc[] = {
{ "elm_config", elm_test_config },
{ "elm_check", elm_test_check },
@ -96,6 +98,7 @@ main(int argc, char **argv)
return 0;
failed_count = suite_setup(EINA_TRUE);
abort_on_warnings = EINA_TRUE;
failed_count += _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
"Elementary", etc, SUITE_INIT_FN(elm2), SUITE_SHUTDOWN_FN(elm));

View File

@ -454,7 +454,6 @@ static void
_do_quit()
{
itc.func.content_get = NULL;
fail_on_errors_teardown();
ecore_main_loop_quit();
}
@ -514,7 +513,6 @@ EFL_START_TEST(elm_genlist_test_tree_expand)
evas_object_resize(genlist, 100, 10 + 10 * NUM_TREE_ITEMS);
evas_object_show(win);
evas_object_resize(win, 100, 10 + 10 * NUM_TREE_ITEMS);
fail_on_errors_setup();
ecore_main_loop_begin();
}
EFL_END_TEST

View File

@ -81,8 +81,6 @@ EFL_START_TEST(elm_naviframe_test_content_preserve_on_pop)
win = win_add(NULL, "naviframe", ELM_WIN_BASIC);
fail_on_errors_setup();
naviframe = elm_naviframe_add(win);
elm_naviframe_content_preserve_on_pop_set(naviframe, EINA_TRUE);
@ -109,7 +107,6 @@ EFL_START_TEST(elm_naviframe_test_content_preserve_on_pop)
elm_object_signal_emit(button, "elm,action,click", "elm");
ecore_main_loop_begin();
fail_on_errors_teardown();
}
EFL_END_TEST

View File

@ -9,6 +9,7 @@
#include "elm_widget.h"
#include "ecore_private.h"
#include "ecore_evas_private.h"
#include "suite_helpers.h"
static int main_pid = -1;
@ -19,6 +20,8 @@ static Eina_Bool legacy_mode = EINA_FALSE;
static int log_abort;
static int log_abort_level;
Eina_Bool abort_on_warnings = EINA_FALSE;
void elm_test_init(TCase *tc);
SUITE_INIT(elm)
@ -34,6 +37,8 @@ _elm2_suite_init(void)
if (getpid() != main_pid)
{
if (abort_on_warnings)
fail_on_errors_setup();
ecore_fork_reset();
return;
}
@ -44,6 +49,8 @@ _elm2_suite_init(void)
did_shutdown = 1;
}
ck_assert_int_eq(elm_init(1, args), 1);
if (abort_on_warnings)
fail_on_errors_setup();
}
void