Skip to content

selftests/livepatch: build and run the tests outside the running kernel

Sasha Levin linux-kselftest live-patching lkml sashiko-reviews 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v4 Latest4 patches 7 repliesIn review

Changes in v4 from the cover letter

- Split into four patches, rewrote the commit messages and added comments. (Petr)
- Moved the CONFIG_LIVEPATCH check into test_modules/Makefile, which drops the extra clean target (Petr), and read it from include/config/auto.conf.
- Patch 4 still skips when neither the modules nor KDIR are available. (Petr)

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4selftests/livepatch: skip the tests on kernels without livepatchtools/testing/selftests/livepatch/functions.sh tools/testing/selftests/livepatch/test_modules/Makefile+13 -21 reply
2/4selftests/livepatch: clean the test modules without a kernel build directorytools/testing/selftests/livepatch/test_modules/Makefile+7 -42 replies
3/4selftests/livepatch: build the test modules against the kernel in O=tools/testing/selftests/livepatch/Makefile tools/testing/selftests/livepatch/test_modules/Makefile+33 -52 replies
4/4selftests/livepatch: run the tests with prebuilt test modulestools/testing/selftests/livepatch/functions.sh+8 -41 reply

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchPetr Mladek
1/4R-b T-b
2/4
3/4R-b T-b
4/4R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/4] selftests/livepatch: build and run the tests outside the running kernel

The livepatch selftests build their test modules against the running kernel and skip every test without its devel files, so they do not work when built for one kernel and run on another, as CI systems do. In KernelCI, 36 of 69 kselftest builds of mainline fail to compile the modules because the kernel lacks CONFIG_LIVEPATCH, and where the modules do build, the installed tests skip themselves.

- Patch 1 skips the modules and tests when livepatch is not enabled.
- Patch 2 lets "make clean" remove the modules without a kernel build directory.
- Patch 3 builds the modules against the kernel in O= or KBUILD_OUTPUT.
- Patch 4 runs the tests with the installed modules, without the devel files.

Tested on x86_64 against kernels built with O= and in place, a kernel without livepatch and the Debian headers. The modules build and clean in every case, and the installed tests pass 8/8 in a VM without devel files, where they were all skipped before.

Changes since v3:
- Split into four patches, rewrote the commit messages and added comments. (Petr)
- Moved the CONFIG_LIVEPATCH check into test_modules/Makefile, which drops the extra clean target (Petr), and read it from include/config/auto.conf.
- Patch 4 still skips when neither the modules nor KDIR are available. (Petr)

v3: https://lore.kernel.org/all/[email protected]/

Sasha Levin (4):
selftests/livepatch: skip the tests on kernels without livepatch selftests/livepatch: clean the test modules without a kernel build
directory
selftests/livepatch: build the test modules against the kernel in O= selftests/livepatch: run the tests with prebuilt test modules

 tools/testing/selftests/livepatch/Makefile    | 26 +++++++++++++++++
 .../testing/selftests/livepatch/functions.sh  | 13 ++++++---
 .../selftests/livepatch/test_modules/Makefile | 29 ++++++++++++++-----
 3 files changed, 57 insertions(+), 11 deletions(-)

base-commit: b3dfbde62cf1981c4638939c159dfd087b7a72e9

Signature · 1 line
2.53.0