summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>2020-08-01 15:11:07 +0000
committerStefan Schmidt <s.schmidt@samsung.com>2020-08-20 09:36:20 +0200
commitbfc3e9f96ec3089545bcd67c3c2a4c9e9c4f405f (patch)
treebbec05b3149eb0ea566e54557cc29f3e82cf7c55
parent047b59d9345076fa927b7af747b4b90da31637eb (diff)
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
-rw-r--r--src/tests/eina/eina_test_file.c7
1 files changed, 6 insertions, 1 deletions
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)
874{ 874{
875 int fd; 875 int fd;
876 Eina_Tmpstr *test_file_path; 876 Eina_Tmpstr *test_file_path;
877 Eina_File* test_file;
877 const char *tmpfile = "eina_file_test_XXXXXX"; 878 const char *tmpfile = "eina_file_test_XXXXXX";
878 879
879 /*If file was not opened as 'eina'*/ 880 /*If file was not opened as 'eina'*/
@@ -884,9 +885,13 @@ EFL_START_TEST(eina_test_file_unlink)
884 /*If file was opened as 'eina'*/ 885 /*If file was opened as 'eina'*/
885 fd = create_file_not_empty(tmpfile, &test_file_path, EINA_TRUE); 886 fd = create_file_not_empty(tmpfile, &test_file_path, EINA_TRUE);
886 fail_if(fd != 0); 887 fail_if(fd != 0);
887 fail_if(!eina_file_open(test_file_path, EINA_FALSE)); 888
889 test_file = eina_file_open(test_file_path, EINA_FALSE);
890 fail_if(!test_file);
888 fail_if(!eina_file_unlink(test_file_path)); 891 fail_if(!eina_file_unlink(test_file_path));
889 892
893 eina_file_close(test_file);
894
890} 895}
891EFL_END_TEST 896EFL_END_TEST
892 897