summaryrefslogtreecommitdiff
path: root/src/tests/eio
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2016-04-25 18:02:05 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-25 21:32:03 -0300
commit0eacdc03da738bebe03ac22fe377836751877345 (patch)
tree20644a04d1169d8393caff3bf33d0fac45830380 /src/tests/eio
parent636c8b48c7da345eeb58b0eb0f436e0386e46e6f (diff)
eio: Call correct function to cleanup Eio_File.
The Eio functions operating on Eina_Files were just freeing the Eio_File pointer on completion instead of calling eio_file_free to unregister the thread.
Diffstat (limited to 'src/tests/eio')
-rw-r--r--src/tests/eio/eio_test_file.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/tests/eio/eio_test_file.c b/src/tests/eio/eio_test_file.c
index 5513e9013a..d4c71cd11d 100644
--- a/src/tests/eio/eio_test_file.c
+++ b/src/tests/eio/eio_test_file.c
@@ -118,6 +118,15 @@ _error_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, int error)
118 ecore_main_loop_quit(); 118 ecore_main_loop_quit();
119} 119}
120 120
121static void
122_open_done_cb(void *data, Eio_File *handler EINA_UNUSED, Eina_File *file)
123{
124 Eina_Bool *opened = (Eina_Bool *)data;
125 *opened = EINA_TRUE;
126 eina_file_close(file);
127 ecore_main_loop_quit();
128}
129
121Eina_Tmpstr* 130Eina_Tmpstr*
122get_full_path(const char* tmpdirname, const char* filename) 131get_full_path(const char* tmpdirname, const char* filename)
123{ 132{
@@ -368,9 +377,47 @@ START_TEST(eio_file_test_file)
368} 377}
369END_TEST 378END_TEST
370 379
380START_TEST(eio_file_test_open)
381{
382 Eina_Bool opened_file;
383 int ret;
384
385 ret = ecore_init();
386 fail_if(ret < 1);
387 ret = eio_init();
388 fail_if(ret < 1);
389 ret = eina_init();
390 fail_if(ret < 1);
391 ret = ecore_file_init();
392 fail_if(ret < 1);
393
394
395 Eina_Tmpstr *test_dirname = get_eio_test_file_tmp_dir();
396 Eina_Tmpstr *nested_dirname = create_test_dirs(test_dirname);
397 Eina_Tmpstr *nested_filename = get_full_path(test_dirname, files[3]);
398
399 opened_file = EINA_FALSE;
400 eio_file_open(nested_filename, EINA_FALSE, _open_done_cb, _error_cb, &opened_file);
401 ecore_main_loop_begin();
402 fail_if(!opened_file);
403
404 // Cleanup
405 fail_if(!ecore_file_recursive_rm(test_dirname));
406
407 eina_tmpstr_del(nested_dirname);
408 eina_tmpstr_del(test_dirname);
409 eina_tmpstr_del(nested_filename);
410 ecore_file_shutdown();
411 eina_shutdown();
412 eio_shutdown();
413 ecore_shutdown();
414}
415END_TEST
416
371void 417void
372eio_test_file(TCase *tc) 418eio_test_file(TCase *tc)
373{ 419{
374 tcase_add_test(tc, eio_file_test_ls); 420 tcase_add_test(tc, eio_file_test_ls);
375 tcase_add_test(tc, eio_file_test_file); 421 tcase_add_test(tc, eio_file_test_file);
422 tcase_add_test(tc, eio_file_test_open);
376} 423}