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>2018-07-30 17:10:04 +0300
committerChristopher Haster <chaster@utexas.edu>2018-10-16 15:04:44 +0300
commit3e246da52c206c1989ae598b444693941f89dc95 (patch)
tree32def60517f667a24a6ea793e82ec5beeb3d4467 /tests
parent15d156082cf59a845582ec32e541c64edf58d47c (diff)
Fixed the orphan test to handle logging metadata-pairs
The main issue here was that the old orphan test relied on deleting the block that contained the most recent update. In the new design this doesn't really work since updates get appended to metadata-pairs incrementally. This is fixed by instead using the truncate command on the appropriate block. We're now passing orphan tests.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_corrupt.sh3
-rwxr-xr-xtests/test_orphan.sh28
2 files changed, 19 insertions, 12 deletions
diff --git a/tests/test_corrupt.sh b/tests/test_corrupt.sh
index 1491dac..faa6f7e 100755
--- a/tests/test_corrupt.sh
+++ b/tests/test_corrupt.sh
@@ -78,8 +78,11 @@ do
rm -rf blocks
mkdir blocks
ln -s /dev/zero blocks/$(printf '%x' $i)
+ echo $i 1i
lfs_mktree
+ echo $i 2i
lfs_chktree
+ echo $i 3i
done
echo "--- Block persistance ---"
diff --git a/tests/test_orphan.sh b/tests/test_orphan.sh
index 71d6d4f..a76088b 100755
--- a/tests/test_orphan.sh
+++ b/tests/test_orphan.sh
@@ -15,25 +15,29 @@ tests/test.py << TEST
lfs_mkdir(&lfs, "parent/child") => 0;
lfs_remove(&lfs, "parent/orphan") => 0;
TEST
-# remove most recent file, this should be the update to the previous
+# corrupt most recent commit, this should be the update to the previous
# linked-list entry and should orphan the child
-rm -v blocks/8
-tests/test.py << TEST
+truncate -s-14 blocks/8
+tests/test.py << TEST
lfs_mount(&lfs, &cfg) => 0;
+
+ lfs_stat(&lfs, "parent/orphan", &info) => LFS_ERR_NOENT;
+ lfs_ssize_t before = lfs_fs_size(&lfs);
+ before => 10;
+
+ lfs_unmount(&lfs) => 0;
+ lfs_mount(&lfs, &cfg) => 0;
+
lfs_stat(&lfs, "parent/orphan", &info) => LFS_ERR_NOENT;
- unsigned before = 0;
- lfs_traverse(&lfs, test_count, &before) => 0;
- test_log("before", before);
+ lfs_ssize_t orphaned = lfs_fs_size(&lfs);
+ orphaned => 10;
- lfs_deorphan(&lfs) => 0;
+ lfs_mkdir(&lfs, "parent/otherchild") => 0;
lfs_stat(&lfs, "parent/orphan", &info) => LFS_ERR_NOENT;
- unsigned after = 0;
- lfs_traverse(&lfs, test_count, &after) => 0;
- test_log("after", after);
+ lfs_ssize_t deorphaned = lfs_fs_size(&lfs);
+ deorphaned => 10;
- int diff = before - after;
- diff => 2;
lfs_unmount(&lfs) => 0;
TEST