Added test_wl and aggressive orphan/zombie fuzz tests

test_wl is intended to test wear-leveling, although right now that just
involves heavy-duty fuzz tests with extremely low block_recycles.

What may be more interesting is the addition of aggressive orphan/zombie
tests:

- test_forphans_orphanzombie_fuzz
- test_forphans_orphanzombiedir_fuzz
- test_wl_orphanzombie_fuzz
- test_wl_orphanzombiedir_fuzz

These tests mix random file/dir operations while keeping random file
handles open, creating a complex environment for hitting weird orphan/
zombie corner cases.

And they did find a bug! We were asserting on LFS_ERR_RANGE when
migrating shrubs/sprouts during lfsr_mdir_commit__. The tricky thing
about lfsr_mdir_commit__ is that we need to expect LFS_ERR_RANGE from
any append operations, since this is what trigger mdir compaction. This
is especially tricky since LFS_ERR_RANGE is a hard error in most other
functions.

Easy fix. lfsr_mdir_commit__ contains no more LFS_ERR_RANGE asserts.
With these tests hopefully that's the last time we see this mistake.
This commit is contained in:
Christopher Haster
2024-05-22 15:25:50 -05:00
parent b3feeea385
commit ba81a2bcc9
4 changed files with 1892 additions and 4 deletions
-3
View File
@@ -6082,7 +6082,6 @@ static int lfsr_mdir_commit__(lfs_t *lfs, lfsr_mdir_t *mdir,
LFSR_TAG_SHRUB | LFSR_TAG_DATA, 0,
&file->bshrub.u.bsprout, 1));
if (err) {
LFS_ASSERT(err != LFS_ERR_RANGE);
return err;
}
@@ -6090,7 +6089,6 @@ static int lfsr_mdir_commit__(lfs_t *lfs, lfsr_mdir_t *mdir,
&file->bshrub_.u.bsprout,
&file->bshrub.u.bsprout);
if (err) {
LFS_ASSERT(err != LFS_ERR_RANGE);
return err;
}
@@ -6105,7 +6103,6 @@ static int lfsr_mdir_commit__(lfs_t *lfs, lfsr_mdir_t *mdir,
&file->bshrub_.u.bshrub,
&file->bshrub.u.bshrub);
if (err) {
LFS_ASSERT(err != LFS_ERR_RANGE);
return err;
}
}