Added back heuristic-based power-loss testing

The main change here from the previous test framework design is:

1. Powerloss testing remains in-process, speeding up testing.

2. The state of a test, included all powerlosses, is encoded in the
   test id + leb16 encoded powerloss string. This means exhaustive
   testing can be run in CI, but then easily reproduced locally with
   full debugger support.

   For example:

   ./scripts/test.py test_dirs#reentrant_many_dir#10#1248g1g2 --gdb

   Will run the test test_dir, case reentrant_many_dir, permutation #10,
   with powerlosses at 1, 2, 4, 8, 16, and 32 cycles. Dropping into gdb
   if an assert fails.

The changes to the block-device are a work-in-progress for a
lazily-allocated/copy-on-write block device that I'm hoping will keep
exhaustive testing relatively low-cost.
This commit is contained in:
Christopher Haster
2022-08-19 18:57:55 -05:00
parent 01b11da31b
commit 61455b6191
8 changed files with 1391 additions and 571 deletions
+14 -13
View File
@@ -5,18 +5,16 @@
// generated test configurations
enum test_types {
TEST_NORMAL = 0x1,
TEST_REENTRANT = 0x2,
enum test_flags {
TEST_REENTRANT = 0x1,
};
typedef uint8_t test_types_t;
typedef uint8_t test_flags_t;
struct test_case {
const char *id;
const char *name;
const char *path;
test_types_t types;
test_flags_t flags;
size_t permutations;
intmax_t (*const *const *defines)(void);
@@ -29,7 +27,7 @@ struct test_suite {
const char *id;
const char *name;
const char *path;
test_types_t types;
test_flags_t flags;
const char *const *define_names;
size_t define_count;
@@ -54,6 +52,7 @@ intmax_t test_define(size_t define);
#define ERASE_VALUE test_predefine(7)
#define ERASE_CYCLES test_predefine(8)
#define BADBLOCK_BEHAVIOR test_predefine(9)
#define POWERLOSS_BEHAVIOR test_predefine(10)
#define TEST_PREDEFINE_NAMES { \
"READ_SIZE", \
@@ -66,17 +65,19 @@ intmax_t test_define(size_t define);
"ERASE_VALUE", \
"ERASE_CYCLES", \
"BADBLOCK_BEHAVIOR", \
"POWERLOSS_BEHAVIOR", \
}
#define TEST_PREDEFINE_COUNT 10
#define TEST_PREDEFINE_COUNT 11
// default predefines
#define TEST_DEFAULTS { \
/* LOOKAHEAD_SIZE */ 16, \
/* BLOCK_CYCLES */ -1, \
/* ERASE_VALUE */ 0xff, \
/* ERASE_CYCLES */ 0, \
/* BADBLOCK_BEHAVIOR */ LFS_TESTBD_BADBLOCK_PROGERROR, \
/* LOOKAHEAD_SIZE */ 16, \
/* BLOCK_CYCLES */ -1, \
/* ERASE_VALUE */ 0xff, \
/* ERASE_CYCLES */ 0, \
/* BADBLOCK_BEHAVIOR */ LFS_TESTBD_BADBLOCK_PROGERROR, \
/* POWERLOSS_BEHAVIOR */ LFS_TESTBD_POWERLOSS_NOOP, \
}
#define TEST_DEFAULT_DEFINE_COUNT 5