test for failure when interpretting block count when formatting without superblock

This commit is contained in:
Brian Pugh 2023-08-17 15:20:46 -07:00
parent 3d0bcf4066
commit 2ebfec78c3
1 changed files with 8 additions and 0 deletions

View File

@ -19,6 +19,14 @@ code = '''
assert(lfs.block_count == cfg->block_count);
'''
# formatting from interpretting a non-existent previous superblock block_count
[cases.test_superblocks_format_unknown_block_count_failure]
code = '''
lfs_t lfs;
struct lfs_config tweaked_cfg = *cfg;
tweaked_cfg.block_count = 0;
lfs_format(&lfs, &tweaked_cfg) => LFS_ERR_CORRUPT;
'''
# mount/unmount
[cases.test_superblocks_mount]