summaryrefslogtreecommitdiff
path: root/src/tests/ecore
diff options
context:
space:
mode:
authorYeongjong Lee <yj34.lee@samsung.com>2018-08-17 12:42:35 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-08-17 12:42:35 -0400
commit15cc9a65aa8656d4183b9eada790143363c7dc06 (patch)
treeb20f79864bec445203d5fab5f6dbfd8effba348d /src/tests/ecore
parentcbe9b6f7700aaa3c87a203e69b5ab543cee68c20 (diff)
ecore_pipe: remove null check condition and fix segfualt on Windows
Summary: This reverts commit 4917910b4911905236fa099bbc16b833b056ca07. 4917910b break backward compatibility. Reproduction: void pipe_handler(...); pipe = ecore_pipe_add(pipe_handler, NULL); ecore_pipe_write(pipe, NULL, 0); Because of the null check condition, pipe_handler isn't called after 4917910b. Some apps behavior which is written to expected to call pipe_handler was broken. also, this patch fixed segfault during build on Windows Test Plan: make on Windows Reviewers: raster, zmike, vtorri Reviewed By: zmike, vtorri Subscribers: woohyun, cedric, #reviewers, #committers, zmike, vtorri Tags: #efl Differential Revision: https://phab.enlightenment.org/D6824
Diffstat (limited to 'src/tests/ecore')
-rw-r--r--src/tests/ecore/ecore_suite.c1
-rw-r--r--src/tests/ecore/ecore_suite.h1
-rw-r--r--src/tests/ecore/ecore_test_pipe.c41
3 files changed, 43 insertions, 0 deletions
diff --git a/src/tests/ecore/ecore_suite.c b/src/tests/ecore/ecore_suite.c
index 9e6baf6abb..53c6bbb3bf 100644
--- a/src/tests/ecore/ecore_suite.c
+++ b/src/tests/ecore/ecore_suite.c
@@ -29,6 +29,7 @@ static const Efl_Test_Case etc[] = {
29 { "Ecore_File", ecore_test_ecore_file }, 29 { "Ecore_File", ecore_test_ecore_file },
30 { "Ecore_Job", ecore_test_ecore_job }, 30 { "Ecore_Job", ecore_test_ecore_job },
31 { "Ecore_Args", ecore_test_ecore_args }, 31 { "Ecore_Args", ecore_test_ecore_args },
32 { "Ecore_Pipe", ecore_test_ecore_pipe },
32 { NULL, NULL } 33 { NULL, NULL }
33}; 34};
34 35
diff --git a/src/tests/ecore/ecore_suite.h b/src/tests/ecore/ecore_suite.h
index d1a698ea99..a3327412fe 100644
--- a/src/tests/ecore/ecore_suite.h
+++ b/src/tests/ecore/ecore_suite.h
@@ -22,5 +22,6 @@ void ecore_test_ecore_input(TCase *tc);
22void ecore_test_ecore_file(TCase *tc); 22void ecore_test_ecore_file(TCase *tc);
23void ecore_test_ecore_job(TCase *tc); 23void ecore_test_ecore_job(TCase *tc);
24void ecore_test_ecore_args(TCase *tc); 24void ecore_test_ecore_args(TCase *tc);
25void ecore_test_ecore_pipe(TCase *tc);
25 26
26#endif /* _ECORE_SUITE_H */ 27#endif /* _ECORE_SUITE_H */
diff --git a/src/tests/ecore/ecore_test_pipe.c b/src/tests/ecore/ecore_test_pipe.c
new file mode 100644
index 0000000000..e4b7b9bc0c
--- /dev/null
+++ b/src/tests/ecore/ecore_test_pipe.c
@@ -0,0 +1,41 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Ecore.h>
6#include "ecore_suite.h"
7
8static void
9_pipe_handler(void *data, void *buf EINA_UNUSED, unsigned int len EINA_UNUSED)
10{
11 Eina_Bool *bob = data;
12
13 *bob = EINA_TRUE;
14 ecore_main_loop_quit();
15}
16
17EFL_START_TEST(ecore_test_pipe)
18{
19 Ecore_Pipe *pipe;
20 Eina_Bool bob = EINA_FALSE;
21
22 pipe = ecore_pipe_add(_pipe_handler, &bob);
23 fail_if(!pipe);
24
25 ecore_pipe_write(pipe, &bob, sizeof(Eina_Bool));
26 ecore_main_loop_begin();
27 ck_assert_int_eq(bob, EINA_TRUE);
28
29 bob = EINA_FALSE;
30 ecore_pipe_write(pipe, NULL, 0);
31 ecore_main_loop_begin();
32 ck_assert_int_eq(bob, EINA_TRUE);
33
34 ecore_pipe_del(pipe);
35}
36EFL_END_TEST
37
38void ecore_test_ecore_pipe(TCase *tc)
39{
40 tcase_add_test(tc, ecore_test_pipe);
41}