Reworked test_ck_spam* tests to rely on gcksums

Now that gcksums are working and we can detect rollback issues, it's
worth revisiting our most aggressive bit-error tests.

Unfortunately, I think due to focusing on ckprogs, these were a bit less
ready-to-go than I had hoped. We still have the read-hole, so the sort
of errors we can expect to detect is a bit limited.

Still, managed to come up with some schemes that I think are
interesting:

- ckprogs - Limited to catching bit-errors during progs, but these tests
  work great.

- ckdata - Limited to manual bit-errors, but can detect both metdata +
  data errors.

- ckmeta+ckfetches - Limited to manual bit-errors, ckmeta detects
  mtree errors, while ckfetches detects btree + data errors.

- ckmeta+ckdatacksums - Limited to manual bit-errors, ckmeta detects
  metadata errors, while ckdatacksums detects data errors.

To make testing manual bit-errors a bit easier, and to avoid
reimplementing the bit randomizer in emubd, I added
LFS_EMUBD_BADBLOCK_MANUAL and lfs_emubd_flip to let the tests manually
control when bits flip.

---

Unfortunately open files are proving to be an issue for these tests,
since we don't really expect corrupted metadata after lfsr_file_open (
assuming no read-hole).

For now I've limited these new ck-modes to the tests without open files,
but we should probably revisit this.
This commit is contained in:
Christopher Haster
2025-01-16 02:08:10 -06:00
parent 57e9c3b706
commit cae8b08dc9
3 changed files with 431 additions and 130 deletions
+4
View File
@@ -41,6 +41,7 @@ typedef enum lfs_emubd_badblock_behavior {
LFS_EMUBD_BADBLOCK_ERASENOOP = 4, // Erase does nothing silently
LFS_EMUBD_BADBLOCK_PROGFLIP = 5, // Prog flips a bit
LFS_EMUBD_BADBLOCK_READFLIP = 6, // Read flips a bit sometimes
LFS_EMUBD_BADBLOCK_MANUAL = 7, // Bits require manual flipping
} lfs_emubd_badblock_behavior_t;
// Mode determining how power-loss behaves during testing.
@@ -248,6 +249,9 @@ int lfs_emubd_markbadbit(const struct lfs_config *cfg,
int lfs_emubd_flipbit(const struct lfs_config *cfg,
lfs_block_t block, lfs_size_t bit);
// Flip all bits marked as bad
int lfs_emubd_flip(const struct lfs_config *cfg);
// Get the remaining power-cycles
lfs_emubd_spowercycles_t lfs_emubd_powercycles(
const struct lfs_config *cfg);