mirror of https://github.com/ARMmbed/mbed-os.git
Removed check for . and .. enteries in filesystem test
ChanFs - Dot entries ("." and "..") in the sub-directory are filtered out and they will never appear in the read itemspull/7774/head
parent
2900de1bdf
commit
2f7660cdf3
|
@ -260,18 +260,12 @@ void test_multi_block_directory() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
res = dir[0].open(&fs, "cactus");
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
res = dir[0].read(&ent);
|
||||
TEST_ASSERT_EQUAL(1, res);
|
||||
res = strcmp(ent.d_name, ".");
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
res = ent.d_type;
|
||||
TEST_ASSERT_EQUAL(DT_DIR, res);
|
||||
res = dir[0].read(&ent);
|
||||
TEST_ASSERT_EQUAL(1, res);
|
||||
res = strcmp(ent.d_name, "..");
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
res = ent.d_type;
|
||||
TEST_ASSERT_EQUAL(DT_DIR, res);
|
||||
|
||||
#if (MBED_TEST_FILESYSTEM != FATFileSystem)
|
||||
char *dir_list[] = {".", ".."};
|
||||
dir_file_check(dir_list, (sizeof(dir_list)/sizeof(dir_list[0])));
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 128; i++) {
|
||||
sprintf((char*)buffer, "test%d", i);
|
||||
res = dir[0].read(&ent);
|
||||
|
@ -308,18 +302,12 @@ void test_directory_remove() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
res = dir[0].open(&fs, "potato");
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
res = dir[0].read(&ent);
|
||||
TEST_ASSERT_EQUAL(1, res);
|
||||
res = strcmp(ent.d_name, ".");
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
res = ent.d_type;
|
||||
TEST_ASSERT_EQUAL(DT_DIR, res);
|
||||
res = dir[0].read(&ent);
|
||||
TEST_ASSERT_EQUAL(1, res);
|
||||
res = strcmp(ent.d_name, "..");
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
res = ent.d_type;
|
||||
TEST_ASSERT_EQUAL(DT_DIR, res);
|
||||
|
||||
#if (MBED_TEST_FILESYSTEM != FATFileSystem)
|
||||
char *dir_list[] = {".", ".."};
|
||||
dir_file_check(dir_list, (sizeof(dir_list)/sizeof(dir_list[0])));
|
||||
#endif
|
||||
|
||||
res = dir[0].read(&ent);
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
res = dir[0].close();
|
||||
|
|
|
@ -207,9 +207,11 @@ int32_t fsfat_filepath_remove_all(char* filepath)
|
|||
pos = fpathbuf + strlen(fpathbuf);
|
||||
while (pos != fpathbuf) {
|
||||
/* If the remaining file path is the mount point path then finish as the mount point cannot be removed */
|
||||
if (strlen(fpathbuf) == strlen(FSFAT_FOPEN_TEST_MOUNT_PT_PATH) && strncmp(fpathbuf, FSFAT_FOPEN_TEST_MOUNT_PT_PATH, strlen(fpathbuf)) == 0) {
|
||||
if (strlen(fpathbuf) == strlen(FSFAT_FOPEN_TEST_MOUNT_PT_PATH)) {
|
||||
if( strncmp(fpathbuf, FSFAT_FOPEN_TEST_MOUNT_PT_PATH, strlen(fpathbuf)) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
ret = remove(fpathbuf);
|
||||
pos = strrchr(fpathbuf, '/');
|
||||
*pos = '\0';
|
||||
|
@ -1100,15 +1102,6 @@ control_t fsfat_fopen_test_12(const size_t call_count)
|
|||
*pos = '\0';
|
||||
dir = opendir(buf);
|
||||
|
||||
dp = readdir(dir);
|
||||
TEST_ASSERT_MESSAGE(dp != 0, "Error: readdir() failed\n");
|
||||
FSFAT_TEST_UTEST_MESSAGE(fsfat_fopen_utest_msg_g, FSFAT_UTEST_MSG_BUF_SIZE, "%s:Error: unexpected object name (name=%s, expected=%s).\n", __func__, dp->d_name, ".");
|
||||
TEST_ASSERT_MESSAGE(strncmp(dp->d_name, ".", strlen(".")) == 0, fsfat_fopen_utest_msg_g);
|
||||
dp = readdir(dir);
|
||||
TEST_ASSERT_MESSAGE(dp != 0, "Error: readdir() failed\n");
|
||||
FSFAT_TEST_UTEST_MESSAGE(fsfat_fopen_utest_msg_g, FSFAT_UTEST_MSG_BUF_SIZE, "%s:Error: unexpected object name (name=%s, expected=%s).\n", __func__, dp->d_name, "..");
|
||||
TEST_ASSERT_MESSAGE(strncmp(dp->d_name, "..", strlen("..")) == 0, fsfat_fopen_utest_msg_g);
|
||||
|
||||
while ((dp = readdir(dir)) != NULL) {
|
||||
FSFAT_DBGLOG("%s: filename: \"%s\"\n", __func__, dp->d_name);
|
||||
TEST_ASSERT_MESSAGE(dp != 0, "Error: readdir() failed\n");
|
||||
|
|
Loading…
Reference in New Issue