[LTP] [PATCH] lib: tst_kconfig: Add runtime checks
Cyril Hrubis
chrubis@suse.cz
Fri Mar 27 12:06:47 CET 2026
Hi!
> It would be great to have a description for the feature:
>
> Something maybe like:
>
> "Currently, LTP Kconfig parsing logic only checks if a feature was
> enabled during kernel compilation (e.g., CONFIG_USER_NS=y). However,
> some kernel features can be compiled in but disabled at runtime via
> kernel command-line parameter or sysctls. When this happens, tests
> relying on these Kconfig variables attempt to run and fail, rather
> than being gracefully skipped.
>
> This patch introduces a runtime check mechanism for Kconfig variables.
> When a monitored CONFIG_* variable is parsed as 'y' or 'm', the framework
> now executes an associated runtime check function. If the runtime check
> fails, the framework logs an info message and internally overrides the
> variable's state to 'n'. This allows the existing LTP dependency logic
> to properly skip tests that require the disabled feature."
Ah, sorry I've fixed the code but kept the description single line, I
will fix that.
> Also, add test_kconfig04.c in newlib_tests/ to verify this works?
I've added a new config variable to newlib_tests/test_kconfig.c (it does
not show in the output unless you boot with namespaces disabled).
If you do and run it:
$ ./test_kconfig
tst_kconfig.c:90: TINFO: Parsing kernel config '/lib/modules/6.16.0/build/.config'
tst_kconfig.c:138: TINFO: CONFIG_USER_NS=y present but disabled at runtime
...
tst_kconfig.c:566: TINFO: Constraint 'CONFIG_USER_NS' not satisfied!
tst_kconfig.c:512: TINFO: Variables:
tst_kconfig.c:530: TINFO: CONFIG_USER_NS=n
tst_test.c:1461: TCONF: Aborting due to unsuitable kernel config, see above!
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list