summaryrefslogtreecommitdiff
path: root/src/tests/elementary/elm_suite.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-04-17 15:43:52 +0200
committerStefan Schmidt <stefan@osg.samsung.com>2018-04-17 15:43:52 +0200
commit67705589ac757baeccfeba12b938e815699465f8 (patch)
treea32d58d620df26e3026c73dc3d4dc5f0b61bb8cd /src/tests/elementary/elm_suite.c
parent22cb35c9a4d6efbc12e814b4a9d8a068e4b2d94f (diff)
tests: preload elm_init and default theme groups in elm_suite
Summary: opening the default theme file can take up to 0.2s in worst case during a test ref T6864 Depends on D5914 Reviewers: stefan_schmidt Reviewed By: stefan_schmidt Subscribers: cedric Maniphest Tasks: T6864 Differential Revision: https://phab.enlightenment.org/D5915
Diffstat (limited to 'src/tests/elementary/elm_suite.c')
-rw-r--r--src/tests/elementary/elm_suite.c52
1 files changed, 47 insertions, 5 deletions
diff --git a/src/tests/elementary/elm_suite.c b/src/tests/elementary/elm_suite.c
index 30b7e3a..0bf03b3 100644
--- a/src/tests/elementary/elm_suite.c
+++ b/src/tests/elementary/elm_suite.c
@@ -6,6 +6,9 @@
6#include "elm_suite.h" 6#include "elm_suite.h"
7#include "../efl_check.h" 7#include "../efl_check.h"
8 8
9static int main_pid = -1;
10static Eina_Bool did_shutdown;
11
9static const Efl_Test_Case etc[] = { 12static const Efl_Test_Case etc[] = {
10 { "elm_config", elm_test_config }, 13 { "elm_config", elm_test_config },
11 { "elm_check", elm_test_check }, 14 { "elm_check", elm_test_check },
@@ -93,6 +96,24 @@ SUITE_INIT(elm)
93 ck_assert_int_eq(elm_init(1, args), 1); 96 ck_assert_int_eq(elm_init(1, args), 1);
94} 97}
95 98
99SUITE_INIT(elm2)
100{
101 char *args[] = { "exe" };
102
103 if (getpid() != main_pid)
104 {
105 ecore_fork_reset();
106 return;
107 }
108 if (!did_shutdown)
109 {
110 /* if running un-forked then remove cached init */
111 ck_assert_int_eq(elm_shutdown(), 0);
112 did_shutdown = 1;
113 }
114 ck_assert_int_eq(elm_init(1, args), 1);
115}
116
96SUITE_SHUTDOWN(elm) 117SUITE_SHUTDOWN(elm)
97{ 118{
98 ck_assert_int_eq(elm_shutdown(), 0); 119 ck_assert_int_eq(elm_shutdown(), 0);
@@ -123,13 +144,34 @@ main(int argc, char **argv)
123 if (eina_streq(getenv("ELM_ENGINE"), "buffer")) 144 if (eina_streq(getenv("ELM_ENGINE"), "buffer"))
124 putenv("TESTS_GL_DISABLED=1"); 145 putenv("TESTS_GL_DISABLED=1");
125 146
147 main_pid = getpid();
148
126 failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1, 149 failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
127 "Elementary_Init", etc_init, SUITE_INIT_FN(elm), SUITE_SHUTDOWN_FN(elm)); 150 "Elementary_Init", etc_init, SUITE_INIT_FN(elm), SUITE_SHUTDOWN_FN(elm));
128 if (!failed_count) 151 failed_count += !elm_init(1, (char*[]){"exe"});
129 { 152 EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255);
130 failed_count += _efl_suite_build_and_run(argc - 1, (const char **)argv + 1, 153 /* preload default theme */
131 "Elementary", etc, SUITE_INIT_FN(elm), SUITE_SHUTDOWN_FN(elm)); 154 failed_count += !elm_theme_group_path_find(NULL, "elm/button/base/default");
132 } 155 EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255);
156 failed_count += !elm_theme_group_path_find(NULL, "elm/win/base/default");
157 EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255);
158
159 /* none of these will be found in the default theme,
160 * but all are "fetched" hundreds of times
161 * T6865
162 */
163 elm_theme_group_path_find(NULL, "elm/cursor/top_side/default");
164 elm_theme_group_path_find(NULL, "elm/cursor/bottom_side/default");
165 elm_theme_group_path_find(NULL, "elm/cursor/top_left_corner/default");
166 elm_theme_group_path_find(NULL, "elm/cursor/bottom_left_corner/default");
167 elm_theme_group_path_find(NULL, "elm/cursor/top_right_corner/default");
168 elm_theme_group_path_find(NULL, "elm/cursor/bottom_right_corner/default");
169
170
171 elm_theme_group_path_find(NULL, "elm/colorselector/item/color/default");
172
173 failed_count += _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
174 "Elementary", etc, SUITE_INIT_FN(elm2), SUITE_SHUTDOWN_FN(elm));
133 175
134 return (failed_count == 0) ? 0 : 255; 176 return (failed_count == 0) ? 0 : 255;
135} 177}