summaryrefslogtreecommitdiff
path: root/src/tests/evil
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-03-27 13:51:13 -0400
committerStefan Schmidt <stefan@osg.samsung.com>2018-04-05 11:10:26 +0200
commit624925fe6e9c72c639d47135d5ea70d4110ac1fe (patch)
treeb57c12a611bf3b4b492327a7fcb5722cd39dad5b /src/tests/evil
parent730020c7d4a87daf60cbfbb3a0a912b4f75d8cb5 (diff)
tests: move to using checked fixtures for all test suites
individual tests should not need to explicitly call init/shutdown functions in most cases, and many did not properly do this anyway see followup commit which resolves some issues with eina tests ref T6813 ref T6811 Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
Diffstat (limited to 'src/tests/evil')
-rw-r--r--src/tests/evil/evil_suite.c14
-rw-r--r--src/tests/evil/evil_test_dlfcn.c4
-rw-r--r--src/tests/evil/evil_test_main.c2
-rw-r--r--src/tests/evil/evil_test_unistd.c6
4 files changed, 15 insertions, 11 deletions
diff --git a/src/tests/evil/evil_suite.c b/src/tests/evil/evil_suite.c
index 36d86ac8e5..3331d287b2 100644
--- a/src/tests/evil/evil_suite.c
+++ b/src/tests/evil/evil_suite.c
@@ -25,6 +25,7 @@
25 25
26#include "evil_suite.h" 26#include "evil_suite.h"
27#include "../efl_check.h" 27#include "../efl_check.h"
28#include <Evil.h>
28 29
29static const Efl_Test_Case etc[] = { 30static const Efl_Test_Case etc[] = {
30 { "Dlfcn", evil_test_dlfcn }, 31 { "Dlfcn", evil_test_dlfcn },
@@ -44,6 +45,17 @@ static const Efl_Test_Case etc[] = {
44 { NULL, NULL } 45 { NULL, NULL }
45}; 46};
46 47
48
49SUITE_INIT(evil)
50{
51 ck_assert_int_eq(evil_init(), 1);
52}
53
54SUITE_SHUTDOWN(evil)
55{
56 ck_assert_int_eq(evil_shutdown(), 0);
57}
58
47int 59int
48main(int argc, char **argv) 60main(int argc, char **argv)
49{ 61{
@@ -57,7 +69,7 @@ main(int argc, char **argv)
57#endif 69#endif
58 70
59 failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1, 71 failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
60 "Evil", etc); 72 "Evil", etc, SUITE_INIT_FN(evil), SUITE_SHUTDOWN_FN(evil));
61 73
62 return (failed_count == 0) ? 0 : 255; 74 return (failed_count == 0) ? 0 : 255;
63} 75}
diff --git a/src/tests/evil/evil_test_dlfcn.c b/src/tests/evil/evil_test_dlfcn.c
index e20ece8634..d932e710a8 100644
--- a/src/tests/evil/evil_test_dlfcn.c
+++ b/src/tests/evil/evil_test_dlfcn.c
@@ -64,11 +64,11 @@ EFL_START_TEST(evil_dlfcn_dlsym_success)
64 64
65 sym_init = dlsym(mod, "evil_init"); 65 sym_init = dlsym(mod, "evil_init");
66 fail_if(sym_init == NULL); 66 fail_if(sym_init == NULL);
67 fail_if(sym_init() != 1); 67 fail_if(sym_init() != 2);
68 68
69 sym_shutdown = dlsym(mod, "evil_shutdown"); 69 sym_shutdown = dlsym(mod, "evil_shutdown");
70 fail_if(sym_shutdown == NULL); 70 fail_if(sym_shutdown == NULL);
71 fail_if(sym_shutdown() != 0); 71 fail_if(sym_shutdown() != 1);
72 72
73 res = dlclose(mod); 73 res = dlclose(mod);
74 fail_if(res != 0); 74 fail_if(res != 0);
diff --git a/src/tests/evil/evil_test_main.c b/src/tests/evil/evil_test_main.c
index ccca6ff2eb..bae448219f 100644
--- a/src/tests/evil/evil_test_main.c
+++ b/src/tests/evil/evil_test_main.c
@@ -26,8 +26,6 @@
26 26
27EFL_START_TEST(evil_main_simple) 27EFL_START_TEST(evil_main_simple)
28{ 28{
29 fail_if(evil_init() != 1);
30 fail_if(evil_shutdown() != 0);
31} 29}
32EFL_END_TEST 30EFL_END_TEST
33 31
diff --git a/src/tests/evil/evil_test_unistd.c b/src/tests/evil/evil_test_unistd.c
index 8379400ed0..4c003ea3c5 100644
--- a/src/tests/evil/evil_test_unistd.c
+++ b/src/tests/evil/evil_test_unistd.c
@@ -61,14 +61,10 @@ EFL_START_TEST(evil_unistd_pipe)
61 int sockets[2]; 61 int sockets[2];
62 struct timeval t; 62 struct timeval t;
63 fd_set rfds; 63 fd_set rfds;
64 int ret;
65 data *d; 64 data *d;
66 DWORD thread_id; 65 DWORD thread_id;
67 HANDLE h; 66 HANDLE h;
68 67
69 ret = evil_init();
70 fail_if(ret == 0);
71
72 FD_ZERO(&rfds); 68 FD_ZERO(&rfds);
73 t.tv_sec = 5; 69 t.tv_sec = 5;
74 t.tv_usec = 0; 70 t.tv_usec = 0;
@@ -109,8 +105,6 @@ EFL_START_TEST(evil_unistd_pipe)
109 105
110 CloseHandle(h); 106 CloseHandle(h);
111 free(d); 107 free(d);
112
113 evil_shutdown();
114} 108}
115EFL_END_TEST 109EFL_END_TEST
116 110