runners: Reworked test/bench for out-of-tree extensions

The main changes:

- Added TEST_DEFINES and BENCH_DEFINES to allow overriding the default
  test/bench define header:

    -DTEST_DEFINES=my_test_defines.h

  Note these are VERY different from LFS_DEFINES upstream. They aren't a
  typical header file, and are included multiple times with various
  query macros.

  It's hacky, but works surprisingly well.

  Or maybe I'll just do anything to avoid having to write multiline
  macros. Ugh, backslashes.

- Moved more logic into bench/test_defines.h, including everything
  needed to integrate other filesystems out-of-tree.

  This mostly meant moving all of the cfg initialization logic into its
  own query macro (replacing the BENCH/TEST_CFG field macros).

But this also includes a bunch of small tweaks encountered while trying
to get external benchmarks running again.

The external benchmarks include several other filesystems (littlefs2,
SPIFFS, Yaffs2), and I'm hoping this injectable/queryable header thing
will do a good job at avoiding a maintenance headache. (At least a
better job than forking bench_runner.c, which was the previous
solution.)
This commit is contained in:
Christopher Haster
2026-01-30 13:15:04 -06:00
parent 91cbcfd389
commit 4405ad47e4
11 changed files with 409 additions and 310 deletions
+1 -3
View File
@@ -215,12 +215,10 @@ int lfs3_emubd_sync(const struct lfs3_cfg *cfg);
/// Additional emubd features for testing ///
// Get total simulated runtime
// Get simulated runtime in nanoseconds
lfs3_emubd_sns_t lfs3_emubd_simtime(const struct lfs3_cfg *cfg);
// Reset simulation counters
//
// You probably shouldn't call this, instead diff before/after simtimes
int lfs3_emubd_simreset(const struct lfs3_cfg *cfg);
// Get total number of read transactions