瀏覽代碼

test for failure when interpretting block count when formatting without superblock

Brian Pugh 2 年之前
父節點
當前提交
2ebfec78c3
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      tests/test_superblocks.toml

+ 8 - 0
tests/test_superblocks.toml

@@ -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]