stefan pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=bfc3e9f96ec3089545bcd67c3c2a4c9e9c4f405f

commit bfc3e9f96ec3089545bcd67c3c2a4c9e9c4f405f
Author: João Paulo Taylor Ienczak Zanette <[email protected]>
Date:   Sat Aug 1 15:11:07 2020 +0000

    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 <[email protected]>
    Reviewed-by: Vincent Torri <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D12062
---
 src/tests/eina/eina_test_file.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/tests/eina/eina_test_file.c b/src/tests/eina/eina_test_file.c
index fb4ff1c0df..8a9b13e29c 100644
--- a/src/tests/eina/eina_test_file.c
+++ b/src/tests/eina/eina_test_file.c
@@ -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
 

-- 


Reply via email to