Re: [PATCH v4 1/4] selftests/livepatch: skip the tests on kernels without livepatch
From: Petr Mladek
Date: Mon Nov 23 2026 - 05:15:26 EST
On Tue 2026-11-10 11:10:47, Sasha Levin wrote:
> The test modules can only be built against a kernel configured with
> CONFIG_LIVEPATCH, but the selftests try to build them for any kernel.
>
> KernelCI builds the selftests for many kernel configurations, most of
> which do not enable livepatch. On mainline from November 8, 36 of its
> 69 kselftest builds fail to compile the test modules, for example:
>
> test_klp_callbacks_demo2.c:23:16: error: invalid use of undefined type 'struct klp_object'
>
> These are arm and riscv kernels, which do not support livepatch, and
> x86, arm64, powerpc and loongarch configurations that do not enable it.
>
> Do not build the test modules when the kernel in KDIR was configured
> without CONFIG_LIVEPATCH, and skip the tests when the running kernel has
> no /sys/kernel/livepatch.
>
> Fixes: c4bbe83d27c2 ("livepatch: Move tests from lib/livepatch to selftests/livepatch")
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
Looks reasonable and seems to work:
Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
Tested-by: Petr Mladek <pmladek@xxxxxxxx>
Best Regards,
Petr