Changed rbyd testing to ignore block_size, now testing with all geometries

This turned out to be a bit tricky, and the scheme in bench_rbyd is
broken.

The core issue is that we don't have a distinction between physical and
logical block sizes, so we can't use a block device configured for one
geometry with a littlefs instance operating on a different geometry. For
this and other reasons we should probably have two configuration
variables in the future, but at the moment that is out of scope.

The problem with the approach in bench_rbyd, which changes the
lfs_config at runtime, is that this breaks emubd which also depends on
lfs_config due to a leaky abstraction. This causes unnoticed memory
corruption.

---

To get something working, the tests now change the underlying BLOCK_SIZE
test define before the tests are run. This starts the test with a block
device configured with a large block_size. To keep this from breaking
things the geometry definitions in the test and bench runners no longer
use default dependent definitions, instead defining everything
explicitly.

With block_size being so large, this makes some of the emubd operations
less performant, notably the --disk option for exposing block device
state during testing.

It would also be nice to use the copy-on-write backend of emubd for some
of the permutation testing, but since it operates on a block-by-block
basis, it doesn't really work when the block device is just one big
block.
This commit is contained in:
Christopher Haster
2023-02-10 18:51:44 -06:00
parent 34168d7874
commit f7dbaf7707
5 changed files with 228 additions and 138 deletions
+16 -20
View File
@@ -1235,12 +1235,16 @@ static void list_implicit_defines(void) {
// geometries to bench
const bench_geometry_t builtin_geometries[] = {
{"default", {{0}, BENCH_CONST(16), BENCH_CONST(512), {0}}},
{"eeprom", {{0}, BENCH_CONST(1), BENCH_CONST(512), {0}}},
{"emmc", {{0}, {0}, BENCH_CONST(512), {0}}},
{"nor", {{0}, BENCH_CONST(1), BENCH_CONST(4096), {0}}},
{"nand", {{0}, BENCH_CONST(4096), BENCH_CONST(32768), {0}}},
{NULL, {{0}, {0}, {0}, {0}}},
#define BENCH_GEO(name, read_size, prog_size, block_size) \
{name, { \
BENCH_CONST(read_size), \
BENCH_CONST(prog_size), \
BENCH_CONST(block_size), \
}},
BENCH_GEOMETRIES
#undef BENCH_GEO
{NULL, {{0}, {0}, {0}}},
};
const bench_geometry_t *bench_geometries = builtin_geometries;
@@ -1273,7 +1277,7 @@ static void list_geometries(void) {
PROG_SIZE,
BLOCK_SIZE,
BLOCK_COUNT,
BLOCK_SIZE*BLOCK_COUNT);
DISK_SIZE);
}
}
@@ -1731,13 +1735,13 @@ invalid_define:
}
}
// comma-separated read/prog/erase/count
// comma-separated read/prog/erase
if (*optarg == '{') {
lfs_size_t sizes[4];
lfs_size_t sizes[3];
size_t count = 0;
char *s = optarg + 1;
while (count < 4) {
while (count < 3) {
char *parsed = NULL;
sizes[count] = strtoumax(s, &parsed, 0);
count += 1;
@@ -1772,24 +1776,20 @@ invalid_define:
geometry->defines[BLOCK_SIZE_i]
= BENCH_LIT(sizes[0]);
}
if (count >= 4) {
geometry->defines[BLOCK_COUNT_i]
= BENCH_LIT(sizes[3]);
}
optarg = s;
goto geometry_next;
}
// leb16-encoded read/prog/erase/count
if (*optarg == ':') {
lfs_size_t sizes[4];
lfs_size_t sizes[3];
size_t count = 0;
char *s = optarg + 1;
while (true) {
char *parsed = NULL;
uintmax_t x = leb16_parse(s, &parsed);
if (parsed == s || count >= 4) {
if (parsed == s || count >= 3) {
break;
}
@@ -1816,10 +1816,6 @@ invalid_define:
geometry->defines[BLOCK_SIZE_i]
= BENCH_LIT(sizes[0]);
}
if (count >= 4) {
geometry->defines[BLOCK_COUNT_i]
= BENCH_LIT(sizes[3]);
}
optarg = s;
goto geometry_next;
}