summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_ecore_file.c
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@openwide.fr>2016-08-29 15:53:50 +0200
committerJean Guyomarc'h <jean@guyomarch.bzh>2016-08-29 20:03:52 +0200
commit5b8315aeffb6a568d0b70441a2d05f6de2bf8fe1 (patch)
tree677dea919808ef38d39743758697684cd18ebf4e /src/tests/ecore/ecore_test_ecore_file.c
parent3f79cf87485bd25a1ae958a18c27266af1b36272 (diff)
ecore-tests: make sure we always get a canonical path
There may be extraneous slashes that are contained in the returned generated directories (because they were put there in environment variables). Since we test with string comparison, some tests would fail due to different environment setups.
Diffstat (limited to '')
-rw-r--r--src/tests/ecore/ecore_test_ecore_file.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/tests/ecore/ecore_test_ecore_file.c b/src/tests/ecore/ecore_test_ecore_file.c
index cb3928a580..ba82223b1f 100644
--- a/src/tests/ecore/ecore_test_ecore_file.c
+++ b/src/tests/ecore/ecore_test_ecore_file.c
@@ -32,35 +32,33 @@ _writeToFile(const char *filePath, char *text)
32 fclose(f); 32 fclose(f);
33} 33}
34 34
35static Eina_Tmpstr* 35static char *
36get_tmp_dir(void) 36get_tmp_dir(void)
37{ 37{
38 Eina_Tmpstr *tmp_dir; 38 Eina_Tmpstr *tmp_dir;
39 char *realpath;
39 40
40 Eina_Bool created = eina_file_mkdtemp("EcoreFileTestXXXXXX", &tmp_dir); 41 Eina_Bool created = eina_file_mkdtemp("EcoreFileTestXXXXXX", &tmp_dir);
42 if (!created) return NULL;
41 43
42 if (!created) 44 realpath = ecore_file_realpath(tmp_dir);
43 { 45 eina_tmpstr_del(tmp_dir);
44 return NULL; 46 return realpath;
45 }
46
47 return tmp_dir;
48} 47}
49 48
50static Eina_Tmpstr* 49static char *
51get_tmp_file(void) 50get_tmp_file(void)
52{ 51{
53 Eina_Tmpstr *tmp_file; 52 Eina_Tmpstr *tmp_file;
53 char *realpath;
54 54
55 int fd = eina_file_mkstemp("EcoreFileTestXXXXXX", &tmp_file); 55 int fd = eina_file_mkstemp("EcoreFileTestXXXXXX", &tmp_file);
56 56 if (fd < 0) return NULL;
57 if (fd < 0)
58 {
59 return NULL;
60 }
61
62 close(fd); 57 close(fd);
63 return tmp_file; 58
59 realpath = ecore_file_realpath(tmp_file);
60 eina_tmpstr_del(tmp_file);
61 return realpath;
64} 62}
65 63
66static void 64static void
@@ -147,7 +145,7 @@ START_TEST(ecore_test_ecore_file_operations)
147 Eina_Bool res; 145 Eina_Bool res;
148 Eina_List *list; 146 Eina_List *list;
149 147
150 tmpdir = eina_environment_tmp_get(); 148 tmpdir = ecore_file_realpath(eina_environment_tmp_get());
151 149
152 ret = ecore_file_init(); 150 ret = ecore_file_init();
153 fail_if(ret != 1); 151 fail_if(ret != 1);