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:
+17
-21
@@ -1276,12 +1276,16 @@ static void list_implicit_defines(void) {
|
||||
// geometries to test
|
||||
|
||||
const test_geometry_t builtin_geometries[] = {
|
||||
{"default", {{0}, TEST_CONST(16), TEST_CONST(512), {0}}},
|
||||
{"eeprom", {{0}, TEST_CONST(1), TEST_CONST(512), {0}}},
|
||||
{"emmc", {{0}, {0}, TEST_CONST(512), {0}}},
|
||||
{"nor", {{0}, TEST_CONST(1), TEST_CONST(4096), {0}}},
|
||||
{"nand", {{0}, TEST_CONST(4096), TEST_CONST(32768), {0}}},
|
||||
{NULL, {{0}, {0}, {0}, {0}}},
|
||||
#define TEST_GEO(name, read_size, prog_size, block_size) \
|
||||
{name, { \
|
||||
TEST_CONST(read_size), \
|
||||
TEST_CONST(prog_size), \
|
||||
TEST_CONST(block_size), \
|
||||
}},
|
||||
|
||||
TEST_GEOMETRIES
|
||||
#undef TEST_GEO
|
||||
{NULL, {{0}, {0}, {0}}},
|
||||
};
|
||||
|
||||
const test_geometry_t *test_geometries = builtin_geometries;
|
||||
@@ -1314,7 +1318,7 @@ static void list_geometries(void) {
|
||||
PROG_SIZE,
|
||||
BLOCK_SIZE,
|
||||
BLOCK_COUNT,
|
||||
BLOCK_SIZE*BLOCK_COUNT);
|
||||
DISK_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2188,7 +2192,7 @@ int main(int argc, char **argv) {
|
||||
stop = start;
|
||||
start = 0;
|
||||
}
|
||||
|
||||
|
||||
if (*optarg != ')') {
|
||||
goto invalid_define;
|
||||
}
|
||||
@@ -2269,13 +2273,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;
|
||||
@@ -2310,24 +2314,20 @@ invalid_define:
|
||||
geometry->defines[BLOCK_SIZE_i]
|
||||
= TEST_LIT(sizes[0]);
|
||||
}
|
||||
if (count >= 4) {
|
||||
geometry->defines[BLOCK_COUNT_i]
|
||||
= TEST_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;
|
||||
}
|
||||
|
||||
@@ -2354,10 +2354,6 @@ invalid_define:
|
||||
geometry->defines[BLOCK_SIZE_i]
|
||||
= TEST_LIT(sizes[0]);
|
||||
}
|
||||
if (count >= 4) {
|
||||
geometry->defines[BLOCK_COUNT_i]
|
||||
= TEST_LIT(sizes[3]);
|
||||
}
|
||||
optarg = s;
|
||||
goto geometry_next;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user