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
diff options
context:
space:
mode:
authorChristopher Haster <geky@geky.net>2023-09-12 07:56:49 +0300
committerChristopher Haster <geky@geky.net>2023-09-21 20:23:38 +0300
commit63e4408f2af1464df5b9c574661e923dc8be2386 (patch)
tree7c61f3d2edc061091fbc489e7b22da55c3566517
parentdbe4598c12a9b1e6cab2f8dc78158755b64a1e6d (diff)
Extended alloc tests to test some properties of lfs_fs_findfreeblocks
- Test that the code actually runs. - Test that lfs_fs_findfreeblocks does not break block allocations. - Test that lfs_fs_findfreeblocks does not error when no space is available, it should only errors when the block is actually needed.
-rw-r--r--tests/test_alloc.toml18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_alloc.toml b/tests/test_alloc.toml
index 916fc2a..50baa7d 100644
--- a/tests/test_alloc.toml
+++ b/tests/test_alloc.toml
@@ -6,6 +6,7 @@ if = 'BLOCK_CYCLES == -1'
[cases.test_alloc_parallel]
defines.FILES = 3
defines.SIZE = '(((BLOCK_SIZE-8)*(BLOCK_COUNT-6)) / FILES)'
+defines.GC = [false, true]
code = '''
const char *names[] = {"bacon", "eggs", "pancakes"};
lfs_file_t files[FILES];
@@ -24,6 +25,9 @@ code = '''
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_APPEND) => 0;
}
for (int n = 0; n < FILES; n++) {
+ if (GC) {
+ lfs_fs_findfreeblocks(&lfs) => 0;
+ }
size_t size = strlen(names[n]);
for (lfs_size_t i = 0; i < SIZE; i += size) {
lfs_file_write(&lfs, &files[n], names[n], size) => size;
@@ -55,6 +59,7 @@ code = '''
[cases.test_alloc_serial]
defines.FILES = 3
defines.SIZE = '(((BLOCK_SIZE-8)*(BLOCK_COUNT-6)) / FILES)'
+defines.GC = [false, true]
code = '''
const char *names[] = {"bacon", "eggs", "pancakes"};
@@ -75,6 +80,9 @@ code = '''
uint8_t buffer[1024];
memcpy(buffer, names[n], size);
for (int i = 0; i < SIZE; i += size) {
+ if (GC) {
+ lfs_fs_findfreeblocks(&lfs) => 0;
+ }
lfs_file_write(&lfs, &file, buffer, size) => size;
}
lfs_file_close(&lfs, &file) => 0;
@@ -247,6 +255,9 @@ code = '''
}
res => LFS_ERR_NOSPC;
+ // note that lfs_fs_findfreeblocks should not error here
+ lfs_fs_findfreeblocks(&lfs) => 0;
+
lfs_file_close(&lfs, &file) => 0;
lfs_unmount(&lfs) => 0;
@@ -298,6 +309,9 @@ code = '''
}
res => LFS_ERR_NOSPC;
+ // note that lfs_fs_findfreeblocks should not error here
+ lfs_fs_findfreeblocks(&lfs) => 0;
+
lfs_file_close(&lfs, &file) => 0;
lfs_unmount(&lfs) => 0;
@@ -337,6 +351,8 @@ code = '''
count += 1;
}
err => LFS_ERR_NOSPC;
+ // note that lfs_fs_findfreeblocks should not error here
+ lfs_fs_findfreeblocks(&lfs) => 0;
lfs_file_close(&lfs, &file) => 0;
lfs_remove(&lfs, "exhaustion") => 0;
@@ -435,6 +451,8 @@ code = '''
break;
}
}
+ // note that lfs_fs_findfreeblocks should not error here
+ lfs_fs_findfreeblocks(&lfs) => 0;
lfs_file_close(&lfs, &file) => 0;
lfs_unmount(&lfs) => 0;