summaryrefslogtreecommitdiff
path: root/src/tests/evil
diff options
context:
space:
mode:
authorVincent Torri <vincent dot torri at gmail dot com>2016-02-04 15:12:34 +0100
committerTom Hacohen <tom@stosb.com>2016-02-16 12:41:06 +0000
commit66b60da444ad9ea7729f04ada21dc33899cbbec5 (patch)
treeb35d9d05c3d5cf98d046fe776c873ba305afc1b7 /src/tests/evil
parent71f0fb98f08f62473a59819a8322930bdd68f090 (diff)
Test rework
Summary: Factorisation of the infra make uniform all the tests Test rework #1: Ecore Test rework #2: Ecore_Con Test rework #3: Ecore_Cxx Test rework #4: Ector Test rework #5: Edje Test rework #6: Eet This one is big: I had to split the huge eet_suite.c into separate test files and it needs more review Test rework #7: Eet_Cxx Test rework #8: Eeze eeze_suite.c has also been splitted Test rework #9: Efreet this efreet test suite needs more love later Test rework #10: Eina mainly minor stuff: whitespaces, order of includes, ... Just don't fear the number of changed files :-) Test rework #11: Eina_Cxx Test rework #12: Eio Test rework #13: ElDbus Test rework #14: ElDbus_Cxx Test rework #15: Elua Test rework #16: Emile Test rework #17: Eo I've only touched the suite/ subdir. Maybe we should merege the others into the test suite in suite/ Test rework #18: Eolian Test rework #19: Eolian_Cxx Test rework #20: Evas Test rework #21: Evil Test Plan: make check Reviewers: cedric, jpeg, tasn Differential Revision: https://phab.enlightenment.org/D3654
Diffstat (limited to 'src/tests/evil')
-rw-r--r--src/tests/evil/evil_suite.c89
1 files changed, 7 insertions, 82 deletions
diff --git a/src/tests/evil/evil_suite.c b/src/tests/evil/evil_suite.c
index 2699bee32a..bc8bd79025 100644
--- a/src/tests/evil/evil_suite.c
+++ b/src/tests/evil/evil_suite.c
@@ -23,18 +23,10 @@
23#include <stdio.h> 23#include <stdio.h>
24#include <string.h> 24#include <string.h>
25 25
26#include <Evil.h>
27
28#include "evil_suite.h" 26#include "evil_suite.h"
27#include "../efl_check.h"
29 28
30typedef struct _Evil_Test_Case Evil_Test_Case; 29static const Efl_Test_Case etc[] = {
31struct _Evil_Test_Case
32{
33 const char *test_case;
34 void (*build)(TCase *tc);
35};
36
37static const Evil_Test_Case etc[] = {
38 /* { "Dirent", evil_test_dirent }, */ 30 /* { "Dirent", evil_test_dirent }, */
39 { "Dlfcn", evil_test_dlfcn }, 31 { "Dlfcn", evil_test_dlfcn },
40 /* { "Fcntl", evil_test_fcntl }, */ 32 /* { "Fcntl", evil_test_fcntl }, */
@@ -54,85 +46,18 @@ static const Evil_Test_Case etc[] = {
54 { NULL, NULL } 46 { NULL, NULL }
55}; 47};
56 48
57static void
58_list_tests(void)
59{
60 const Evil_Test_Case *itr = etc;
61 fputs("Available Test Cases:\n", stderr);
62 for (; itr->test_case; itr++)
63 fprintf(stderr, "\t%s\n", itr->test_case);
64}
65
66static unsigned char
67_use_test(int argc, const char **argv, const char *test_case)
68{
69 if (argc < 1)
70 return 1;
71
72 for (; argc > 0; argc--, argv++)
73 if (strcmp(test_case, *argv) == 0)
74 return 1;
75
76 return 0;
77}
78
79Suite *
80evil_build_suite(int argc, const char **argv)
81{
82 TCase *tc;
83 Suite *s;
84 int i;
85
86 s = suite_create("Evil");
87
88 for (i = 0; etc[i].test_case; ++i)
89 {
90 if (!_use_test(argc, argv, etc[i].test_case))
91 continue;
92
93 tc = tcase_create(etc[i].test_case);
94#ifndef _WIN32
95 tcase_set_timeout(tc, 0);
96#endif
97
98 etc[i].build(tc);
99 suite_add_tcase(s, tc);
100 }
101
102 return s;
103}
104
105int 49int
106main(int argc, char **argv) 50main(int argc, char **argv)
107{ 51{
108 Suite *s; 52 int failed_count;
109 SRunner *sr;
110 int i, failed_count;
111 53
112 for (i = 1; i < argc; i++) 54 if (!_efl_test_option_disp(argc, argv, etc))
113 if ((strcmp(argv[i], "-h") == 0) || 55 return 0;
114 (strcmp(argv[i], "--help") == 0))
115 {
116 fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
117 argv[0]);
118 _list_tests();
119 return 0;
120 }
121 else if ((strcmp(argv[i], "-l") == 0) ||
122 (strcmp(argv[i], "--list") == 0))
123 {
124 _list_tests();
125 return 0;
126 }
127 56
128 putenv("EFL_RUN_IN_TREE=1"); 57 putenv("EFL_RUN_IN_TREE=1");
129 58
130 s = evil_build_suite(argc - 1, (const char **)argv + 1); 59 failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
131 sr = srunner_create(s); 60 "Evil", etc);
132 srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
133 srunner_run_all(sr, CK_ENV);
134 failed_count = srunner_ntests_failed(sr);
135 srunner_free(sr);
136 61
137 return (failed_count == 0) ? 0 : 255; 62 return (failed_count == 0) ? 0 : 255;
138} 63}