Replaced REMOUNT with small post-test loops where possible
We've been wasting a lot of test cycles thanks to REMOUNT. Using a test define for this effectively duplicates the test, when we really just want to run more post-test code without additional mutation. The main reason for REMOUNT has been to save typing, which, well, is not a bad reason, these tests involve a lot of typing... But this is probably a hammer/nail situation. If we replace these with a small post-test loop, we can save quite a bit of time: make test -j before: 5791.9s make test -j after: 5123.8s (-11.5%) Some tests still use a REMOUNT define, but these should be limited to cases where remount actually changes the test's behavior.
This commit is contained in:
+26
-6
@@ -219,6 +219,13 @@ code = '''
|
||||
free(seen);
|
||||
|
||||
// then check that we can read our directories after clobbering
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
char name[256];
|
||||
sprintf(name, "dir%03x", i);
|
||||
@@ -248,6 +255,7 @@ code = '''
|
||||
}
|
||||
lfsr_dir_read(&lfs, &dir, &info) => LFS_ERR_NOENT;
|
||||
lfsr_dir_close(&lfs, &dir) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -389,6 +397,13 @@ code = '''
|
||||
free(seen);
|
||||
|
||||
// then check that reading our files still works after clobbering
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
|
||||
prng = 42;
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
// check with stat
|
||||
@@ -413,6 +428,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -430,7 +446,6 @@ defines.SIZE = [
|
||||
'8*BLOCK_SIZE',
|
||||
]
|
||||
defines.VALIDATE = [false, true]
|
||||
defines.REMOUNT = [false, true]
|
||||
in = 'lfs.c'
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 32'
|
||||
code = '''
|
||||
@@ -556,7 +571,9 @@ code = '''
|
||||
lfsr_file_close(&lfs, &files[i]) => 0;
|
||||
}
|
||||
|
||||
if (REMOUNT) {
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -585,6 +602,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -595,7 +613,6 @@ code = '''
|
||||
# nospc tests mostly test that things still work when block allocation
|
||||
# wraparound occurs
|
||||
[cases.test_alloc_nospc_dirs]
|
||||
defines.REMOUNT = [false, true]
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, CFG) => 0;
|
||||
@@ -613,8 +630,9 @@ code = '''
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -651,6 +669,7 @@ code = '''
|
||||
}
|
||||
lfsr_dir_read(&lfs, &dir, &info) => LFS_ERR_NOENT;
|
||||
lfsr_dir_close(&lfs, &dir) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -665,7 +684,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'8*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, CFG) => 0;
|
||||
@@ -705,8 +723,9 @@ code = '''
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -736,6 +755,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
+27
-15
@@ -332,7 +332,6 @@ defines.BADBLOCK_BEHAVIOR = [
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||
# do more ops than dirs to encourage rename collisions
|
||||
defines.OPS = '2*N'
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 42
|
||||
code = '''
|
||||
// test all possible bad blocks
|
||||
@@ -382,8 +381,9 @@ code = '''
|
||||
assert(!err || err == LFS_ERR_EXIST);
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -436,6 +436,7 @@ code = '''
|
||||
lfsr_dir_read(&lfs, &dir, &info) => LFS_ERR_NOENT;
|
||||
lfsr_dir_close(&lfs, &dir) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -461,7 +462,6 @@ defines.MIRROR = [false, true]
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||
# do more ops than dirs to encourage rename collisions
|
||||
defines.OPS = '2*N'
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 42
|
||||
code = '''
|
||||
// test a large region of bad blocks
|
||||
@@ -516,8 +516,9 @@ code = '''
|
||||
assert(!err || err == LFS_ERR_EXIST);
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -570,6 +571,7 @@ code = '''
|
||||
lfsr_dir_read(&lfs, &dir, &info) => LFS_ERR_NOENT;
|
||||
lfsr_dir_close(&lfs, &dir) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -591,7 +593,6 @@ defines.MIRROR = [false, true]
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||
# do more ops than dirs to encourage rename collisions
|
||||
defines.OPS = '2*N'
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 42
|
||||
code = '''
|
||||
// test a large region of bad blocks
|
||||
@@ -646,8 +647,9 @@ code = '''
|
||||
assert(!err || err == LFS_ERR_EXIST);
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -700,6 +702,7 @@ code = '''
|
||||
lfsr_dir_read(&lfs, &dir, &info) => LFS_ERR_NOENT;
|
||||
lfsr_dir_close(&lfs, &dir) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -731,7 +734,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 42
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 16'
|
||||
code = '''
|
||||
@@ -797,8 +799,9 @@ code = '''
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -854,6 +857,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -889,7 +893,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 42
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 16'
|
||||
code = '''
|
||||
@@ -960,8 +963,9 @@ code = '''
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1017,6 +1021,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -1048,7 +1053,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 42
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 16'
|
||||
code = '''
|
||||
@@ -1119,8 +1123,9 @@ code = '''
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1176,6 +1181,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -1305,8 +1311,9 @@ code = '''
|
||||
}
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1347,6 +1354,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, size) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
|
||||
@@ -1481,8 +1489,9 @@ code = '''
|
||||
}
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1523,6 +1532,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, size) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1653,8 +1663,9 @@ code = '''
|
||||
}
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1695,6 +1706,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, size) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
+352
-382
File diff suppressed because it is too large
Load Diff
+101
-39
@@ -4,7 +4,6 @@ after = ['test_dirs', 'test_btree']
|
||||
|
||||
# test creation/deletion
|
||||
[cases.test_files_create]
|
||||
defines.REMOUNT = [false, true]
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, CFG) => 0;
|
||||
@@ -15,8 +14,9 @@ code = '''
|
||||
lfsr_file_open(&lfs, &file, "hello", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -54,13 +54,13 @@ code = '''
|
||||
uint8_t rbuf[8192];
|
||||
lfsr_file_read(&lfs, &file, rbuf, sizeof(rbuf)) => 0;
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
# test we can write some data, should be inlined
|
||||
[cases.test_files_hello]
|
||||
defines.REMOUNT = [false, true]
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, CFG) => 0;
|
||||
@@ -75,8 +75,9 @@ code = '''
|
||||
lfsr_file_write(&lfs, &file, wbuf, wsize) => wsize;
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -116,6 +117,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, sizeof(rbuf)) => wsize;
|
||||
assert(memcmp(rbuf, wbuf, wsize) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -152,6 +154,13 @@ code = '''
|
||||
lfsr_file_write(&lfs, &file, wbuf, wsize) => wsize;
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
|
||||
// check our file with stat
|
||||
struct lfs_info info;
|
||||
lfsr_stat(&lfs, "hello", &info) => 0;
|
||||
@@ -187,6 +196,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, sizeof(rbuf)) => wsize;
|
||||
assert(memcmp(rbuf, wbuf, wsize) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -218,8 +228,10 @@ code = '''
|
||||
// try to recreate file, this should error
|
||||
lfsr_file_open(&lfs, &file, "hello",
|
||||
LFS_O_WRONLY | LFS_O_CREAT | LFS_O_EXCL) => LFS_ERR_EXIST;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -259,6 +271,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, sizeof(rbuf)) => wsize;
|
||||
assert(memcmp(rbuf, wbuf, wsize) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -298,8 +311,9 @@ code = '''
|
||||
lfsr_mkdir(&lfs, "not_hello") => 0;
|
||||
lfsr_rename(&lfs, "not_hello", "hello") => LFS_ERR_NOTDIR;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -342,13 +356,13 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, sizeof(rbuf)) => wsize;
|
||||
assert(memcmp(rbuf, wbuf, wsize) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
# a directory is not a file
|
||||
[cases.test_files_dir_not_file]
|
||||
defines.REMOUNT = [false, true]
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, CFG) => 0;
|
||||
@@ -381,8 +395,9 @@ code = '''
|
||||
|
||||
lfsr_rename(&lfs, "not_hello", "hello") => LFS_ERR_ISDIR;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -427,13 +442,13 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, sizeof(rbuf)) => wsize;
|
||||
assert(memcmp(rbuf, wbuf, wsize) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
# root is also not a file
|
||||
[cases.test_files_root_not_file]
|
||||
defines.REMOUNT = [false, true]
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, CFG) => 0;
|
||||
@@ -463,8 +478,9 @@ code = '''
|
||||
|
||||
lfsr_rename(&lfs, "not_hello", "/") => LFS_ERR_INVAL;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -505,13 +521,13 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, sizeof(rbuf)) => wsize;
|
||||
assert(memcmp(rbuf, wbuf, wsize) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
# an invalid path is also not a file (kind of?)
|
||||
[cases.test_files_noent_not_file]
|
||||
defines.REMOUNT = [false, true]
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, CFG) => 0;
|
||||
@@ -541,8 +557,9 @@ code = '''
|
||||
|
||||
lfsr_rename(&lfs, "not_hello", "no/hello") => LFS_ERR_NOENT;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -583,6 +600,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, sizeof(rbuf)) => wsize;
|
||||
assert(memcmp(rbuf, wbuf, wsize) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -604,7 +622,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.FBUFFER_SIZE = 64
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
@@ -622,8 +639,9 @@ code = '''
|
||||
lfsr_file_write(&lfs, &file, wbuf, SIZE) => SIZE;
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -663,6 +681,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*SIZE) => SIZE;
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -679,7 +698,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
if = [
|
||||
'(SIZE*N)/BLOCK_SIZE <= 32',
|
||||
# limit powerloss testing due to time
|
||||
@@ -722,8 +740,9 @@ code = '''
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -753,6 +772,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -771,7 +791,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 'range(20)'
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 16'
|
||||
code = '''
|
||||
@@ -827,8 +846,9 @@ code = '''
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -884,6 +904,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -934,8 +955,9 @@ code = '''
|
||||
// remove our file
|
||||
lfsr_remove(&lfs, "amethyst") => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -957,6 +979,7 @@ code = '''
|
||||
assert(info.size == 0);
|
||||
lfsr_dir_read(&lfs, &dir, &info) => LFS_ERR_NOENT;
|
||||
lfsr_dir_close(&lfs, &dir) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1063,6 +1086,13 @@ code = '''
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
|
||||
// check that our removes worked
|
||||
//
|
||||
// note we need to keep the prng in sync
|
||||
@@ -1085,7 +1115,8 @@ code = '''
|
||||
|
||||
// and try to open
|
||||
lfsr_file_t file;
|
||||
lfsr_file_open(&lfs, &file, name, LFS_O_RDONLY) => LFS_ERR_NOENT;
|
||||
lfsr_file_open(&lfs, &file, name, LFS_O_RDONLY)
|
||||
=> LFS_ERR_NOENT;
|
||||
} else {
|
||||
// check with stat
|
||||
struct lfs_info info;
|
||||
@@ -1103,6 +1134,7 @@ code = '''
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1121,7 +1153,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 'range(20)'
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 16'
|
||||
code = '''
|
||||
@@ -1200,8 +1231,9 @@ code = '''
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1257,6 +1289,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -1310,8 +1343,9 @@ code = '''
|
||||
// rename the file
|
||||
lfsr_rename(&lfs, "amethyst", "calcite") => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1359,6 +1393,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*SIZE) => SIZE;
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1418,8 +1453,9 @@ code = '''
|
||||
// rename the file
|
||||
lfsr_rename(&lfs, "amethyst", "calcite") => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1468,6 +1504,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*SIZE) => SIZE;
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1510,8 +1547,9 @@ code = '''
|
||||
// rename the file
|
||||
lfsr_rename(&lfs, "amethyst", "amethyst") => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1551,6 +1589,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*SIZE) => SIZE;
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1596,8 +1635,9 @@ code = '''
|
||||
// rename the file
|
||||
lfsr_rename(&lfs, "amethyst", "basalt") => LFS_ERR_ISDIR;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1645,6 +1685,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*SIZE) => SIZE;
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1690,8 +1731,9 @@ code = '''
|
||||
// rename the dir
|
||||
lfsr_rename(&lfs, "basalt", "amethyst") => LFS_ERR_NOTDIR;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1739,6 +1781,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*SIZE) => SIZE;
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1781,8 +1824,9 @@ code = '''
|
||||
// rename the file
|
||||
lfsr_rename(&lfs, "amethyst", "/") => LFS_ERR_INVAL;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1822,6 +1866,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*SIZE) => SIZE;
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1864,8 +1909,9 @@ code = '''
|
||||
// rename the file
|
||||
lfsr_rename(&lfs, "amethyst", "no/amethyst") => LFS_ERR_NOENT;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1905,6 +1951,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*SIZE) => SIZE;
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -2012,6 +2059,13 @@ code = '''
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
|
||||
// check that our renames worked
|
||||
prng = 42;
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
@@ -2039,6 +2093,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -2060,7 +2115,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 32'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
@@ -2087,7 +2141,9 @@ code = '''
|
||||
lfsr_rename(&lfs, "amethyst", name) => 0;
|
||||
}
|
||||
|
||||
if (REMOUNT) {
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -2118,6 +2174,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -2133,7 +2190,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 32'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
@@ -2160,7 +2216,9 @@ code = '''
|
||||
lfsr_rename(&lfs, "cobalt", name) => 0;
|
||||
}
|
||||
|
||||
if (REMOUNT) {
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -2191,6 +2249,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -2210,7 +2269,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 'range(20)'
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 16'
|
||||
code = '''
|
||||
@@ -2326,8 +2384,9 @@ code = '''
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -2383,6 +2442,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -2405,7 +2465,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 'range(20)'
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 16'
|
||||
code = '''
|
||||
@@ -2538,8 +2597,9 @@ code = '''
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -2595,6 +2655,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -2624,7 +2685,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 'range(20)'
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 16'
|
||||
reentrant = true
|
||||
@@ -2766,8 +2826,9 @@ code = '''
|
||||
// go ahead and close our state file in case we remount
|
||||
lfsr_file_close(&lfs, &state_file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -2812,6 +2873,7 @@ code = '''
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
lfsr_dir_close(&lfs, &dir) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
+68
-12
@@ -66,8 +66,9 @@ code = '''
|
||||
}
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -107,6 +108,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*SIZE) => SIZE;
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -245,8 +247,9 @@ code = '''
|
||||
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -287,6 +290,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -426,8 +430,9 @@ code = '''
|
||||
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -468,6 +473,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, size) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -539,8 +545,9 @@ code = '''
|
||||
// close
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -580,6 +587,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*TO) => TO;
|
||||
assert(memcmp(rbuf, sim, TO) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -681,8 +689,9 @@ code = '''
|
||||
// close
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -722,6 +731,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*TO) => TO;
|
||||
assert(memcmp(rbuf, sim, TO) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -797,8 +807,9 @@ code = '''
|
||||
// close
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -838,6 +849,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*TO) => TO;
|
||||
assert(memcmp(rbuf, sim, TO) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -947,8 +959,9 @@ code = '''
|
||||
// close
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -988,6 +1001,7 @@ code = '''
|
||||
lfsr_file_read(&lfs, &file, rbuf, 2*TO) => TO;
|
||||
assert(memcmp(rbuf, sim, TO) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1076,8 +1090,9 @@ code = '''
|
||||
}
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1118,6 +1133,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1265,8 +1281,9 @@ code = '''
|
||||
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1307,6 +1324,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1455,8 +1473,9 @@ code = '''
|
||||
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1497,6 +1516,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, size) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1595,8 +1615,9 @@ code = '''
|
||||
}
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1637,6 +1658,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, size) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1742,8 +1764,9 @@ code = '''
|
||||
}
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1784,6 +1807,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, size) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -1967,6 +1991,13 @@ code = '''
|
||||
}
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
|
||||
// check our file with stat
|
||||
struct lfs_info info;
|
||||
lfsr_stat(&lfs, "hello", &info) => 0;
|
||||
@@ -2003,6 +2034,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, size) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -2131,6 +2163,13 @@ code = '''
|
||||
}
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
|
||||
// check our file with stat
|
||||
struct lfs_info info;
|
||||
lfsr_stat(&lfs, "hello", &info) => 0;
|
||||
@@ -2167,6 +2206,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, size) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -2231,6 +2271,13 @@ code = '''
|
||||
}
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
|
||||
// check our file with stat
|
||||
struct lfs_info info;
|
||||
lfsr_stat(&lfs, "hello", &info) => 0;
|
||||
@@ -2267,6 +2314,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, size) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
@@ -2435,6 +2483,13 @@ code = '''
|
||||
}
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
|
||||
// check our file with stat
|
||||
struct lfs_info info;
|
||||
lfsr_stat(&lfs, "hello", &info) => 0;
|
||||
@@ -2471,6 +2526,7 @@ code = '''
|
||||
// does our file match our simulation?
|
||||
assert(memcmp(rbuf, sim, size) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
@@ -15,7 +15,6 @@ after = [
|
||||
defines.BLOCK_RECYCLES = [4, 1, 0]
|
||||
defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||
defines.OPS = 1024
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 'range(10)'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
@@ -110,13 +109,15 @@ code = '''
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
|
||||
// grm should be zero here
|
||||
assert(lfs.grm_p[0] == 0);
|
||||
}
|
||||
|
||||
// test that our directories match our simulation
|
||||
for (lfs_size_t j = 0; j < sim_size; j++) {
|
||||
@@ -152,6 +153,7 @@ code = '''
|
||||
}
|
||||
lfsr_dir_read(&lfs, &dir, &info) => LFS_ERR_NOENT;
|
||||
lfsr_dir_close(&lfs, &dir) => 0;
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -172,7 +174,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 'range(10)'
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 16'
|
||||
code = '''
|
||||
@@ -305,8 +306,9 @@ code = '''
|
||||
}
|
||||
}
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -362,6 +364,7 @@ code = '''
|
||||
assert(memcmp(rbuf, wbuf, SIZE) == 0);
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up sim/lfs
|
||||
free(sim);
|
||||
@@ -1146,7 +1149,6 @@ defines.SIZE = [
|
||||
'2*BLOCK_SIZE',
|
||||
'4*BLOCK_SIZE',
|
||||
]
|
||||
defines.REMOUNT = [false, true]
|
||||
defines.SEED = 'range(10)'
|
||||
if = '(SIZE*N)/BLOCK_SIZE <= 16'
|
||||
reentrant = true
|
||||
@@ -1288,8 +1290,9 @@ code = '''
|
||||
// go ahead and close our state file in case we remount
|
||||
lfsr_file_close(&lfs, &state_file) => 0;
|
||||
|
||||
for (int remount = 0; remount < 2; remount++) {
|
||||
// remount?
|
||||
if (REMOUNT) {
|
||||
if (remount) {
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
lfsr_mount(&lfs, CFG) => 0;
|
||||
}
|
||||
@@ -1334,6 +1337,7 @@ code = '''
|
||||
lfsr_file_close(&lfs, &file) => 0;
|
||||
}
|
||||
lfsr_dir_close(&lfs, &dir) => 0;
|
||||
}
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user