forked from enlightenment/efl
eina: Close file in unlink test
At least on Windows (didn't have the time to test on Linux yet), running tests, even if they passed, there would be an Eina error on logs pointing that a temporary file wasn't closed: ``` ERR:eina_file ../src/lib/eina/eina_file_common.c:1137 eina_file_shutdown() File [C:/Users/joao_/AppData/Local/Temp/aaaa_file_test_EBpVea] still open 1 times ! ``` In the end, it was the `eina_file_test_unlink` that would create a temporary file but never close it, being caught only by `eina_shutdown()`. Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Reviewed-by: Vincent Torri <vincent.torri@gmail.com> Differential Revision: https://phab.enlightenment.org/D12062
This commit is contained in:
parent
047b59d934
commit
bfc3e9f96e
|
@ -874,6 +874,7 @@ EFL_START_TEST(eina_test_file_unlink)
|
|||
{
|
||||
int fd;
|
||||
Eina_Tmpstr *test_file_path;
|
||||
Eina_File* test_file;
|
||||
const char *tmpfile = "eina_file_test_XXXXXX";
|
||||
|
||||
/*If file was not opened as 'eina'*/
|
||||
|
@ -884,9 +885,13 @@ EFL_START_TEST(eina_test_file_unlink)
|
|||
/*If file was opened as 'eina'*/
|
||||
fd = create_file_not_empty(tmpfile, &test_file_path, EINA_TRUE);
|
||||
fail_if(fd != 0);
|
||||
fail_if(!eina_file_open(test_file_path, EINA_FALSE));
|
||||
|
||||
test_file = eina_file_open(test_file_path, EINA_FALSE);
|
||||
fail_if(!test_file);
|
||||
fail_if(!eina_file_unlink(test_file_path));
|
||||
|
||||
eina_file_close(test_file);
|
||||
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
|
|
Loading…
Reference in New Issue