Reintroduced test-defines into the new test_runner
This moves defines entirely into the runtime of the test_runner, simplifying thing and reducing the amount of generated code that needs to be build, at the cost of limiting test-defines to uintmax_t types. This is implemented using a set of index-based scopes (created by test.py) that allow different layers to override defines from other layers, accessible through the global `test_define` function. layers: 1. command-line overrides 2. per-case defines 3. per-geometry defines
This commit is contained in:
+36
-1
@@ -4,11 +4,24 @@
|
||||
#include "lfs.h"
|
||||
|
||||
|
||||
// generated test configurations
|
||||
enum test_type {
|
||||
TEST_NORMAL = 0x1,
|
||||
TEST_REENTRANT = 0x2,
|
||||
TEST_VALGRIND = 0x4,
|
||||
};
|
||||
|
||||
struct test_case {
|
||||
const char *id;
|
||||
const char *name;
|
||||
const char *path;
|
||||
uint32_t permutations;
|
||||
uint8_t types;
|
||||
size_t permutations;
|
||||
|
||||
const uintmax_t *const *defines;
|
||||
const bool *define_mask;
|
||||
|
||||
bool (*filter)(struct lfs_config *cfg, uint32_t perm);
|
||||
void (*run)(struct lfs_config *cfg, uint32_t perm);
|
||||
};
|
||||
|
||||
@@ -16,11 +29,33 @@ struct test_suite {
|
||||
const char *id;
|
||||
const char *name;
|
||||
const char *path;
|
||||
|
||||
const char *const *define_names;
|
||||
size_t define_count;
|
||||
|
||||
const struct test_case *const *cases;
|
||||
size_t case_count;
|
||||
};
|
||||
|
||||
// TODO remove this indirection
|
||||
extern const struct test_suite *test_suites[];
|
||||
extern const size_t test_suite_count;
|
||||
|
||||
|
||||
// access generated test defines
|
||||
uintmax_t test_define(size_t define);
|
||||
|
||||
// a few preconfigured defines that control how tests run
|
||||
#define READ_SIZE test_define(0)
|
||||
#define PROG_SIZE test_define(1)
|
||||
#define BLOCK_SIZE test_define(2)
|
||||
#define BLOCK_COUNT test_define(3)
|
||||
#define BLOCK_CYCLES test_define(4)
|
||||
#define CACHE_SIZE test_define(5)
|
||||
#define LOOKAHEAD_SIZE test_define(6)
|
||||
#define ERASE_VALUE test_define(7)
|
||||
#define ERASE_CYCLES test_define(8)
|
||||
#define BADBLOCK_BEHAVIOR test_define(9)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user