提交 08b068ac 编写于 作者: 蛋黄威武's avatar 蛋黄威武 提交者: Gitee

xts测试存在大量只打开文件流,然后删除文件的操作。在删除前增加关闭操作

上级 51490f0b
...@@ -88,6 +88,10 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testCreatFileAfterMaxFilesOpened, LEVEL1) ...@@ -88,6 +88,10 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testCreatFileAfterMaxFilesOpened, LEVEL1)
TEST_ASSERT_GREATER_THAN_INT(0, fd33); TEST_ASSERT_GREATER_THAN_INT(0, fd33);
UtilsFileClose(fd33); UtilsFileClose(fd33);
// Delete all files // 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++) for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++)
{ {
int j = i + 1; int j = i + 1;
...@@ -126,14 +130,15 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testDeleteFileAfterMaxFilesOpened, LEVEL1 ...@@ -126,14 +130,15 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testDeleteFileAfterMaxFilesOpened, LEVEL1
} }
// Delete file // Delete file
char* fileName1 = "testReli101-1"; char* fileName1 = "testReli101-1";
UtilsFileClose(fd32[0]);
int ret = UtilsFileDelete(fileName1); 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); TEST_ASSERT_EQUAL_INT(0, ret);
// Delete all files // 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; int j = i + 1;
char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0}; char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0};
...@@ -181,6 +186,11 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testCopyFileAfterMaxFilesOpened, LEVEL1) ...@@ -181,6 +186,11 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testCopyFileAfterMaxFilesOpened, LEVEL1)
UtilsFileClose(fd32[1]); UtilsFileClose(fd32[1]);
ret = UtilsFileCopy(fileName1, fileNameCopy); ret = UtilsFileCopy(fileName1, fileNameCopy);
TEST_ASSERT_EQUAL_INT(0, ret); TEST_ASSERT_EQUAL_INT(0, ret);
for (int i = 2; i < MAX_NUM_OF_OPENED_FILES; i++)
{
UtilsFileClose(fd32[i]);
}
// Delete all files // Delete all files
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++)
{ {
...@@ -231,6 +241,10 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testMoveFileAfterMaxFilesOpened, LEVEL1) ...@@ -231,6 +241,10 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testMoveFileAfterMaxFilesOpened, LEVEL1)
UtilsFileClose(fd32[1]); UtilsFileClose(fd32[1]);
ret = UtilsFileMove(fileName1, fileNameMove); ret = UtilsFileMove(fileName1, fileNameMove);
TEST_ASSERT_EQUAL_INT(0, ret); TEST_ASSERT_EQUAL_INT(0, ret);
for (int i = 2; i < MAX_NUM_OF_OPENED_FILES; i++)
{
UtilsFileClose(fd32[i]);
}
// Delete all files // Delete all files
for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册