summaryrefslogtreecommitdiff
path: root/src/tests/eio
diff options
context:
space:
mode:
authorStefan Schmidt <stefan@osg.samsung.com>2016-06-16 15:37:46 +0200
committerStefan Schmidt <stefan@osg.samsung.com>2016-09-13 11:28:52 +0200
commitd01fa64edf08aae2c567ee7a540d9428ab84b8bc (patch)
tree4fcb759aa7af09b88f7c63a65a1f9be6eba0ce50 /src/tests/eio
parentfb73aabc61c5333d9461da19be15304b220d9e4e (diff)
tests: eio: use eina file infrastructure for temporary file creation
The tmp dir is not always /tmp.
Diffstat (limited to 'src/tests/eio')
-rw-r--r--src/tests/eio/eio_test_eet.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/tests/eio/eio_test_eet.c b/src/tests/eio/eio_test_eet.c
index d261be3be5..47f3ff1e99 100644
--- a/src/tests/eio/eio_test_eet.c
+++ b/src/tests/eio/eio_test_eet.c
@@ -53,8 +53,8 @@ _read_done_cb(void *data, Eio_File *handler EINA_UNUSED, void *read_data,
53static void 53static void
54_error_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, int error) 54_error_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, int error)
55{ 55{
56 fail();
57 fprintf(stderr, "Error:%s\n", strerror(error)); 56 fprintf(stderr, "Error:%s\n", strerror(error));
57 fail();
58 ecore_main_loop_quit(); 58 ecore_main_loop_quit();
59} 59}
60 60
@@ -68,16 +68,16 @@ _eet_error_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, Eet_Error e
68START_TEST(eio_test_eet_cipher_decipher) 68START_TEST(eio_test_eet_cipher_decipher)
69{ 69{
70 int ret; 70 int ret;
71 char *file = strdup("/tmp/eio_eet_example_XXXXXX"); 71 char *data = "This is the data to save in file";
72 const char *data = "This is the data to save in file";
73 const char *key = "This is a secret key"; 72 const char *key = "This is a secret key";
74 Eio_File *ef; 73 Eio_File *ef;
74 Eina_Tmpstr *file;
75 75
76 ecore_init(); 76 ecore_init();
77 eet_init(); 77 eet_init();
78 eio_init(); 78 eio_init();
79 79
80 ret = mkstemp(file); 80 ret = eina_file_mkstemp("eio_eet_example_XXXXXX", &file);
81 fail_if(ret == -1); 81 fail_if(ret == -1);
82 82
83 ef = eio_eet_open(file, EET_FILE_MODE_WRITE, _open_cb, _error_cb, NULL); 83 ef = eio_eet_open(file, EET_FILE_MODE_WRITE, _open_cb, _error_cb, NULL);
@@ -106,6 +106,7 @@ START_TEST(eio_test_eet_cipher_decipher)
106 ecore_main_loop_begin(); 106 ecore_main_loop_begin();
107 fail_if(!ef); 107 fail_if(!ef);
108 108
109 eina_tmpstr_del(file);
109 eio_shutdown(); 110 eio_shutdown();
110 eet_shutdown(); 111 eet_shutdown();
111 ecore_shutdown(); 112 ecore_shutdown();
@@ -161,10 +162,10 @@ _data_read_done_cb(void *data, Eio_File *handler EINA_UNUSED, void *decoded)
161START_TEST(eio_test_eet_data_cipher_decipher) 162START_TEST(eio_test_eet_data_cipher_decipher)
162{ 163{
163 int ret; 164 int ret;
164 char *file = strdup("/tmp/eio_eet_example_XXXXXX");
165 const char *key = "This is a secret key"; 165 const char *key = "This is a secret key";
166 Eio_File *ef; 166 Eio_File *ef;
167 Test_Struct *tc; 167 Test_Struct *tc;
168 Eina_Tmpstr *file;
168 169
169 ecore_init(); 170 ecore_init();
170 eet_init(); 171 eet_init();
@@ -173,7 +174,7 @@ START_TEST(eio_test_eet_data_cipher_decipher)
173 _test_struct_descriptor_init(); 174 _test_struct_descriptor_init();
174 tc = _test_struct_new(); 175 tc = _test_struct_new();
175 176
176 ret = mkstemp(file); 177 ret = eina_file_mkstemp("eio_eet_example_XXXXXX", &file);
177 fail_if(ret == -1); 178 fail_if(ret == -1);
178 179
179 ef = eio_eet_open(file, EET_FILE_MODE_WRITE, _open_cb, _error_cb, NULL); 180 ef = eio_eet_open(file, EET_FILE_MODE_WRITE, _open_cb, _error_cb, NULL);
@@ -202,6 +203,7 @@ START_TEST(eio_test_eet_data_cipher_decipher)
202 ecore_main_loop_begin(); 203 ecore_main_loop_begin();
203 fail_if(!ef); 204 fail_if(!ef);
204 205
206 eina_tmpstr_del(file);
205 eio_shutdown(); 207 eio_shutdown();
206 eet_shutdown(); 208 eet_shutdown();
207 ecore_shutdown(); 209 ecore_shutdown();