diff options
author | Stefan Schmidt <stefan@osg.samsung.com> | 2016-06-15 18:23:24 +0200 |
---|---|---|
committer | Stefan Schmidt <stefan@osg.samsung.com> | 2016-06-16 14:15:25 +0200 |
commit | 6d54b94db5c9a629e939754c750af80c7d66697b (patch) | |
tree | 1d8c40af58323620da640c53042c90688ec74822 | |
parent | ff95c52ae714233cce9b5e2696c822a452113a49 (diff) | |
download | efl-6d54b94db5c9a629e939754c750af80c7d66697b.tar.gz |
tests: eio: use eina file infrastructure for temporary file creation
The tmp dir is not always /tmp.
-rw-r--r-- | src/tests/eio/eio_test_map.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tests/eio/eio_test_map.c b/src/tests/eio/eio_test_map.c index b2ce2191ec..7dbd50d5f4 100644 --- a/src/tests/eio/eio_test_map.c +++ b/src/tests/eio/eio_test_map.c @@ -56,20 +56,21 @@ _error_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, int error) START_TEST(eio_test_map_simple) { int fd; - char *file = strdup("/tmp/eio_map_example.txt"); + const char *file = "eio_map_exampleXXXXXX.txt"; const char *data = "This is the data to save in file"; Eio_File *ef; + Eina_Tmpstr *file_path; ecore_init(); eina_init(); eio_init(); - fd = open(file, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG); - fail_if(fd == 0); + fd = eina_file_mkstemp(file, &file_path); + fail_if(fd < 0); fail_if(write(fd, data, strlen(data)) != (ssize_t)strlen(data)); close(fd); - ef = eio_file_open(file, EINA_FALSE, _open_cb, _error_cb, NULL); + ef = eio_file_open(file_path, EINA_FALSE, _open_cb, _error_cb, NULL); ecore_main_loop_begin(); fail_if(!ef); @@ -87,6 +88,7 @@ START_TEST(eio_test_map_simple) ecore_main_loop_begin(); fail_if(!ef); + eina_tmpstr_del(file_path); eio_shutdown(); eina_shutdown(); ecore_shutdown(); |