Re: [PATCH v4 26/30] selftests/liveupdate: Add multi-kexec session lifecycle test
From: Vipin Sharma <hidden>
Date: 2025-10-09 22:58:00
Also in:
linux-doc, linux-fsdevel, linux-mm, lkml
Subsystem:
kernel selftest framework, live update, the rest · Maintainers:
Shuah Khan, Shuah Khan, Pasha Tatashin, Mike Rapoport, Pratyush Yadav, Linus Torvalds
On 2025-10-03 22:37:10, Pasha Tatashin wrote:
quoted
quoted
quoted
--- a/tools/testing/selftests/liveupdate/Makefile +++ b/tools/testing/selftests/liveupdate/Makefile@@ -1,7 +1,38 @@ # SPDX-License-Identifier: GPL-2.0-only + +KHDR_INCLUDES ?= -I../../../usr/includeIf make is run from the tools/testing/selftests/liveupdate directory, this will not work because it needs one more "..".
This causes a build issue, see my response at the bottom.
quoted
quoted
If this is built using selftest Makefile from root directory make -C tools/testing/selftests TARGETS=liveupdate there will not be build errors because tools/testing/selftests/Makefile defines KHDR_INCLUDES, so above definition will never happen.
If one is just building test using the above make command (without install) we don't see other liveupdate test binaries.
quoted
quoted
quoted
+# --- Test Configuration (Edit this section when adding new tests) --- +LUO_SHARED_SRCS := luo_test_utils.c +LUO_SHARED_HDRS += luo_test_utils.h + +LUO_MANUAL_TESTS += luo_multi_kexec + +TEST_FILES += do_kexec.sh TEST_GEN_PROGS += liveupdate +# --- Automatic Rule Generation (Do not edit below) --- + +TEST_GEN_PROGS_EXTENDED += $(LUO_MANUAL_TESTS) + +# Define the full list of sources for each manual test. +$(foreach test,$(LUO_MANUAL_TESTS), \ + $(eval $(test)_SOURCES := $(test).c $(LUO_SHARED_SRCS))) + +# This loop automatically generates an explicit build rule for each manual test. +# It includes dependencies on the shared headers and makes the output +# executable. +# Note the use of '$$' to escape automatic variables for the 'eval' command. +$(foreach test,$(LUO_MANUAL_TESTS), \ + $(eval $(OUTPUT)/$(test): $($(test)_SOURCES) $(LUO_SHARED_HDRS) \ + $(call msg,LINK,,$$@) ; \ + $(Q)$(LINK.c) $$^ $(LDLIBS) -o $$@ ; \ + $(Q)chmod +x $$@ \ + ) \ +) + include ../lib.mkmake is not building LUO_MANUAL_TESTS, it is only building liveupdate. How to build them?I am building them out of tree: make O=x86_64 -s -C tools/testing/selftests TARGETS=liveupdate install make O=x86_64 -s -C tools/testing/selftests TARGETS=kho installActually, I just tested in-tree and everything works for me, could you please verify: make mrproper # Clean the tree cat tools/testing/selftests/liveupdate/config > .config # Copy LUO depends. make olddefconfig # make a def config with LUO make kvm_guest.config # Build minimal KVM guest with LUO make headers # Make uAPI headers make -C tools/testing/selftests TARGETS=liveupdate install # make and install liveupdate selftests
Yes, this one builds the tests.
However, if instead of using the above make command, we do
cd tools/testing/selftests/liveupdate
make
This will error out
LINK liveupdate
liveupdate.c:19:10: fatal error: linux/liveupdate.h: No such file or directory
19 | #include <linux/liveupdate.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from luo_test_utils.c:21:
luo_test_utils.h:13:10: fatal error: linux/liveupdate.h: No such file or directory
13 | #include <linux/liveupdate.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from <command-line>:
/usr/include/stdc-predef.h:1: fatal error: cannot create precompiled header /liveupdate: Permission denied
1 | /* Copyright (C) 1991-2025 Free Software Foundation, Inc.
compilation terminated.
make: *** [Makefile:30: /liveupdate] Error 1
Reason for this build error is KHDR_INCLUDES in the selftest/liveupdate/Makefile
Following fix resolves this above two "No such file or directory" error.
diff --git a/tools/testing/selftests/liveupdate/Makefile b/tools/testing/selftests/liveupdate/Makefile
index 25a6dec790bb..6507682addac 100644
--- a/tools/testing/selftests/liveupdate/Makefile
+++ b/tools/testing/selftests/liveupdate/Makefile@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only -KHDR_INCLUDES ?= -I../../../usr/include +KHDR_INCLUDES ?= -I../../../../usr/include CFLAGS += -Wall -O2 -Wno-unused-function CFLAGS += $(KHDR_INCLUDES) LDFLAGS += -static
My git diff in the first response fixes build issue and generate tests. https://lore.kernel.org/linux-mm/20251003225120.GA2035091.vipinsh@google.com/ (local) I am used to kvm and vfio selftests. They both build all their binaries by running 'make' from their directories. That's why I found it odd that liveupdate is behaving differently.