summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2010-12-19 02:46:01 +0000
committerCarsten Haitzler <raster@rasterman.com>2010-12-19 02:46:01 +0000
commit163bb8a5f5ddc1ad6e3a7312d80231536d804443 (patch)
tree012b9fa24dc648040354fefef2e9bad6d0733a16 /legacy
parent08f413e8f90d6eb9778e6e2d53b8f5af0b5d0bf4 (diff)
remove test suite from ecore. gentoo users/ebuild maiontainers are
simply a pain. no more tests within src trees. talk to gentoo if you don't like it. i wasted enough of my day already trying to talk sense into them. if we dont tempt them with stuff they dont comprehend then its less pain for us having to answer their questions. SVN revision: 55635
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ecore/Makefile.am14
-rw-r--r--legacy/ecore/configure.ac7
-rw-r--r--legacy/ecore/src/Makefile.am2
-rw-r--r--legacy/ecore/src/tests/Makefile.am34
-rw-r--r--legacy/ecore/src/tests/ecore_suite.c103
-rw-r--r--legacy/ecore/src/tests/ecore_suite.h11
-rw-r--r--legacy/ecore/src/tests/ecore_test_ecore.c366
-rw-r--r--legacy/ecore/src/tests/ecore_test_ecore_con.c25
-rw-r--r--legacy/ecore/src/tests/ecore_test_ecore_x.c56
9 files changed, 1 insertions, 617 deletions
diff --git a/legacy/ecore/Makefile.am b/legacy/ecore/Makefile.am
index a88298a971..867896146c 100644
--- a/legacy/ecore/Makefile.am
+++ b/legacy/ecore/Makefile.am
@@ -181,19 +181,5 @@ doc:
181 @echo "entering doc/" 181 @echo "entering doc/"
182 make -C doc doc 182 make -C doc doc
183 183
184# Unit tests
185
186if EFL_ENABLE_TESTS
187
188check-local:
189 @./src/tests/ecore_suite
190
191else
192
193check-local:
194 @echo "reconfigure with --enable-tests"
195
196endif
197
198maintainer-clean-local: 184maintainer-clean-local:
199 rm -rf autom4te.cache 185 rm -rf autom4te.cache
diff --git a/legacy/ecore/configure.ac b/legacy/ecore/configure.ac
index 0955281ac0..cce3d05b15 100644
--- a/legacy/ecore/configure.ac
+++ b/legacy/ecore/configure.ac
@@ -301,11 +301,6 @@ if test "x${want_xim}" = "xyes" ; then
301 AC_DEFINE([ENABLE_XIM], [1], [Enable X Input Method]) 301 AC_DEFINE([ENABLE_XIM], [1], [Enable X Input Method])
302fi 302fi
303 303
304# Unit tests
305
306EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
307
308
309### Checks for programs 304### Checks for programs
310 305
311m4_ifdef([AC_PROG_OBJC], 306m4_ifdef([AC_PROG_OBJC],
@@ -1420,7 +1415,6 @@ src/lib/ecore_wince/Makefile
1420src/lib/ecore_x/Makefile 1415src/lib/ecore_x/Makefile
1421src/lib/ecore_x/xlib/Makefile 1416src/lib/ecore_x/xlib/Makefile
1422src/lib/ecore_x/xcb/Makefile 1417src/lib/ecore_x/xcb/Makefile
1423src/tests/Makefile
1424README 1418README
1425ecore.spec 1419ecore.spec
1426$po_makefile_in 1420$po_makefile_in
@@ -1554,7 +1548,6 @@ if test "x${have_ecore_evas}" = "xyes" ; then
1554 echo " Software 16bit WinCE.......: $have_ecore_evas_software_16_wince" 1548 echo " Software 16bit WinCE.......: $have_ecore_evas_software_16_wince"
1555fi 1549fi
1556echo 1550echo
1557echo " Tests................: ${enable_tests}"
1558echo " Maximum log level....: ${with_max_log_level}" 1551echo " Maximum log level....: ${with_max_log_level}"
1559echo "Documentation..........: ${build_doc}" 1552echo "Documentation..........: ${build_doc}"
1560echo 1553echo
diff --git a/legacy/ecore/src/Makefile.am b/legacy/ecore/src/Makefile.am
index a6fc38fef0..a8590b2f0d 100644
--- a/legacy/ecore/src/Makefile.am
+++ b/legacy/ecore/src/Makefile.am
@@ -1,3 +1,3 @@
1MAINTAINERCLEANFILES = Makefile.in 1MAINTAINERCLEANFILES = Makefile.in
2 2
3SUBDIRS = lib bin tests 3SUBDIRS = lib bin
diff --git a/legacy/ecore/src/tests/Makefile.am b/legacy/ecore/src/tests/Makefile.am
deleted file mode 100644
index dbec564d40..0000000000
--- a/legacy/ecore/src/tests/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_srcdir)/src/lib/ecore_con \
6-I$(top_srcdir)/src/lib/ecore_x \
7@EINA_CFLAGS@ \
8@CHECK_CFLAGS@
9
10if EFL_ENABLE_TESTS
11
12noinst_PROGRAMS = ecore_suite
13
14check_PROGRAMS = ecore_suite
15
16ecore_suite_SOURCES = \
17ecore_suite.c \
18ecore_test_ecore.c \
19ecore_test_ecore_con.c \
20ecore_test_ecore_x.c
21
22ecore_suite_LDADD = \
23@CHECK_LIBS@ \
24$(top_builddir)/src/lib/ecore/libecore.la \
25$(top_builddir)/src/lib/ecore_con/libecore_con.la
26
27if BUILD_ECORE_X
28ecore_suite_LDADD += \
29$(top_builddir)/src/lib/ecore_x/libecore_x.la
30endif
31
32endif
33
34EXTRA_DIST = ecore_suite.h
diff --git a/legacy/ecore/src/tests/ecore_suite.c b/legacy/ecore/src/tests/ecore_suite.c
deleted file mode 100644
index fd517506b3..0000000000
--- a/legacy/ecore/src/tests/ecore_suite.c
+++ /dev/null
@@ -1,103 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdlib.h>
6#include <stdio.h>
7
8#include <Ecore.h>
9
10#include "ecore_suite.h"
11
12typedef struct _Ecore_Test_Case Ecore_Test_Case;
13
14struct _Ecore_Test_Case
15{
16 const char *test_case;
17 void (*build)(TCase *tc);
18};
19
20static const Ecore_Test_Case etc[] = {
21 { "Ecore", ecore_test_ecore },
22 { "Ecore_Con", ecore_test_ecore_con },
23 { "Ecore_X", ecore_test_ecore_x },
24 { NULL, NULL }
25};
26
27static void
28_list_tests(void)
29{
30 const Ecore_Test_Case *itr;
31
32 itr = etc;
33 fputs("Available Test Cases:\n", stderr);
34 for (; itr->test_case; itr++)
35 fprintf(stderr, "\t%s\n", itr->test_case);
36}
37static Eina_Bool
38_use_test(int argc, const char **argv, const char *test_case)
39{
40 if (argc < 1)
41 return 1;
42
43 for (; argc > 0; argc--, argv++)
44 if (strcmp(test_case, *argv) == 0)
45 return 1;
46 return 0;
47}
48
49static Suite *
50ecore_suite_build(int argc, const char **argv)
51{
52 TCase *tc;
53 Suite *s;
54 int i;
55
56 s = suite_create("Ecore");
57
58 for (i = 0; etc[i].test_case; ++i)
59 {
60 if (!_use_test(argc, argv, etc[i].test_case)) continue;
61 tc = tcase_create(etc[i].test_case);
62
63 etc[i].build(tc);
64
65 suite_add_tcase(s, tc);
66 tcase_set_timeout(tc, 0);
67 }
68
69 return s;
70}
71
72int
73main(int argc, char **argv)
74{
75 Suite *s;
76 SRunner *sr;
77 int i, failed_count;
78
79 for (i = 1; i < argc; i++)
80 if ((strcmp(argv[i], "-h") == 0) ||
81 (strcmp(argv[i], "--help") == 0))
82 {
83 fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
84 argv[0]);
85 _list_tests();
86 return 0;
87 }
88 else if ((strcmp(argv[i], "-l") == 0) ||
89 (strcmp(argv[i], "--list") == 0))
90 {
91 _list_tests();
92 return 0;
93 }
94
95 s = ecore_suite_build(argc - 1, (const char **)argv + 1);
96 sr = srunner_create(s);
97
98 srunner_run_all(sr, CK_ENV);
99 failed_count = srunner_ntests_failed(sr);
100 srunner_free(sr);
101
102 return (failed_count == 0) ? 0 : 255;
103}
diff --git a/legacy/ecore/src/tests/ecore_suite.h b/legacy/ecore/src/tests/ecore_suite.h
deleted file mode 100644
index 0c7dfef8d5..0000000000
--- a/legacy/ecore/src/tests/ecore_suite.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _ECORE_SUITE_H
2#define _ECORE_SUITE_H
3
4#include <check.h>
5
6void ecore_test_ecore(TCase *tc);
7void ecore_test_ecore_con(TCase *tc);
8void ecore_test_ecore_x(TCase *tc);
9
10
11#endif /* _ECORE_SUITE_H */
diff --git a/legacy/ecore/src/tests/ecore_test_ecore.c b/legacy/ecore/src/tests/ecore_test_ecore.c
deleted file mode 100644
index 8fa9e9c866..0000000000
--- a/legacy/ecore/src/tests/ecore_test_ecore.c
+++ /dev/null
@@ -1,366 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecore_suite.h"
6
7#include <Ecore.h>
8#include <Eina.h>
9#include <unistd.h>
10#include <stdio.h>
11
12static int _log_dom;
13#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
14
15static Eina_Bool
16_quit_cb(void *data)
17{
18 Eina_Bool *val = data;
19 *val = EINA_TRUE;
20 ecore_main_loop_quit();
21 return EINA_FALSE;
22}
23
24static Eina_Bool
25_dummy_cb(void *data)
26{
27 return !!data;
28}
29
30START_TEST(ecore_test_ecore_init)
31{
32 int ret;
33
34 ret = ecore_init();
35 fail_if(ret != 1);
36
37 ret = ecore_shutdown();
38 fail_if(ret != 0);
39}
40END_TEST
41
42START_TEST(ecore_test_ecore_main_loop)
43{
44 Eina_Bool did = EINA_FALSE;
45 Ecore_Timer *timer;
46 int ret;
47
48 ret = ecore_init();
49 fail_if(ret != 1);
50
51 timer = ecore_timer_add(0.0, _quit_cb, &did);
52 fail_if(timer == NULL);
53
54 ecore_main_loop_begin();
55
56 fail_if(did == EINA_FALSE);
57
58 ret = ecore_shutdown();
59 fail_if(ret != 0);
60}
61END_TEST
62
63START_TEST(ecore_test_ecore_main_loop_idler)
64{
65 Eina_Bool did = EINA_FALSE;
66 Ecore_Idler *idler;
67 int ret;
68
69 ret = ecore_init();
70 fail_if(ret != 1);
71
72 idler = ecore_idler_add(_quit_cb, &did);
73 fail_if(idler == NULL);
74
75 ecore_main_loop_begin();
76
77 fail_if(did == EINA_FALSE);
78
79 ret = ecore_shutdown();
80 fail_if(ret != 0);
81}
82END_TEST
83
84START_TEST(ecore_test_ecore_main_loop_idle_enterer)
85{
86 Eina_Bool did = EINA_FALSE;
87 Ecore_Idle_Enterer *idle_enterer;
88 int ret;
89
90 ret = ecore_init();
91 fail_if(ret != 1);
92
93 idle_enterer = ecore_idle_enterer_add(_quit_cb, &did);
94 fail_if(idle_enterer == NULL);
95
96 ecore_main_loop_begin();
97
98 fail_if(did == EINA_FALSE);
99
100 ret = ecore_shutdown();
101 fail_if(ret != 0);
102}
103END_TEST
104
105START_TEST(ecore_test_ecore_main_loop_idle_exiter)
106{
107 Eina_Bool did = EINA_FALSE;
108 Ecore_Timer *timer;
109 Ecore_Idle_Exiter *idle_exiter;
110 int ret;
111
112 ret = ecore_init();
113 fail_if(ret != 1);
114
115 /* make system exit idle */
116 timer = ecore_timer_add(0.0, _dummy_cb, (void *)(long)0);
117 fail_if(timer == NULL);
118
119 idle_exiter = ecore_idle_exiter_add(_quit_cb, &did);
120 fail_if(idle_exiter == NULL);
121
122 ecore_main_loop_begin();
123
124 fail_if(did == EINA_FALSE);
125
126 ret = ecore_shutdown();
127 fail_if(ret != 0);
128}
129END_TEST
130
131START_TEST(ecore_test_ecore_main_loop_timer)
132{
133 Eina_Bool did = EINA_FALSE;
134 Ecore_Timer *timer;
135 double start, end, elapsed;
136 int ret;
137
138 ret = ecore_init();
139 fail_if(ret != 1);
140
141 timer = ecore_timer_add(2.0, _quit_cb, &did);
142 fail_if(timer == NULL);
143
144 start = ecore_time_get();
145 ecore_main_loop_begin();
146 end = ecore_time_get();
147 elapsed = end - start;
148
149 fail_if(did == EINA_FALSE);
150 fail_if(elapsed < 2.0);
151 fail_if(elapsed > 3.0); /* 1 second "error margin" */
152
153 ret = ecore_shutdown();
154 fail_if(ret != 0);
155}
156END_TEST
157
158static Eina_Bool _timer3(void *data)
159{
160 /* timer 3, do nothing */
161 return EINA_FALSE;
162}
163
164static Eina_Bool _timer2(void *data)
165{
166 /* timer 2, quit inner mainloop */
167 ecore_main_loop_quit();
168 return EINA_FALSE;
169}
170
171static Eina_Bool _timer1(void *data)
172{
173 /* timer 1, begin inner mainloop */
174 int *times = data;
175 (*times)++;
176
177 ecore_timer_add(0.3, _timer2, NULL);
178 ecore_timer_add(0.1, _timer3, NULL);
179 ecore_main_loop_begin();
180
181 ecore_main_loop_quit();
182
183 return EINA_FALSE;
184}
185
186START_TEST(ecore_test_ecore_main_loop_timer_inner)
187{
188 Ecore_Timer *timer;
189 int ret;
190 int times = 0;
191
192 ret = ecore_init();
193 fail_if(ret != 1);
194
195 timer = ecore_timer_add(1.0, _timer1, &times);
196 fail_if(timer == NULL);
197
198 /* BEGIN: outer mainloop */
199 ecore_main_loop_begin();
200 /*END: outer mainloop */
201
202 fail_if(times != 1);
203}
204END_TEST
205
206static Eina_Bool
207_fd_handler_cb(void *data, Ecore_Fd_Handler *handler __UNUSED__)
208{
209 /* FIXME: why setting val if it is overwritten just after and what is its purpose ??? */
210 Eina_Bool *val = data;
211
212 *val = EINA_TRUE;
213 ecore_main_loop_quit();
214 return EINA_FALSE;
215}
216
217START_TEST(ecore_test_ecore_main_loop_fd_handler)
218{
219 Eina_Bool did = EINA_FALSE;
220 Ecore_Fd_Handler *fd_handler;
221 int comm[2];
222 int ret;
223
224 ret = ecore_init();
225 fail_if(ret != 1);
226
227 ret = pipe(comm);
228 fail_if(ret != 0);
229
230 fd_handler = ecore_main_fd_handler_add
231 (comm[0], ECORE_FD_READ, _fd_handler_cb, &did, NULL, NULL);
232 fail_if(fd_handler == NULL);
233
234 ret = write(comm[1], &did, 1);
235 fail_if(ret != 1);
236
237 ecore_main_loop_begin();
238
239 close(comm[0]);
240 close(comm[1]);
241
242 fail_if(did == EINA_FALSE);
243
244 ret = ecore_shutdown();
245 fail_if(ret != 0);
246}
247END_TEST
248
249static Eina_Bool
250_event_handler_cb(void *data, int type __UNUSED__, void *event __UNUSED__)
251{
252 /* FIXME: why setting val if it is overwritten just after and what is its purpose ??? */
253 Eina_Bool *val = data;
254
255 *val = EINA_TRUE;
256 ecore_main_loop_quit();
257 return EINA_FALSE;
258}
259
260START_TEST(ecore_test_ecore_main_loop_event)
261{
262 Eina_Bool did = EINA_FALSE;
263 Ecore_Event_Handler *handler;
264 Ecore_Event *event;
265 int ret, type;
266
267 ret = ecore_init();
268 fail_if(ret != 1);
269
270 type = ecore_event_type_new();
271 fail_if(type < 1);
272
273 handler = ecore_event_handler_add(type, _event_handler_cb, &did);
274 fail_if(handler == NULL);
275
276 event = ecore_event_add(type, NULL, NULL, NULL);
277 fail_if(event == NULL);
278
279 ecore_main_loop_begin();
280
281 fail_if(did == EINA_FALSE);
282
283 ret = ecore_shutdown();
284 fail_if(ret != 0);
285}
286END_TEST
287
288static Eina_Bool
289_timer_quit_recursive(void *data)
290{
291 INF(" _timer_quit_recursive: begin");
292 ecore_main_loop_quit(); /* quits inner main loop */
293 INF(" _timer_quit_recursive: end");
294 return EINA_FALSE;
295}
296
297static Eina_Bool
298_event_recursive_cb(void *data, int type, void *event)
299{
300 Ecore_Event *e;
301 static int guard = 0;
302
303 /* If we enter this callback more than once, it's wrong! */
304 fail_if(guard != 0);
305 guard++;
306
307 INF(" event_recursive_cb: begin");
308
309 ecore_timer_add(1.0, _timer_quit_recursive, NULL);
310 INF(" add 1.0s timer (once) to trigger _timer_quit_recursive");
311
312 INF(" inner main loop begin (recurse)");
313 ecore_main_loop_begin();
314 INF(" inner main loop end (recurse)");
315
316 ecore_main_loop_quit(); /* quits outer main loop */
317
318 INF(" guard = %d", guard);
319 INF(" event_recursive_cb: end");
320 return EINA_FALSE;
321}
322
323
324START_TEST(ecore_test_ecore_main_loop_event_recursive)
325{
326 /* This test tests if the event handlers are really called only once when
327 * recursive main loops are used and any number of events may have occurred
328 * between the beginning and the end of recursive main loop.
329 */
330 Ecore_Event *e;
331 int type;
332 int ret;
333
334 _log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
335
336 INF("main: begin");
337 ret = ecore_init();
338 fail_if(ret != 1);
339
340
341 type = ecore_event_type_new();
342 ecore_event_handler_add(type, _event_recursive_cb, NULL);
343 e = ecore_event_add(type, NULL, NULL, NULL);
344 INF(" add event to trigger cb1: event=%p", e);
345 INF(" main loop begin");
346 ecore_main_loop_begin();
347 INF(" main loop end");
348
349 INF("main: end");
350 ecore_shutdown();
351}
352END_TEST
353
354void ecore_test_ecore(TCase *tc)
355{
356 tcase_add_test(tc, ecore_test_ecore_init);
357 tcase_add_test(tc, ecore_test_ecore_main_loop);
358 tcase_add_test(tc, ecore_test_ecore_main_loop_idler);
359 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_enterer);
360 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter);
361 tcase_add_test(tc, ecore_test_ecore_main_loop_timer);
362 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler);
363 tcase_add_test(tc, ecore_test_ecore_main_loop_event);
364 tcase_add_test(tc, ecore_test_ecore_main_loop_timer_inner);
365 tcase_add_test(tc, ecore_test_ecore_main_loop_event_recursive);
366}
diff --git a/legacy/ecore/src/tests/ecore_test_ecore_con.c b/legacy/ecore/src/tests/ecore_test_ecore_con.c
deleted file mode 100644
index 3eba6121c5..0000000000
--- a/legacy/ecore/src/tests/ecore_test_ecore_con.c
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Ecore_Con.h>
6
7#include "ecore_suite.h"
8
9
10START_TEST(ecore_test_ecore_con_init)
11{
12 int ret;
13
14 ret = ecore_con_init();
15 fail_if(ret != 1);
16
17 ret = ecore_con_shutdown();
18 fail_if(ret != 0);
19}
20END_TEST
21
22void ecore_test_ecore_con(TCase *tc)
23{
24 tcase_add_test(tc, ecore_test_ecore_con_init);
25}
diff --git a/legacy/ecore/src/tests/ecore_test_ecore_x.c b/legacy/ecore/src/tests/ecore_test_ecore_x.c
deleted file mode 100644
index 4b9e126a18..0000000000
--- a/legacy/ecore/src/tests/ecore_test_ecore_x.c
+++ /dev/null
@@ -1,56 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Ecore_X.h>
6
7#include "ecore_suite.h"
8
9
10/* TODO: change to HAVE_ECORE_X when xcb implementation is done */
11#ifdef HAVE_ECORE_X_XLIB
12
13START_TEST(ecore_test_ecore_x_init)
14{
15 int ret;
16
17 ret = ecore_x_init(NULL);
18 fail_if(ret != 1);
19
20 ret = ecore_x_shutdown();
21 fail_if(ret != 0);
22}
23END_TEST
24
25START_TEST(ecore_test_ecore_x_bell)
26{
27 int i;
28 int ret;
29
30 ret = ecore_x_init(NULL);
31 fail_if(ret != 1);
32
33 printf("You should hear 3 beeps now.\n");
34 for (i = 0; i < 3; i++)
35 {
36 ret = ecore_x_bell(0);
37 fail_if(ret != EINA_TRUE);
38 ecore_x_sync();
39 sleep(1);
40 }
41
42 ecore_x_shutdown();
43}
44END_TEST
45
46#endif
47
48void ecore_test_ecore_x(TCase *tc)
49{
50
51/* TODO: change to HAVE_ECORE_X when xcb implementation is done */
52#ifdef HAVE_ECORE_X_XLIB
53 tcase_add_test(tc, ecore_test_ecore_x_init);
54 tcase_add_test(tc, ecore_test_ecore_x_bell);
55#endif
56}