nuttx-apps/testing/fs/xipfs/Kconfig
Marco Casaroli 20dc5e5167 testing/fs/xipfs: Cover the FDPIC module loader.
Adds two sections to the xipfs suite, guarded by CONFIG_FDPIC so a build
without the loader is unaffected.  They belong here rather than in their own
test because what they exercise is modules loaded *out of the filesystem* --
the pin, the in-place mapping and the loader are one path.

'fdpic' asserts on the loader properties that otherwise fail *quietly*: a
loader that skips DT_INIT_ARRAY runs a C++ module happily with every global
left zero, one that skips DT_JMPREL loads a module that hard-faults only
once it calls out, and one that mis-sizes the descriptor pool corrupts the
heap.  None of those announce themselves.  The module exit status is the
channel -- each module checks its own invariants and reports a bitmask.  It
also covers shared libraries across concurrent instances, per-instance data,
the leaf-library GOT fallback, the R_ARM_FUNCDESC descriptor pool, and every
firmware entry point that has to resolve a module callback, including
mq_notify and timer_create with SIGEV_THREAD.

'reject' mutates a known-good module byte by byte and asserts the loader
refuses it rather than loading something broken: a missing import, and more
DT_NEEDED entries than the walk will follow.

The modules are embedded as headers, for the same reason as in
examples/fdpicxip, and built for cortex-m3 for the same reason: one set of
blobs then runs on both the v7-M and v8-M targets.  Their sources and the
makefile that regenerates these headers live in
apps/examples/fdpicxip/modules, so the copies the two apps carry are built
from the same sources in the same way.

Verified on a Pimoroni Pico Plus 2: fdpic 33/33, reject 7/7, and the whole
suite 130/130 with them included.  The same three numbers on mps2-an500 under
QEMU, which is a Cortex-M7 rather than the RP2350's Cortex-M33.

Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-07-31 18:47:17 -03:00

45 lines
1.5 KiB
Text

#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config TESTING_FS_XIPFS
tristate "XIPFS file system test"
depends on FS_XIPFS
default n
---help---
Exercise the XIPFS filesystem: the routine VFS paths, the
write-once rules, the in-place mmap and its strict variant, and
then the corners that actually carry risk -- power loss atomicity
of the metadata commit, and release of XIP pins when a task dies
without unmapping.
With CONFIG_FDPIC it also loads modules out of the filesystem and
checks the loader properties that otherwise fail silently: global
constructors running in dependency order, per-instance data, and
the relocation paths nothing else reaches.
Takes an optional section name to run just one part, since the
power loss sweeps take minutes and everything else takes seconds:
xipfs_test everything
xipfs_test xip just the execute-in-place mapping tests
xipfs_test fdpic just the module loading tests
Sections: basic writeonce strict xip multimap crosstask teardown
fdpic reject dirs defrag powerloss powertorn unlink dirloss
defraglos
The power loss sections need CONFIG_FS_XIPFS_FAULT_INJECT.
if TESTING_FS_XIPFS
config TESTING_FS_XIPFS_MOUNTPT
string "XIPFS mountpoint"
default "/mnt/xipfs"
config TESTING_FS_XIPFS_MTD
string "MTD device backing the filesystem"
default "/dev/rammtd"
endif # TESTING_FS_XIPFS