summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2014-11-10 11:40:55 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2014-11-10 11:40:55 +0100
commit4d66ed9b1f7e72e285c2f5d7dd6b590c2b3bb7e5 (patch)
tree50986cf843d37745138d7243c408f64829d30227
parent2f9d5d19feae2db64b5bdb5ec28df94c9e5bdb5d (diff)
Revert "Ecore File : Added test suite for Ecore File module"
Same problem with this as for the revert before. Fails when run the second time. See last commit for details. This reverts commit 5866e166bb02374930922e38cd1c89809a5520d4.
-rw-r--r--src/Makefile_Ecore.am1
-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_ecore_file.c140
4 files changed, 0 insertions, 143 deletions
diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index 0fb50a44a4..67452c63eb 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -177,7 +177,6 @@ tests/ecore/ecore_test_timer.c \
177tests/ecore/ecore_test_ecore_evas.c \ 177tests/ecore/ecore_test_ecore_evas.c \
178tests/ecore/ecore_test_animator.c \ 178tests/ecore/ecore_test_animator.c \
179tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c \ 179tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c \
180tests/ecore/ecore_test_ecore_file.c \
181tests/ecore/ecore_test_ecore_input.c \ 180tests/ecore/ecore_test_ecore_input.c \
182tests/ecore/ecore_suite.h 181tests/ecore/ecore_suite.h
183 182
diff --git a/src/tests/ecore/ecore_suite.c b/src/tests/ecore/ecore_suite.c
index ad3635d497..44a3e62f46 100644
--- a/src/tests/ecore/ecore_suite.c
+++ b/src/tests/ecore/ecore_suite.c
@@ -30,7 +30,6 @@ static const Ecore_Test_Case etc[] = {
30 { "Ecore_Evas", ecore_test_ecore_evas }, 30 { "Ecore_Evas", ecore_test_ecore_evas },
31 { "Ecore_Animators", ecore_test_animator }, 31 { "Ecore_Animators", ecore_test_animator },
32 { "Ecore_Test_Ccore_Thread_Eina_Thread_Queue", ecore_test_ecore_thread_eina_thread_queue }, 32 { "Ecore_Test_Ccore_Thread_Eina_Thread_Queue", ecore_test_ecore_thread_eina_thread_queue },
33 { "Ecore_File", ecore_test_ecore_file },
34#if HAVE_ECORE_WAYLAND 33#if HAVE_ECORE_WAYLAND
35 { "Ecore_Wayland", ecore_test_ecore_wayland }, 34 { "Ecore_Wayland", ecore_test_ecore_wayland },
36#endif 35#endif
diff --git a/src/tests/ecore/ecore_suite.h b/src/tests/ecore/ecore_suite.h
index 571e85dd4f..803f8f7150 100644
--- a/src/tests/ecore/ecore_suite.h
+++ b/src/tests/ecore/ecore_suite.h
@@ -16,7 +16,6 @@ void ecore_test_ecore_thread_eina_thread_queue(TCase *tc);
16void ecore_test_ecore_wayland(TCase *tc); 16void ecore_test_ecore_wayland(TCase *tc);
17void ecore_test_ecore_drm(TCase *tc); 17void ecore_test_ecore_drm(TCase *tc);
18void ecore_test_ecore_fb(TCase *tc); 18void ecore_test_ecore_fb(TCase *tc);
19void ecore_test_ecore_file(TCase *tc);
20void ecore_test_ecore_input(TCase *tc); 19void ecore_test_ecore_input(TCase *tc);
21 20
22#endif /* _ECORE_SUITE_H */ 21#endif /* _ECORE_SUITE_H */
diff --git a/src/tests/ecore/ecore_test_ecore_file.c b/src/tests/ecore/ecore_test_ecore_file.c
deleted file mode 100644
index ede09c171a..0000000000
--- a/src/tests/ecore/ecore_test_ecore_file.c
+++ /dev/null
@@ -1,140 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <unistd.h>
7#include <string.h>
8
9#include <Ecore_File.h>
10#include <Ecore.h>
11#include <Eina.h>
12
13#include "ecore_suite.h"
14
15#define MAXSIZE 256
16
17void
18_writeToFile(char *filePath, char *text)
19{
20 FILE *f = fopen(filePath, "w");
21 fail_if(!f);
22 fprintf(f, "%s\n", text);
23 fclose(f);
24}
25START_TEST(ecore_test_ecore_file_init)
26{
27 int ret;
28
29 ret = ecore_file_init();
30 fail_if(ret != 1);
31
32 ret = ecore_file_shutdown();
33 fail_if(ret != 0);
34}
35END_TEST
36
37START_TEST(ecore_test_ecore_file_operations)
38{
39 const char *srcDir = "/tmp/rootDir";
40 const char* dirs[] = {"b", "b/c", "b/c/d", "d"};
41 char *srcFile = "/tmp/EcoreFileSrc.txt";
42 const char *destFile = "/tmp/EcoreFileDest.txt";
43 char *randomText = "This is random test String";
44 char dir[MAXSIZE] = {'\0'};
45 int ret;
46 Eina_Bool res;
47 Eina_List *list;
48
49 char unqFile[MAXSIZE], unqDir[MAXSIZE];
50 char *ptr;
51
52 ret = ecore_file_init();
53 fail_if(ret != 1);
54
55 ptr = tmpnam(unqFile);
56 fail_if(!ptr);
57
58 ptr = tmpnam(unqDir);
59 fail_if(!ptr);
60
61 res = ecore_file_exists(unqFile);
62 fail_if(res != EINA_FALSE);
63
64 res = ecore_file_is_dir(unqFile);
65 fail_if(res != EINA_FALSE);
66 res = ecore_file_is_dir(unqDir);
67 fail_if(res != EINA_FALSE);
68
69 res = ecore_file_mkdir(srcDir);
70 fail_if(res != EINA_TRUE);
71 res = ecore_file_is_dir(srcDir);
72 fail_if(res != EINA_TRUE);
73 ret = ecore_file_dir_is_empty(srcDir);
74 fail_if(res != 1);
75 res = ecore_file_remove(srcDir);
76 fail_if(res != EINA_TRUE);
77
78 ret = ecore_file_mksubdirs(srcDir, dirs);
79 fail_if(ret != 4);
80 list = ecore_file_ls(srcDir);
81 fail_if(!list);
82 fail_if(eina_list_count(list) != 2);
83 res = ecore_file_recursive_rm(srcDir);
84 fail_if(res != EINA_TRUE);
85
86 strcat(dir, srcDir);
87 strcat(dir, "/");
88 strcat(dir, dirs[2]);
89 res = ecore_file_mkpath(dir);
90 fail_if(res != EINA_TRUE);
91 res = ecore_file_recursive_rm(srcDir);
92 fail_if(res != EINA_TRUE);
93
94 _writeToFile(srcFile, randomText);
95
96 ret = ecore_file_size(srcFile);
97 fail_if(ret != strlen(randomText)+1);
98
99 res = ecore_file_cp(srcFile, destFile);
100 fail_if(res != EINA_TRUE);
101 res = ecore_file_exists(destFile);
102 fail_if(res != EINA_TRUE);
103 fail_if(ecore_file_size(srcFile) != ecore_file_size(destFile));
104 res = ecore_file_remove(destFile);
105 fail_if(res != EINA_TRUE);
106
107 res = ecore_file_symlink(srcFile, destFile);
108 fail_if(res != EINA_TRUE);
109 ck_assert_str_eq(ecore_file_readlink(destFile), srcFile);
110 res = ecore_file_unlink(destFile);
111 fail_if(res != EINA_TRUE);
112
113 res = ecore_file_mv(srcFile, destFile);
114 fail_if(res != EINA_TRUE);
115 res = ecore_file_exists(destFile);
116 fail_if(res != EINA_TRUE);
117 res = ecore_file_exists(srcFile);
118 fail_if(res != EINA_FALSE);
119
120 ck_assert_str_eq(ecore_file_file_get(destFile), "EcoreFileDest.txt");
121 ck_assert_str_eq(ecore_file_dir_get(destFile), "/tmp");
122 ck_assert_str_eq(ecore_file_realpath(destFile), destFile);
123 fail_if(ecore_file_mod_time(destFile) == 0);
124 fail_if(ecore_file_can_read(destFile) != EINA_TRUE);
125 fail_if(ecore_file_can_write(destFile) != EINA_TRUE);
126 fail_if(ecore_file_can_exec(destFile) != EINA_FALSE);
127 res = ecore_file_remove(destFile);
128 fail_if(res != EINA_TRUE);
129
130 ret = ecore_file_shutdown();
131 fail_if(ret != 0);
132
133}
134END_TEST
135
136void ecore_test_ecore_file(TCase *tc)
137{
138 tcase_add_test(tc, ecore_test_ecore_file_init);
139 tcase_add_test(tc, ecore_test_ecore_file_operations);
140}