From fd5c272ec8f0e97cbcd22d57f34198fa449e97fc Mon Sep 17 00:00:00 2001 From: Junseok Kim Date: Tue, 29 Apr 2025 20:24:04 +0900 Subject: [PATCH] e_test_helper: Add name of test on test data and logging it Change-Id: I2a9a6226bf8973a43c244e8eb5be27c809caef6a --- src/bin/debug/e_test_helper.c | 117 ++++++++++++++++++++++------------ 1 file changed, 77 insertions(+), 40 deletions(-) diff --git a/src/bin/debug/e_test_helper.c b/src/bin/debug/e_test_helper.c index 40344f0b77..c601c5e5c9 100644 --- a/src/bin/debug/e_test_helper.c +++ b/src/bin/debug/e_test_helper.c @@ -42,9 +42,13 @@ typedef struct _Test_Helper_Data Eina_List *hooks; Eina_List *reg_wins; - Eina_Bool tc_running; - Eina_Bool tc_timer_needs; - Ecore_Timer *tc_timer; + struct + { + Eina_Bool is_running; + Eina_Bool needs_timer; + Ecore_Timer *timer; + Eina_Stringshare *name; + } current_test; } Test_Helper_Data; static Test_Helper_Data *th_data = NULL; @@ -147,7 +151,7 @@ static const Eldbus_Signal signals[] = { static const Eldbus_Method methods[] ={ { "StartTestCase", - NULL, + ELDBUS_ARGS({"s", "test name"}), ELDBUS_ARGS({"b", "accept or not"}), _e_test_helper_cb_testcase_start, 0 }, @@ -530,13 +534,19 @@ _e_test_helper_cb_tc_timeout(void *data) { EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, ECORE_CALLBACK_DONE); - th_data->tc_running = EINA_FALSE; + if (th_data->current_test.name) + { + ELOGF("E_TEST_HELPER", "Testcase timeout: %s", NULL, th_data->current_test.name); + eina_stringshare_del(th_data->current_test.name); + } + + th_data->current_test.is_running = EINA_FALSE; _e_test_helper_registrant_clear(); - if (th_data->tc_timer) + if (th_data->current_test.timer) { - ecore_timer_del(th_data->tc_timer); - th_data->tc_timer = NULL; + ecore_timer_del(th_data->current_test.timer); + th_data->current_test.timer = NULL; } return ECORE_CALLBACK_DONE; @@ -605,19 +615,37 @@ _e_test_helper_cb_testcase_start(const Eldbus_Service_Interface *iface EINA_UNUS { Eldbus_Message *reply; Eina_Bool res = EINA_FALSE; + char *test_name; reply = eldbus_message_method_return_new(msg); + if (!eldbus_message_arguments_get(msg, "s", &test_name)) + { + ERR("Error on eldbus_message_arguments_get()\n"); + goto end; + } + if (th_data) { - if (th_data->tc_timer) - ecore_timer_del(th_data->tc_timer); + if (th_data->current_test.timer) + ecore_timer_del(th_data->current_test.timer); + + if (th_data->current_test.needs_timer) + th_data->current_test.timer = ecore_timer_add(E_TC_TIMEOUT, _e_test_helper_cb_tc_timeout, NULL); - if (th_data->tc_timer_needs) - th_data->tc_timer = ecore_timer_add(E_TC_TIMEOUT, _e_test_helper_cb_tc_timeout, NULL); - res = th_data->tc_running = EINA_TRUE; + if (th_data->current_test.name) + { + eina_stringshare_del(th_data->current_test.name); + th_data->current_test.name = NULL; + } + + th_data->current_test.name = eina_stringshare_add(test_name); + res = th_data->current_test.is_running = EINA_TRUE; + + ELOGF("E_TEST_HELPER", "Testcase start: %s", NULL, th_data->current_test.name); } +end: eldbus_message_arguments_append(reply, "b", res); return reply; @@ -634,12 +662,21 @@ _e_test_helper_cb_testcase_end(const Eldbus_Service_Interface *iface EINA_UNUSED if (th_data) { - if (th_data->tc_timer) + ELOGF("E_TEST_HELPER", "Testcase end: %s", NULL, th_data->current_test.name); + + if (th_data->current_test.timer) { - ecore_timer_del(th_data->tc_timer); - th_data->tc_timer = NULL; + ecore_timer_del(th_data->current_test.timer); + th_data->current_test.timer = NULL; } - th_data->tc_running = EINA_FALSE; + + if (th_data->current_test.name) + { + eina_stringshare_del(th_data->current_test.name); + th_data->current_test.name = NULL; + } + + th_data->current_test.is_running = EINA_FALSE; res = EINA_TRUE; } @@ -667,20 +704,20 @@ _e_test_helper_cb_testcase_timeout_set(const Eldbus_Service_Interface *iface EIN if (th_data) { - if (set != th_data->tc_timer_needs) + if (set != th_data->current_test.needs_timer) { - th_data->tc_timer_needs = set; + th_data->current_test.needs_timer = set; if (!set) - ecore_timer_del(th_data->tc_timer); + ecore_timer_del(th_data->current_test.timer); } if (timeout > 0) { - if (th_data->tc_timer) - ecore_timer_del(th_data->tc_timer); + if (th_data->current_test.timer) + ecore_timer_del(th_data->current_test.timer); - if (th_data->tc_timer_needs) - th_data->tc_timer = ecore_timer_add(timeout, _e_test_helper_cb_tc_timeout, NULL); + if (th_data->current_test.needs_timer) + th_data->current_test.timer = ecore_timer_add(timeout, _e_test_helper_cb_tc_timeout, NULL); } res = EINA_TRUE; } @@ -1355,7 +1392,7 @@ _e_test_helper_cb_visibility_change(void *data EINA_UNUSED, Test_Helper_Reg_Win *reg_win = NULL; EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, ECORE_CALLBACK_PASS_ON); - if (!th_data->tc_running) return ECORE_CALLBACK_PASS_ON; + if (!th_data->current_test.is_running) return ECORE_CALLBACK_PASS_ON; ec = ev->ec; win = e_pixmap_res_id_get(ec->pixmap); @@ -1400,7 +1437,7 @@ _e_test_helper_cb_client_restack(void *data EINA_UNUSED, int type EINA_UNUSED, v Ecore_Window win; EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, ECORE_CALLBACK_PASS_ON); - if (!th_data->tc_running) return ECORE_CALLBACK_PASS_ON; + if (!th_data->current_test.is_running) return ECORE_CALLBACK_PASS_ON; ec = ev->ec; @@ -1427,7 +1464,7 @@ _e_test_helper_cb_client_rotation_end(void *data EINA_UNUSED, int type EINA_UNUS int rot; EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, ECORE_CALLBACK_PASS_ON); - if (!th_data->tc_running) return ECORE_CALLBACK_PASS_ON; + if (!th_data->current_test.is_running) return ECORE_CALLBACK_PASS_ON; ec = ev->ec; @@ -1455,7 +1492,7 @@ _e_test_helper_cb_client_focus_changed(void *data EINA_UNUSED, int type EINA_UNU Ecore_Window win = 0; EINA_SAFETY_ON_NULL_RETURN_VAL(th_data, ECORE_CALLBACK_PASS_ON); - if (!th_data->tc_running) return ECORE_CALLBACK_PASS_ON; + if (!th_data->current_test.is_running) return ECORE_CALLBACK_PASS_ON; ec = ev->ec; @@ -1511,7 +1548,7 @@ _e_test_helper_cb_set_render_condition(const Eldbus_Service_Interface *iface, co // a window should be registered for tracing, otherwise reply accept FALSE if (!th_data) goto fin; - if (!th_data->tc_running) goto fin; + if (!th_data->current_test.is_running) goto fin; if (!th_data->reg_wins) goto fin; if (!_e_test_helper_find_win_on_reg_list(win)) goto fin; @@ -1546,7 +1583,7 @@ _e_test_helper_cb_add_supported_aux_hint(const Eldbus_Service_Interface *iface, } if (!th_data) goto fin; - if (!th_data->tc_running) goto fin; + if (!th_data->current_test.is_running) goto fin; supported_list = e_hints_aux_hint_supported_add(hint); @@ -1574,7 +1611,7 @@ _e_test_helper_cb_del_supported_aux_hint(const Eldbus_Service_Interface *iface, } if (!th_data) goto fin; - if (!th_data->tc_running) goto fin; + if (!th_data->current_test.is_running) goto fin; supported_list = e_hints_aux_hint_supported_del(hint); @@ -1607,7 +1644,7 @@ _e_test_helper_cb_get_aux_hint(const Eldbus_Service_Interface *iface, const Eldb } if (!th_data) goto fin; - if (!th_data->tc_running) goto fin; + if (!th_data->current_test.is_running) goto fin; if (!th_data->reg_wins) goto fin; if (!(reg_win = _e_test_helper_find_win_on_reg_list(win))) goto fin; if (!(ec = reg_win->ec)) goto fin; @@ -1727,7 +1764,7 @@ _e_test_helper_cb_img_render(void *data EINA_UNUSED, // a window should be registered for tracing if (!th_data) return ECORE_CALLBACK_DONE; - if (!th_data->tc_running) return ECORE_CALLBACK_DONE; + if (!th_data->current_test.is_running) return ECORE_CALLBACK_DONE; if (!th_data->reg_wins) return ECORE_CALLBACK_DONE; win = e_pixmap_res_id_get(ec->pixmap); @@ -1754,7 +1791,7 @@ _e_test_helper_cb_effect_start(void *data EINA_UNUSED, // a window should be registered for tracing if (!th_data) return ECORE_CALLBACK_DONE; - if (!th_data->tc_running) return ECORE_CALLBACK_DONE; + if (!th_data->current_test.is_running) return ECORE_CALLBACK_DONE; if (!th_data->reg_wins) return ECORE_CALLBACK_DONE; win = e_pixmap_res_id_get(ec->pixmap); @@ -1786,7 +1823,7 @@ _e_test_helper_cb_effect_end(void *data EINA_UNUSED, // a window should be registered for tracing if (!th_data) return ECORE_CALLBACK_DONE; - if (!th_data->tc_running) return ECORE_CALLBACK_DONE; + if (!th_data->current_test.is_running) return ECORE_CALLBACK_DONE; if (!th_data->reg_wins) return ECORE_CALLBACK_DONE; win = e_pixmap_res_id_get(ec->pixmap); @@ -1810,7 +1847,7 @@ _e_test_helper_hook_cb_client_aux_hint_change(void *data EINA_UNUSED, E_Client * E_Comp_Wl_Aux_Hint *hint; EINA_SAFETY_ON_NULL_RETURN(th_data); - if (!th_data->tc_running) return; + if (!th_data->current_test.is_running) return; win = e_pixmap_res_id_get(ec->pixmap); if (!_e_test_helper_find_win_on_reg_list(win)) return; @@ -1835,7 +1872,7 @@ _e_test_helper_cb_client_iconic_state_changed(void *data EINA_UNUSED, int type E Eldbus_Message *sig; Ecore_Window win; - if (!th_data->tc_running) return ECORE_CALLBACK_PASS_ON; + if (!th_data->current_test.is_running) return ECORE_CALLBACK_PASS_ON; ec = ev->ec; if (!ec) return ECORE_CALLBACK_PASS_ON; @@ -1907,10 +1944,10 @@ e_test_helper_shutdown(void) _e_test_helper_registrant_clear(); - if (th_data->tc_timer) + if (th_data->current_test.timer) { - ecore_timer_del(th_data->tc_timer); - th_data->tc_timer = NULL; + ecore_timer_del(th_data->current_test.timer); + th_data->current_test.timer = NULL; } if (th_data->dbus_init_done_h) -- 2.34.1