Generated v2 prefixes

This commit is contained in:
geky-bot
2023-05-04 18:31:30 +00:00
67 changed files with 26771 additions and 5203 deletions
+60 -37
View File
@@ -1,6 +1,7 @@
[[case]] # simple file seek
define = [
# simple file seek
[cases.test_seek_read]
defines = [
{COUNT=132, SKIP=4},
{COUNT=132, SKIP=128},
{COUNT=200, SKIP=10},
@@ -9,11 +10,14 @@ define = [
{COUNT=4, SKIP=2},
]
code = '''
lfs2_format(&lfs2, &cfg) => 0;
lfs2_mount(&lfs2, &cfg) => 0;
lfs2_t lfs2;
lfs2_format(&lfs2, cfg) => 0;
lfs2_mount(&lfs2, cfg) => 0;
lfs2_file_t file;
lfs2_file_open(&lfs2, &file, "kitty",
LFS2_O_WRONLY | LFS2_O_CREAT | LFS2_O_APPEND) => 0;
size = strlen("kittycatcat");
size_t size = strlen("kittycatcat");
uint8_t buffer[1024];
memcpy(buffer, "kittycatcat", size);
for (int j = 0; j < COUNT; j++) {
lfs2_file_write(&lfs2, &file, buffer, size);
@@ -21,7 +25,7 @@ code = '''
lfs2_file_close(&lfs2, &file) => 0;
lfs2_unmount(&lfs2) => 0;
lfs2_mount(&lfs2, &cfg) => 0;
lfs2_mount(&lfs2, cfg) => 0;
lfs2_file_open(&lfs2, &file, "kitty", LFS2_O_RDONLY) => 0;
lfs2_soff_t pos = -1;
@@ -68,8 +72,9 @@ code = '''
lfs2_unmount(&lfs2) => 0;
'''
[[case]] # simple file seek and write
define = [
# simple file seek and write
[cases.test_seek_write]
defines = [
{COUNT=132, SKIP=4},
{COUNT=132, SKIP=128},
{COUNT=200, SKIP=10},
@@ -78,11 +83,14 @@ define = [
{COUNT=4, SKIP=2},
]
code = '''
lfs2_format(&lfs2, &cfg) => 0;
lfs2_mount(&lfs2, &cfg) => 0;
lfs2_t lfs2;
lfs2_format(&lfs2, cfg) => 0;
lfs2_mount(&lfs2, cfg) => 0;
lfs2_file_t file;
lfs2_file_open(&lfs2, &file, "kitty",
LFS2_O_WRONLY | LFS2_O_CREAT | LFS2_O_APPEND) => 0;
size = strlen("kittycatcat");
size_t size = strlen("kittycatcat");
uint8_t buffer[1024];
memcpy(buffer, "kittycatcat", size);
for (int j = 0; j < COUNT; j++) {
lfs2_file_write(&lfs2, &file, buffer, size);
@@ -90,7 +98,7 @@ code = '''
lfs2_file_close(&lfs2, &file) => 0;
lfs2_unmount(&lfs2) => 0;
lfs2_mount(&lfs2, &cfg) => 0;
lfs2_mount(&lfs2, cfg) => 0;
lfs2_file_open(&lfs2, &file, "kitty", LFS2_O_RDWR) => 0;
lfs2_soff_t pos = -1;
@@ -129,15 +137,18 @@ code = '''
lfs2_unmount(&lfs2) => 0;
'''
[[case]] # boundary seek and writes
define.COUNT = 132
define.OFFSETS = '"{512, 1020, 513, 1021, 511, 1019, 1441}"'
# boundary seek and writes
[cases.test_seek_boundary_write]
defines.COUNT = 132
code = '''
lfs2_format(&lfs2, &cfg) => 0;
lfs2_mount(&lfs2, &cfg) => 0;
lfs2_t lfs2;
lfs2_format(&lfs2, cfg) => 0;
lfs2_mount(&lfs2, cfg) => 0;
lfs2_file_t file;
lfs2_file_open(&lfs2, &file, "kitty",
LFS2_O_WRONLY | LFS2_O_CREAT | LFS2_O_APPEND) => 0;
size = strlen("kittycatcat");
size_t size = strlen("kittycatcat");
uint8_t buffer[1024];
memcpy(buffer, "kittycatcat", size);
for (int j = 0; j < COUNT; j++) {
lfs2_file_write(&lfs2, &file, buffer, size);
@@ -145,11 +156,11 @@ code = '''
lfs2_file_close(&lfs2, &file) => 0;
lfs2_unmount(&lfs2) => 0;
lfs2_mount(&lfs2, &cfg) => 0;
lfs2_mount(&lfs2, cfg) => 0;
lfs2_file_open(&lfs2, &file, "kitty", LFS2_O_RDWR) => 0;
size = strlen("hedgehoghog");
const lfs2_soff_t offsets[] = OFFSETS;
const lfs2_soff_t offsets[] = {512, 1020, 513, 1021, 511, 1019, 1441};
for (unsigned i = 0; i < sizeof(offsets) / sizeof(offsets[0]); i++) {
lfs2_soff_t off = offsets[i];
@@ -183,8 +194,9 @@ code = '''
lfs2_unmount(&lfs2) => 0;
'''
[[case]] # out of bounds seek
define = [
# out of bounds seek
[cases.test_seek_out_of_bounds]
defines = [
{COUNT=132, SKIP=4},
{COUNT=132, SKIP=128},
{COUNT=200, SKIP=10},
@@ -193,18 +205,21 @@ define = [
{COUNT=4, SKIP=3},
]
code = '''
lfs2_format(&lfs2, &cfg) => 0;
lfs2_mount(&lfs2, &cfg) => 0;
lfs2_t lfs2;
lfs2_format(&lfs2, cfg) => 0;
lfs2_mount(&lfs2, cfg) => 0;
lfs2_file_t file;
lfs2_file_open(&lfs2, &file, "kitty",
LFS2_O_WRONLY | LFS2_O_CREAT | LFS2_O_APPEND) => 0;
size = strlen("kittycatcat");
size_t size = strlen("kittycatcat");
uint8_t buffer[1024];
memcpy(buffer, "kittycatcat", size);
for (int j = 0; j < COUNT; j++) {
lfs2_file_write(&lfs2, &file, buffer, size);
}
lfs2_file_close(&lfs2, &file) => 0;
lfs2_unmount(&lfs2) => 0;
lfs2_mount(&lfs2, &cfg) => 0;
lfs2_mount(&lfs2, cfg) => 0;
lfs2_file_open(&lfs2, &file, "kitty", LFS2_O_RDWR) => 0;
size = strlen("kittycatcat");
@@ -238,16 +253,20 @@ code = '''
lfs2_unmount(&lfs2) => 0;
'''
[[case]] # inline write and seek
define.SIZE = [2, 4, 128, 132]
# inline write and seek
[cases.test_seek_inline_write]
defines.SIZE = [2, 4, 128, 132]
code = '''
lfs2_format(&lfs2, &cfg) => 0;
lfs2_mount(&lfs2, &cfg) => 0;
lfs2_t lfs2;
lfs2_format(&lfs2, cfg) => 0;
lfs2_mount(&lfs2, cfg) => 0;
lfs2_file_t file;
lfs2_file_open(&lfs2, &file, "tinykitty",
LFS2_O_RDWR | LFS2_O_CREAT) => 0;
int j = 0;
int k = 0;
uint8_t buffer[1024];
memcpy(buffer, "abcdefghijklmnopqrstuvwxyz", 26);
for (unsigned i = 0; i < SIZE; i++) {
lfs2_file_write(&lfs2, &file, &buffer[j++ % 26], 1) => 1;
@@ -305,16 +324,20 @@ code = '''
lfs2_unmount(&lfs2) => 0;
'''
[[case]] # file seek and write with power-loss
# file seek and write with power-loss
[cases.test_seek_reentrant_write]
# must be power-of-2 for quadratic probing to be exhaustive
define.COUNT = [4, 64, 128]
defines.COUNT = [4, 64, 128]
reentrant = true
code = '''
err = lfs2_mount(&lfs2, &cfg);
lfs2_t lfs2;
int err = lfs2_mount(&lfs2, cfg);
if (err) {
lfs2_format(&lfs2, &cfg) => 0;
lfs2_mount(&lfs2, &cfg) => 0;
lfs2_format(&lfs2, cfg) => 0;
lfs2_mount(&lfs2, cfg) => 0;
}
lfs2_file_t file;
uint8_t buffer[1024];
err = lfs2_file_open(&lfs2, &file, "kitty", LFS2_O_RDONLY);
assert(!err || err == LFS2_ERR_NOENT);
if (!err) {
@@ -334,14 +357,14 @@ code = '''
if (lfs2_file_size(&lfs2, &file) == 0) {
for (int j = 0; j < COUNT; j++) {
strcpy((char*)buffer, "kittycatcat");
size = strlen((char*)buffer);
size_t size = strlen((char*)buffer);
lfs2_file_write(&lfs2, &file, buffer, size) => size;
}
}
lfs2_file_close(&lfs2, &file) => 0;
strcpy((char*)buffer, "doggodogdog");
size = strlen((char*)buffer);
size_t size = strlen((char*)buffer);
lfs2_file_open(&lfs2, &file, "kitty", LFS2_O_RDWR) => 0;
lfs2_file_size(&lfs2, &file) => COUNT*size;