From 08b068ac36dbfc651240247774db4f5748ac91f5 Mon Sep 17 00:00:00 2001 From: huangzhiquan Date: Thu, 31 Dec 2020 15:40:53 +0800 Subject: [PATCH] =?UTF-8?q?xts=E6=B5=8B=E8=AF=95=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E5=A4=A7=E9=87=8F=E5=8F=AA=E6=89=93=E5=BC=80=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=B5=81=EF=BC=8C=E7=84=B6=E5=90=8E=E5=88=A0=E9=99=A4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E6=93=8D=E4=BD=9C=E3=80=82=E5=9C=A8=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=89=8D=E5=A2=9E=E5=8A=A0=E5=85=B3=E9=97=AD=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utilsfile_hal/src/utils_file_reli_test.c | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/utils_lite/utilsfile_hal/src/utils_file_reli_test.c b/utils_lite/utilsfile_hal/src/utils_file_reli_test.c index 77449e232..627fc2754 100755 --- a/utils_lite/utilsfile_hal/src/utils_file_reli_test.c +++ b/utils_lite/utilsfile_hal/src/utils_file_reli_test.c @@ -88,6 +88,10 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testCreatFileAfterMaxFilesOpened, LEVEL1) TEST_ASSERT_GREATER_THAN_INT(0, fd33); UtilsFileClose(fd33); // Delete all files + for (int i = 1; i < MAX_NUM_OF_OPENED_FILES; i++) + { + UtilsFileClose(fd32[i]); + } for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) { int j = i + 1; @@ -126,14 +130,15 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testDeleteFileAfterMaxFilesOpened, LEVEL1 } // Delete file char* fileName1 = "testReli101-1"; + UtilsFileClose(fd32[0]); int ret = UtilsFileDelete(fileName1); - TEST_ASSERT_EQUAL_INT(-1, ret); - // Close file - UtilsFileClose(fd32[FILE_INDEX_31]); - ret = UtilsFileDelete(fileName1); TEST_ASSERT_EQUAL_INT(0, ret); // Delete all files - for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) + for (int i = 1; i < MAX_NUM_OF_OPENED_FILES; i++) + { + UtilsFileClose(fd32[i]); + } + for (int i = 1; i < MAX_NUM_OF_OPENED_FILES; i++) { int j = i + 1; char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0}; @@ -181,6 +186,11 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testCopyFileAfterMaxFilesOpened, LEVEL1) UtilsFileClose(fd32[1]); ret = UtilsFileCopy(fileName1, fileNameCopy); TEST_ASSERT_EQUAL_INT(0, ret); + + for (int i = 2; i < MAX_NUM_OF_OPENED_FILES; i++) + { + UtilsFileClose(fd32[i]); + } // Delete all files for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) { @@ -231,6 +241,10 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testMoveFileAfterMaxFilesOpened, LEVEL1) UtilsFileClose(fd32[1]); ret = UtilsFileMove(fileName1, fileNameMove); TEST_ASSERT_EQUAL_INT(0, ret); + for (int i = 2; i < MAX_NUM_OF_OPENED_FILES; i++) + { + UtilsFileClose(fd32[i]); + } // Delete all files for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) { -- GitLab