Re: [PATCH v7 17/22] selftests/liveupdate: Add kexec-based selftest for
From: Mike Rapoport
Date: Mon Nov 24 2025 - 00:30:13 EST
On Sat, Nov 22, 2025 at 05:23:44PM -0500, Pasha Tatashin wrote:
> Subject: selftests/liveupdate: Add kexec-based selftest for
^ for what? ;-)
> Introduce a kexec-based selftest, luo_kexec_simple, to validate the
> end-to-end lifecycle of a Live Update Orchestrator (LUO) session across
> a reboot.
>
> While existing tests verify the uAPI in a pre-reboot context, this test
> ensures that the core functionality—preserving state via Kexec Handover
> and restoring it in a new kernel—works as expected.
>
> The test operates in two stages, managing its state across the reboot by
> preserving a dedicated "state session" containing a memfd. This
> mechanism dogfoods the LUO feature itself for state tracking, making the
> test self-contained.
>
> The test validates the following sequence:
>
> Stage 1 (Pre-kexec):
> - Creates a test session (test-session).
> - Creates and preserves a memfd with a known data pattern into the test
> session.
> - Creates the state-tracking session to signal progression to Stage 2.
> - Executes a kexec reboot via a helper script.
>
> Stage 2 (Post-kexec):
> - Retrieves the state-tracking session to confirm it is in the
> post-reboot stage.
> - Retrieves the preserved test session.
> - Restores the memfd from the test session and verifies its contents
> match the original data pattern written in Stage 1.
> - Finalizes both the test and state sessions to ensure a clean
> teardown.
>
> The test relies on a helper script (do_kexec.sh) to perform the reboot
> and a shared utility library (luo_test_utils.c) for common LUO
> operations, keeping the main test logic clean and focused.
>
> Signed-off-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
> Reviewed-by: Zhu Yanjun <yanjun.zhu@xxxxxxxxx>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> ---
> tools/testing/selftests/liveupdate/Makefile | 6 +
> .../testing/selftests/liveupdate/do_kexec.sh | 16 ++
> .../selftests/liveupdate/luo_kexec_simple.c | 89 ++++++
> .../selftests/liveupdate/luo_test_utils.c | 266 ++++++++++++++++++
> .../selftests/liveupdate/luo_test_utils.h | 44 +++
> 5 files changed, 421 insertions(+)
> create mode 100755 tools/testing/selftests/liveupdate/do_kexec.sh
> create mode 100644 tools/testing/selftests/liveupdate/luo_kexec_simple.c
> create mode 100644 tools/testing/selftests/liveupdate/luo_test_utils.c
> create mode 100644 tools/testing/selftests/liveupdate/luo_test_utils.h
--
Sincerely yours,
Mike.