Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2017-09-18 04:36:42 +0300
committerChristopher Haster <chaster@utexas.edu>2017-09-18 04:38:54 +0300
commitd9367e05ce39d076aa8c5111eda6a2a9a698a507 (patch)
tree0af95d8d4c88af709fc82f3f57f89f450d6a9853 /tests
parenta83b2fe4638c92ce6cc475a3c7cc75ca431bb6b8 (diff)
Fixed collection of multiblock directories
Moslty just a hole in testing. Dir blocks were not being correctly collected when removing entries from very large files due to forgetting about the tail-bit in the directory block size. The test hole has now been filled. Also added lfs_entry_size to avoid having to repeat that expression since it is a bit ridiculous
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_dirs.sh34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/test_dirs.sh b/tests/test_dirs.sh
index 815b88b..5a7ea58 100755
--- a/tests/test_dirs.sh
+++ b/tests/test_dirs.sh
@@ -124,7 +124,6 @@ tests/test.py << TEST
TEST
echo "--- Directory remove ---"
-# TESTING HERE
tests/test.py << TEST
lfs_mount(&lfs, &cfg) => 0;
lfs_remove(&lfs, "potato") => LFS_ERR_INVAL;
@@ -283,5 +282,38 @@ tests/test.py << TEST
lfs_unmount(&lfs) => 0;
TEST
+echo "--- Multi-block remove ---"
+tests/test.py << TEST
+ lfs_mount(&lfs, &cfg) => 0;
+ lfs_remove(&lfs, "cactus") => LFS_ERR_INVAL;
+
+ for (int i = 0; i < $LARGESIZE; i++) {
+ sprintf((char*)buffer, "cactus/test%d", i);
+ lfs_remove(&lfs, (char*)buffer) => 0;
+ }
+
+ lfs_remove(&lfs, "cactus") => 0;
+ lfs_unmount(&lfs) => 0;
+TEST
+tests/test.py << TEST
+ lfs_mount(&lfs, &cfg) => 0;
+ lfs_dir_open(&lfs, &dir[0], "/") => 0;
+ lfs_dir_read(&lfs, &dir[0], &info) => 1;
+ strcmp(info.name, ".") => 0;
+ info.type => LFS_TYPE_DIR;
+ lfs_dir_read(&lfs, &dir[0], &info) => 1;
+ strcmp(info.name, "..") => 0;
+ info.type => LFS_TYPE_DIR;
+ lfs_dir_read(&lfs, &dir[0], &info) => 1;
+ strcmp(info.name, "burito") => 0;
+ info.type => LFS_TYPE_REG;
+ lfs_dir_read(&lfs, &dir[0], &info) => 1;
+ strcmp(info.name, "coldpotato") => 0;
+ info.type => LFS_TYPE_DIR;
+ lfs_dir_read(&lfs, &dir[0], &info) => 0;
+ lfs_dir_close(&lfs, &dir[0]) => 0;
+ lfs_unmount(&lfs) => 0;
+TEST
+
echo "--- Results ---"
tests/stats.py