Big rename! Renamed lfs -> lfs3 and lfsr -> lfs3

This commit is contained in:
Christopher Haster
2025-05-28 15:00:04 -05:00
parent 3413f125d8
commit 6eba1180c8
50 changed files with 52278 additions and 52111 deletions
+25 -25
View File
@@ -9,7 +9,7 @@
#endif
#include "runners/bench_runner.h"
#include "bd/lfs_emubd.h"
#include "bd/lfs3_emubd.h"
#include <getopt.h>
#include <sys/types.h>
@@ -439,9 +439,9 @@ FILE *bench_trace_file = NULL;
uint32_t bench_trace_cycles = 0;
uint64_t bench_trace_time = 0;
uint64_t bench_trace_open_time = 0;
lfs_emubd_sleep_t bench_read_sleep = 0.0;
lfs_emubd_sleep_t bench_prog_sleep = 0.0;
lfs_emubd_sleep_t bench_erase_sleep = 0.0;
lfs3_emubd_sleep_t bench_read_sleep = 0.0;
lfs3_emubd_sleep_t bench_prog_sleep = 0.0;
lfs3_emubd_sleep_t bench_erase_sleep = 0.0;
// this determines both the backtrace buffer and the trace printf buffer, if
// trace ends up interleaved or truncated this may need to be increased
@@ -607,17 +607,17 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size) {
typedef struct bench_record {
const char *m;
uintmax_t n;
lfs_emubd_io_t last_readed;
lfs_emubd_io_t last_proged;
lfs_emubd_io_t last_erased;
lfs3_emubd_io_t last_readed;
lfs3_emubd_io_t last_proged;
lfs3_emubd_io_t last_erased;
} bench_record_t;
static struct lfs_config *bench_cfg = NULL;
static struct lfs3_config *bench_cfg = NULL;
static bench_record_t *bench_records;
size_t bench_record_count;
size_t bench_record_capacity;
void bench_reset(struct lfs_config *cfg) {
void bench_reset(struct lfs3_config *cfg) {
bench_cfg = cfg;
bench_record_count = 0;
}
@@ -625,11 +625,11 @@ void bench_reset(struct lfs_config *cfg) {
void bench_start(const char *m, uintmax_t n) {
// measure current read/prog/erase
assert(bench_cfg);
lfs_emubd_sio_t readed = lfs_emubd_readed(bench_cfg);
lfs3_emubd_sio_t readed = lfs3_emubd_readed(bench_cfg);
assert(readed >= 0);
lfs_emubd_sio_t proged = lfs_emubd_proged(bench_cfg);
lfs3_emubd_sio_t proged = lfs3_emubd_proged(bench_cfg);
assert(proged >= 0);
lfs_emubd_sio_t erased = lfs_emubd_erased(bench_cfg);
lfs3_emubd_sio_t erased = lfs3_emubd_erased(bench_cfg);
assert(erased >= 0);
// allocate a new record
@@ -648,11 +648,11 @@ void bench_start(const char *m, uintmax_t n) {
void bench_stop(const char *m) {
// measure current read/prog/erase
assert(bench_cfg);
lfs_emubd_sio_t readed = lfs_emubd_readed(bench_cfg);
lfs3_emubd_sio_t readed = lfs3_emubd_readed(bench_cfg);
assert(readed >= 0);
lfs_emubd_sio_t proged = lfs_emubd_proged(bench_cfg);
lfs3_emubd_sio_t proged = lfs3_emubd_proged(bench_cfg);
assert(proged >= 0);
lfs_emubd_sio_t erased = lfs_emubd_erased(bench_cfg);
lfs3_emubd_sio_t erased = lfs3_emubd_erased(bench_cfg);
assert(erased >= 0);
// find our record
@@ -1335,18 +1335,18 @@ void perm_run(
}
// create block device and configuration
lfs_emubd_t bd;
lfs3_emubd_t bd;
struct lfs_config cfg = {
struct lfs3_config cfg = {
.context = &bd,
.read = lfs_emubd_read,
.prog = lfs_emubd_prog,
.erase = lfs_emubd_erase,
.sync = lfs_emubd_sync,
.read = lfs3_emubd_read,
.prog = lfs3_emubd_prog,
.erase = lfs3_emubd_erase,
.sync = lfs3_emubd_sync,
BENCH_CFG
};
struct lfs_emubd_config bdcfg = {
struct lfs3_emubd_config bdcfg = {
.disk_path = bench_disk_path,
.read_sleep = bench_read_sleep,
.prog_sleep = bench_prog_sleep,
@@ -1354,7 +1354,7 @@ void perm_run(
BENCH_BDCFG
};
int err = lfs_emubd_createcfg(&cfg, bench_disk_path, &bdcfg);
int err = lfs3_emubd_createcfg(&cfg, bench_disk_path, &bdcfg);
if (err) {
fprintf(stderr, "error: could not create block device: %d\n", err);
exit(-1);
@@ -1373,7 +1373,7 @@ void perm_run(
printf("\n");
// cleanup
err = lfs_emubd_destroy(&cfg);
err = lfs3_emubd_destroy(&cfg);
if (err) {
fprintf(stderr, "error: could not destroy block device: %d\n", err);
exit(-1);
@@ -1920,7 +1920,7 @@ getopt_done: ;
if (d >= define_count) {
// align to power of two to avoid any superlinear growth
size_t ncount = 1 << lfs_nlog2(d+1);
size_t ncount = 1 << lfs3_nlog2(d+1);
defines = realloc(defines,
ncount*sizeof(bench_define_t));
memset(defines+define_count, 0,
+13 -13
View File
@@ -8,16 +8,16 @@
#define BENCH_RUNNER_H
// override LFS_TRACE
// override LFS3_TRACE
void bench_trace(const char *fmt, ...);
#define LFS_TRACE_(fmt, ...) \
#define LFS3_TRACE_(fmt, ...) \
bench_trace("%s:%d:trace: " fmt "%s\n", \
__FILE__, \
__LINE__, \
__VA_ARGS__)
#define LFS_TRACE(...) LFS_TRACE_(__VA_ARGS__, "")
#define LFS_EMUBD_TRACE(...) LFS_TRACE_(__VA_ARGS__, "")
#define LFS3_TRACE(...) LFS3_TRACE_(__VA_ARGS__, "")
#define LFS3_EMUBD_TRACE(...) LFS3_TRACE_(__VA_ARGS__, "")
// BENCH_START/BENCH_STOP macros measure readed/proged/erased bytes
// through emubd
@@ -36,7 +36,7 @@ void bench_fresult(const char *m, uintmax_t n, double result);
// note these are indirectly included in any generated files
#include "bd/lfs_emubd.h"
#include "bd/lfs3_emubd.h"
#include <stdio.h>
// give source a chance to define feature macros
@@ -45,7 +45,7 @@ void bench_fresult(const char *m, uintmax_t n, double result);
// generated bench configurations
struct lfs_config;
struct lfs3_config;
enum bench_flags {
BENCH_INTERNAL = 0x1,
@@ -69,7 +69,7 @@ struct bench_case {
size_t permutations;
bool (*if_)(void);
void (*run)(struct lfs_config *cfg);
void (*run)(struct lfs3_config *cfg);
};
struct bench_suite {
@@ -110,21 +110,21 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
BENCH_DEFINE(BLOCK_COUNT, DISK_SIZE/BLOCK_SIZE ) \
BENCH_DEFINE(DISK_SIZE, 1024*1024 ) \
BENCH_DEFINE(BLOCK_RECYCLES, -1 ) \
BENCH_DEFINE(RCACHE_SIZE, LFS_MAX(16, READ_SIZE) ) \
BENCH_DEFINE(PCACHE_SIZE, LFS_MAX(16, PROG_SIZE) ) \
BENCH_DEFINE(RCACHE_SIZE, LFS3_MAX(16, READ_SIZE) ) \
BENCH_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
BENCH_DEFINE(FILE_CACHE_SIZE, 16 ) \
BENCH_DEFINE(LOOKAHEAD_SIZE, 16 ) \
BENCH_DEFINE(GC_FLAGS, 0 ) \
BENCH_DEFINE(GC_STEPS, 0 ) \
BENCH_DEFINE(GC_COMPACT_THRESH, 0 ) \
BENCH_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
BENCH_DEFINE(FRAGMENT_SIZE, LFS_MIN(BLOCK_SIZE/8, 512) ) \
BENCH_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
BENCH_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
BENCH_DEFINE(FRAGMENT_THRESH, -1 ) \
BENCH_DEFINE(ERASE_VALUE, 0xff ) \
BENCH_DEFINE(ERASE_CYCLES, 0 ) \
BENCH_DEFINE(BADBLOCK_BEHAVIOR, LFS_EMUBD_BADBLOCK_PROGERROR ) \
BENCH_DEFINE(POWERLOSS_BEHAVIOR, LFS_EMUBD_POWERLOSS_ATOMIC ) \
BENCH_DEFINE(BADBLOCK_BEHAVIOR, LFS3_EMUBD_BADBLOCK_PROGERROR ) \
BENCH_DEFINE(POWERLOSS_BEHAVIOR, LFS3_EMUBD_POWERLOSS_ATOMIC ) \
BENCH_DEFINE(EMUBD_SEED, 0 )
// declare defines as global intmax_ts
@@ -152,7 +152,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
.crystal_thresh = CRYSTAL_THRESH, \
.fragment_thresh = FRAGMENT_THRESH,
#ifdef LFS_GC
#ifdef LFS3_GC
#define BENCH_GC_CFG \
.gc_flags = GC_FLAGS, \
.gc_steps = GC_STEPS,
+76 -76
View File
@@ -9,7 +9,7 @@
#endif
#include "runners/test_runner.h"
#include "bd/lfs_emubd.h"
#include "bd/lfs3_emubd.h"
#include <getopt.h>
#include <sys/types.h>
@@ -117,7 +117,7 @@ typedef struct test_powerloss {
const struct test_powerloss *powerloss,
const struct test_suite *suite,
const struct test_case *case_);
const lfs_emubd_powercycles_t *cycles;
const lfs3_emubd_powercycles_t *cycles;
size_t cycle_count;
} test_powerloss_t;
@@ -450,9 +450,9 @@ FILE *test_trace_file = NULL;
uint32_t test_trace_cycles = 0;
uint64_t test_trace_time = 0;
uint64_t test_trace_open_time = 0;
lfs_emubd_sleep_t test_read_sleep = 0.0;
lfs_emubd_sleep_t test_prog_sleep = 0.0;
lfs_emubd_sleep_t test_erase_sleep = 0.0;
lfs3_emubd_sleep_t test_read_sleep = 0.0;
lfs3_emubd_sleep_t test_prog_sleep = 0.0;
lfs3_emubd_sleep_t test_erase_sleep = 0.0;
volatile size_t TEST_PLS = 0;
@@ -623,7 +623,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size) {
static void perm_printid(
const struct test_suite *suite,
const struct test_case *case_,
const lfs_emubd_powercycles_t *cycles,
const lfs3_emubd_powercycles_t *cycles,
size_t cycle_count) {
(void)suite;
// case[:permutation[:powercycles]]
@@ -1299,18 +1299,18 @@ static void run_powerloss_none(
(void)powerloss;
// create block device and configuration
lfs_emubd_t bd;
lfs3_emubd_t bd;
struct lfs_config cfg = {
struct lfs3_config cfg = {
.context = &bd,
.read = lfs_emubd_read,
.prog = lfs_emubd_prog,
.erase = lfs_emubd_erase,
.sync = lfs_emubd_sync,
.read = lfs3_emubd_read,
.prog = lfs3_emubd_prog,
.erase = lfs3_emubd_erase,
.sync = lfs3_emubd_sync,
TEST_CFG
};
struct lfs_emubd_config bdcfg = {
struct lfs3_emubd_config bdcfg = {
.disk_path = test_disk_path,
.read_sleep = test_read_sleep,
.prog_sleep = test_prog_sleep,
@@ -1318,7 +1318,7 @@ static void run_powerloss_none(
TEST_BDCFG
};
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
int err = lfs3_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
if (err) {
fprintf(stderr, "error: could not create block device: %d\n", err);
exit(-1);
@@ -1339,7 +1339,7 @@ static void run_powerloss_none(
printf("\n");
// cleanup
err = lfs_emubd_destroy(&cfg);
err = lfs3_emubd_destroy(&cfg);
if (err) {
fprintf(stderr, "error: could not destroy block device: %d\n", err);
exit(-1);
@@ -1359,19 +1359,19 @@ static void run_powerloss_linear(
TEST_PLS = 0;
// create block device and configuration
lfs_emubd_t bd;
lfs3_emubd_t bd;
jmp_buf powerloss_jmp;
struct lfs_config cfg = {
struct lfs3_config cfg = {
.context = &bd,
.read = lfs_emubd_read,
.prog = lfs_emubd_prog,
.erase = lfs_emubd_erase,
.sync = lfs_emubd_sync,
.read = lfs3_emubd_read,
.prog = lfs3_emubd_prog,
.erase = lfs3_emubd_erase,
.sync = lfs3_emubd_sync,
TEST_CFG
};
struct lfs_emubd_config bdcfg = {
struct lfs3_emubd_config bdcfg = {
.disk_path = test_disk_path,
.read_sleep = test_read_sleep,
.prog_sleep = test_prog_sleep,
@@ -1384,7 +1384,7 @@ static void run_powerloss_linear(
TEST_BDCFG
};
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
int err = lfs3_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
if (err) {
fprintf(stderr, "error: could not create block device: %d\n", err);
exit(-1);
@@ -1411,7 +1411,7 @@ static void run_powerloss_linear(
// increment pls
TEST_PLS += 1;
lfs_emubd_setpowercycles(&cfg, (TEST_PLS < powerloss->cycle_count)
lfs3_emubd_setpowercycles(&cfg, (TEST_PLS < powerloss->cycle_count)
? TEST_PLS+1
: 0);
}
@@ -1421,7 +1421,7 @@ static void run_powerloss_linear(
printf("\n");
// cleanup
err = lfs_emubd_destroy(&cfg);
err = lfs3_emubd_destroy(&cfg);
if (err) {
fprintf(stderr, "error: could not destroy block device: %d\n", err);
exit(-1);
@@ -1436,19 +1436,19 @@ static void run_powerloss_log(
TEST_PLS = 0;
// create block device and configuration
lfs_emubd_t bd;
lfs3_emubd_t bd;
jmp_buf powerloss_jmp;
struct lfs_config cfg = {
struct lfs3_config cfg = {
.context = &bd,
.read = lfs_emubd_read,
.prog = lfs_emubd_prog,
.erase = lfs_emubd_erase,
.sync = lfs_emubd_sync,
.read = lfs3_emubd_read,
.prog = lfs3_emubd_prog,
.erase = lfs3_emubd_erase,
.sync = lfs3_emubd_sync,
TEST_CFG
};
struct lfs_emubd_config bdcfg = {
struct lfs3_emubd_config bdcfg = {
.disk_path = test_disk_path,
.read_sleep = test_read_sleep,
.prog_sleep = test_prog_sleep,
@@ -1461,7 +1461,7 @@ static void run_powerloss_log(
TEST_BDCFG
};
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
int err = lfs3_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
if (err) {
fprintf(stderr, "error: could not create block device: %d\n", err);
exit(-1);
@@ -1488,7 +1488,7 @@ static void run_powerloss_log(
// increment pls
TEST_PLS += 1;
lfs_emubd_setpowercycles(&cfg, (TEST_PLS < powerloss->cycle_count)
lfs3_emubd_setpowercycles(&cfg, (TEST_PLS < powerloss->cycle_count)
? 1 << TEST_PLS
: 0);
}
@@ -1498,7 +1498,7 @@ static void run_powerloss_log(
printf("\n");
// cleanup
err = lfs_emubd_destroy(&cfg);
err = lfs3_emubd_destroy(&cfg);
if (err) {
fprintf(stderr, "error: could not destroy block device: %d\n", err);
exit(-1);
@@ -1513,19 +1513,19 @@ static void run_powerloss_cycles(
TEST_PLS = 0;
// create block device and configuration
lfs_emubd_t bd;
lfs3_emubd_t bd;
jmp_buf powerloss_jmp;
struct lfs_config cfg = {
struct lfs3_config cfg = {
.context = &bd,
.read = lfs_emubd_read,
.prog = lfs_emubd_prog,
.erase = lfs_emubd_erase,
.sync = lfs_emubd_sync,
.read = lfs3_emubd_read,
.prog = lfs3_emubd_prog,
.erase = lfs3_emubd_erase,
.sync = lfs3_emubd_sync,
TEST_CFG
};
struct lfs_emubd_config bdcfg = {
struct lfs3_emubd_config bdcfg = {
.disk_path = test_disk_path,
.read_sleep = test_read_sleep,
.prog_sleep = test_prog_sleep,
@@ -1538,7 +1538,7 @@ static void run_powerloss_cycles(
TEST_BDCFG
};
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
int err = lfs3_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
if (err) {
fprintf(stderr, "error: could not create block device: %d\n", err);
exit(-1);
@@ -1564,7 +1564,7 @@ static void run_powerloss_cycles(
// increment pls
TEST_PLS += 1;
lfs_emubd_setpowercycles(&cfg, (TEST_PLS < powerloss->cycle_count)
lfs3_emubd_setpowercycles(&cfg, (TEST_PLS < powerloss->cycle_count)
? powerloss->cycles[TEST_PLS]
: 0);
}
@@ -1574,7 +1574,7 @@ static void run_powerloss_cycles(
printf("\n");
// cleanup
err = lfs_emubd_destroy(&cfg);
err = lfs3_emubd_destroy(&cfg);
if (err) {
fprintf(stderr, "error: could not destroy block device: %d\n", err);
exit(-1);
@@ -1582,15 +1582,15 @@ static void run_powerloss_cycles(
}
struct powerloss_exhaustive_state {
struct lfs_config *cfg;
struct lfs3_config *cfg;
lfs_emubd_t *branches;
lfs3_emubd_t *branches;
size_t branch_count;
size_t branch_capacity;
};
struct powerloss_exhaustive_cycles {
lfs_emubd_powercycles_t *cycles;
lfs3_emubd_powercycles_t *cycles;
size_t cycle_count;
size_t cycle_capacity;
};
@@ -1598,9 +1598,9 @@ struct powerloss_exhaustive_cycles {
static void powerloss_exhaustive_branch(void *c) {
struct powerloss_exhaustive_state *state = c;
// append to branches
lfs_emubd_t *branch = mappend(
lfs3_emubd_t *branch = mappend(
(void**)&state->branches,
sizeof(lfs_emubd_t),
sizeof(lfs3_emubd_t),
&state->branch_count,
&state->branch_capacity);
if (!branch) {
@@ -1609,22 +1609,22 @@ static void powerloss_exhaustive_branch(void *c) {
}
// create copy-on-write copy
int err = lfs_emubd_cpy(state->cfg, branch);
int err = lfs3_emubd_cpy(state->cfg, branch);
if (err) {
fprintf(stderr, "error: exhaustive: could not create bd copy\n");
exit(-1);
}
// also trigger on next power cycle
lfs_emubd_setpowercycles(state->cfg, 1);
lfs3_emubd_setpowercycles(state->cfg, 1);
}
static void run_powerloss_exhaustive_layer(
struct powerloss_exhaustive_cycles *cycles,
const struct test_suite *suite,
const struct test_case *case_,
struct lfs_config *cfg,
struct lfs_emubd_config *bdcfg,
struct lfs3_config *cfg,
struct lfs3_emubd_config *bdcfg,
size_t depth,
size_t pls) {
struct powerloss_exhaustive_state state = {
@@ -1639,14 +1639,14 @@ static void run_powerloss_exhaustive_layer(
// run through the test without additional powerlosses, collecting possible
// branches as we do so
lfs_emubd_setpowercycles(state.cfg, (depth > 0) ? 1 : 0);
lfs3_emubd_setpowercycles(state.cfg, (depth > 0) ? 1 : 0);
bdcfg->powerloss_data = &state;
// run the tests
case_->run(cfg);
// aggressively clean up memory here to try to keep our memory usage low
int err = lfs_emubd_destroy(cfg);
int err = lfs3_emubd_destroy(cfg);
if (err) {
fprintf(stderr, "error: could not destroy block device: %d\n", err);
exit(-1);
@@ -1655,9 +1655,9 @@ static void run_powerloss_exhaustive_layer(
// recurse into each branch
for (size_t i = 0; i < state.branch_count; i++) {
// first push and print the branch
lfs_emubd_powercycles_t *cycle = mappend(
lfs3_emubd_powercycles_t *cycle = mappend(
(void**)&cycles->cycles,
sizeof(lfs_emubd_powercycles_t),
sizeof(lfs3_emubd_powercycles_t),
&cycles->cycle_count,
&cycles->cycle_capacity);
if (!cycle) {
@@ -1689,18 +1689,18 @@ static void run_powerloss_exhaustive(
const struct test_suite *suite,
const struct test_case *case_) {
// create block device and configuration
lfs_emubd_t bd;
lfs3_emubd_t bd;
struct lfs_config cfg = {
struct lfs3_config cfg = {
.context = &bd,
.read = lfs_emubd_read,
.prog = lfs_emubd_prog,
.erase = lfs_emubd_erase,
.sync = lfs_emubd_sync,
.read = lfs3_emubd_read,
.prog = lfs3_emubd_prog,
.erase = lfs3_emubd_erase,
.sync = lfs3_emubd_sync,
TEST_CFG
};
struct lfs_emubd_config bdcfg = {
struct lfs3_emubd_config bdcfg = {
.disk_path = test_disk_path,
.read_sleep = test_read_sleep,
.prog_sleep = test_prog_sleep,
@@ -1710,7 +1710,7 @@ static void run_powerloss_exhaustive(
TEST_BDCFG
};
int err = lfs_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
int err = lfs3_emubd_createcfg(&cfg, test_disk_path, &bdcfg);
if (err) {
fprintf(stderr, "error: could not create block device: %d\n", err);
exit(-1);
@@ -2234,16 +2234,16 @@ int main(int argc, char **argv) {
// comma-separated permutation
if (*optarg == '{') {
lfs_emubd_powercycles_t *cycles = NULL;
lfs3_emubd_powercycles_t *cycles = NULL;
size_t cycle_count = 0;
size_t cycle_capacity = 0;
char *s = optarg + 1;
while (true) {
parsed = NULL;
*(lfs_emubd_powercycles_t*)mappend(
*(lfs3_emubd_powercycles_t*)mappend(
(void**)&cycles,
sizeof(lfs_emubd_powercycles_t),
sizeof(lfs3_emubd_powercycles_t),
&cycle_count,
&cycle_capacity)
= strtoumax(s, &parsed, 0);
@@ -2295,7 +2295,7 @@ int main(int argc, char **argv) {
// otherwise explicit power cycles
} else {
lfs_emubd_powercycles_t *cycles = NULL;
lfs3_emubd_powercycles_t *cycles = NULL;
size_t cycle_count = 0;
size_t cycle_capacity = 0;
@@ -2307,9 +2307,9 @@ int main(int argc, char **argv) {
break;
}
*(lfs_emubd_powercycles_t*)mappend(
*(lfs3_emubd_powercycles_t*)mappend(
(void**)&cycles,
sizeof(lfs_emubd_powercycles_t),
sizeof(lfs3_emubd_powercycles_t),
&cycle_count,
&cycle_capacity) = x;
s = parsed;
@@ -2538,7 +2538,7 @@ getopt_done:;
if (d >= define_count) {
// align to power of two to avoid any superlinear growth
size_t ncount = 1 << lfs_nlog2(d+1);
size_t ncount = 1 << lfs3_nlog2(d+1);
defines = realloc(defines,
ncount*sizeof(test_define_t));
memset(defines+define_count, 0,
@@ -2588,14 +2588,14 @@ getopt_done:;
// otherwise explicit power cycles
} else if (cycles_) {
// parse power cycles
lfs_emubd_powercycles_t *cycles = NULL;
lfs3_emubd_powercycles_t *cycles = NULL;
size_t cycle_count = 0;
size_t cycle_capacity = 0;
while (*cycles_ != '\0') {
char *parsed = NULL;
*(lfs_emubd_powercycles_t*)mappend(
*(lfs3_emubd_powercycles_t*)mappend(
(void**)&cycles,
sizeof(lfs_emubd_powercycles_t),
sizeof(lfs3_emubd_powercycles_t),
&cycle_count,
&cycle_capacity)
= leb16_parse(cycles_, &parsed);
+13 -13
View File
@@ -8,20 +8,20 @@
#define TEST_RUNNER_H
// override LFS_TRACE
// override LFS3_TRACE
void test_trace(const char *fmt, ...);
#define LFS_TRACE_(fmt, ...) \
#define LFS3_TRACE_(fmt, ...) \
test_trace("%s:%d:trace: " fmt "%s\n", \
__FILE__, \
__LINE__, \
__VA_ARGS__)
#define LFS_TRACE(...) LFS_TRACE_(__VA_ARGS__, "")
#define LFS_EMUBD_TRACE(...) LFS_TRACE_(__VA_ARGS__, "")
#define LFS3_TRACE(...) LFS3_TRACE_(__VA_ARGS__, "")
#define LFS3_EMUBD_TRACE(...) LFS3_TRACE_(__VA_ARGS__, "")
// note these are indirectly included in any generated files
#include "bd/lfs_emubd.h"
#include "bd/lfs3_emubd.h"
#include <stdio.h>
// give source a chance to define feature macros
@@ -30,7 +30,7 @@ void test_trace(const char *fmt, ...);
// generated test configurations
struct lfs_config;
struct lfs3_config;
enum test_flags {
TEST_INTERNAL = 0x1,
@@ -56,7 +56,7 @@ struct test_case {
size_t permutations;
bool (*if_)(void);
void (*run)(struct lfs_config *cfg);
void (*run)(struct lfs3_config *cfg);
};
struct test_suite {
@@ -101,21 +101,21 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
TEST_DEFINE(BLOCK_COUNT, DISK_SIZE/BLOCK_SIZE ) \
TEST_DEFINE(DISK_SIZE, 1024*1024 ) \
TEST_DEFINE(BLOCK_RECYCLES, -1 ) \
TEST_DEFINE(RCACHE_SIZE, LFS_MAX(16, READ_SIZE) ) \
TEST_DEFINE(PCACHE_SIZE, LFS_MAX(16, PROG_SIZE) ) \
TEST_DEFINE(RCACHE_SIZE, LFS3_MAX(16, READ_SIZE) ) \
TEST_DEFINE(PCACHE_SIZE, LFS3_MAX(16, PROG_SIZE) ) \
TEST_DEFINE(FILE_CACHE_SIZE, 16 ) \
TEST_DEFINE(LOOKAHEAD_SIZE, 16 ) \
TEST_DEFINE(GC_FLAGS, 0 ) \
TEST_DEFINE(GC_STEPS, 0 ) \
TEST_DEFINE(GC_COMPACT_THRESH, 0 ) \
TEST_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
TEST_DEFINE(FRAGMENT_SIZE, LFS_MIN(BLOCK_SIZE/8, 512) ) \
TEST_DEFINE(FRAGMENT_SIZE, LFS3_MIN(BLOCK_SIZE/8, 512) ) \
TEST_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
TEST_DEFINE(FRAGMENT_THRESH, -1 ) \
TEST_DEFINE(ERASE_VALUE, 0xff ) \
TEST_DEFINE(ERASE_CYCLES, 0 ) \
TEST_DEFINE(BADBLOCK_BEHAVIOR, LFS_EMUBD_BADBLOCK_PROGERROR ) \
TEST_DEFINE(POWERLOSS_BEHAVIOR, LFS_EMUBD_POWERLOSS_ATOMIC ) \
TEST_DEFINE(BADBLOCK_BEHAVIOR, LFS3_EMUBD_BADBLOCK_PROGERROR ) \
TEST_DEFINE(POWERLOSS_BEHAVIOR, LFS3_EMUBD_POWERLOSS_ATOMIC ) \
TEST_DEFINE(EMUBD_SEED, 0 )
// declare defines as global intmax_ts
@@ -143,7 +143,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
.crystal_thresh = CRYSTAL_THRESH, \
.fragment_thresh = FRAGMENT_THRESH,
#ifdef LFS_GC
#ifdef LFS3_GC
#define TEST_GC_CFG \
.gc_flags = GC_FLAGS, \
.gc_steps = GC_STEPS,