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-10-05 00:25:19 +0300
committerChristopher Haster <chaster@utexas.edu>2018-10-18 18:00:49 +0300
commit97a7191814a5900a35f11c3ebac0f6a710a6bb90 (patch)
tree960bcbdb6009861958c061ee5782e31e8990a983 /tests
parentaeca7667b32097c109b4ce84a2f3adb2949643ab (diff)
Fixed issue with creating files named "littlefs"
A rather humorous issue, we accidentally ended up mixing our file namespace with our superblocks. This meant if we created a file named "littlefs" it would reference the superblock and all sorts of things would break. Fixing this also highlighted another issue, the fact that the superblock always needs to come before any file entries in the directory. I didn't account for this in the initial B-tree design, but we need a higher ordering for superblocks + children + files than just name. To fix this I added ordering information in the 2 bits currently unused in the tag type. Though note that the size of these fields are flexible. 9-bit type field: [--- 9 ---] [1|- 3 -|- 2 -|- 3 -] ^ ^ ^ ^- type-specific info | | \------- ordering info | \------------- subtype \----------------- user bit
Diffstat (limited to 'tests')
-rwxr-xr-xtests/debug.py8
-rwxr-xr-xtests/test_paths.sh8
2 files changed, 12 insertions, 4 deletions
diff --git a/tests/debug.py b/tests/debug.py
index 0088442..71f204a 100755
--- a/tests/debug.py
+++ b/tests/debug.py
@@ -4,8 +4,8 @@ import struct
import binascii
TYPES = {
- (0x1ff, 0x002): 'reg',
- (0x1ff, 0x003): 'dir',
+ (0x1ff, 0x011): 'create reg',
+ (0x1ff, 0x010): 'create dir',
(0x1ff, 0x001): 'superblock',
(0x1ff, 0x020): 'delete',
(0x1f0, 0x0e0): 'globals',
@@ -23,10 +23,10 @@ def typeof(type):
mask = 0x1ff & ~((1 << prefix)-1)
if (mask, type & mask) in TYPES:
return TYPES[mask, type & mask] + (
- ' [%0*x]' % (prefix/4, type & ((1 << prefix)-1))
+ ' %0*x' % (prefix/4, type & ((1 << prefix)-1))
if prefix else '')
else:
- return '[%02x]' % type
+ return '%02x' % type
def main(*blocks):
# find most recent block
diff --git a/tests/test_paths.sh b/tests/test_paths.sh
index ea5eb21..999001a 100755
--- a/tests/test_paths.sh
+++ b/tests/test_paths.sh
@@ -139,6 +139,14 @@ tests/test.py << TEST
lfs_unmount(&lfs) => 0;
TEST
+echo "--- Superblock conflict test ---"
+tests/test.py << TEST
+ lfs_mount(&lfs, &cfg) => 0;
+ lfs_mkdir(&lfs, "littlefs") => 0;
+ lfs_remove(&lfs, "littlefs") => 0;
+ lfs_unmount(&lfs) => 0;
+TEST
+
echo "--- Max path test ---"
tests/test.py << TEST
lfs_mount(&lfs, &cfg) => 0;