From nobody Sun Jun 28 05:56:11 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0F833E9284; Fri, 26 Jun 2026 09:15:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782465343; cv=none; b=kuC9wg4nvlA5UFahJC+xYzx5UQrNmHZfwrJvT/CH2/XY6NuKnvF7b080kdFdz2rRCFp0xKX713JTy9TpTKKKiGs9gJgHfTePh5AvKv5M130aZkhccpEr8u18Sk/6arBYyaPbHXz0lSkRVmzvFEL2uQQf6L/rDi5fbHhOk+f7Xr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782465343; c=relaxed/simple; bh=oYRv5BqzFUql9T4GqRV+2BKjSlr0oGlI9t14zJot82c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=eHdVzJalhZCWQE7JpU7lJiTNmXPnA1XnumSFJEQYvDUTMP/Wuhhi2fr0TEYXFU4MRt7HZHfMJ9+oeJ29iUhXDkLaR7OsjjRT3Hn93FhIxhJhJ/np2gyCy81tegQR3wRESpyekbalt4rGvtnGlOsJl5SPzbLg0vYHMDX0rVyaJuM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cb2ij0VL; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cb2ij0VL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F13FA1F000E9; Fri, 26 Jun 2026 09:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782465341; bh=oPiuM4lok/Y2wMNEQbnxYMh2qQ5JE0oUxOye8Awa2/k=; h=From:Date:Subject:To:Cc; b=cb2ij0VLjNmVf0ANdiB7hAVXD9LNbw09RHjCpQ4xZl0nrI2c4Y9emQXFt6oq7v8kf AWsqv8THiXWnZwpztNr9qPD9lzWlM3jUy/i3m4qkvRi1GBbFss+gxvQWZxTx7OdUji H6glkozfYOAHbntnMZ9QU3hVHzDZENUQwyM8Ft8DlHdNhskM8ENKM4O7u0gPC+dYB2 TKaG1i1pNGCXapKf9XMkCnM1HeSO6C4ekpvmxUT2ie/4jLn1yc4CMOUWXbzWkq+cza xCrleI6w1bl7UGazSVXm9jeWAiODTOcGKgGSq/voRLYp7X7uytr6zyy93Puy2Z+9U9 zs7H0xHHLAjnw== From: Mike Rapoport Date: Fri, 26 Jun 2026 12:15:36 +0300 Subject: [PATCH v4] selftests/liveupdate: add end to end test infrastructure and scripts Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-luo-vmtest-v0-v4-1-e7d3111cd5b3@kernel.org> X-B4-Tracking: v=1; b=H4sIADdDPmoC/yWMQQ6CMBBFr0Jm7cSGYAGvYli0dYQx0ppOaUwId 7fV5fv57+0gFJkErs0OkTILB1+gOzXgFuNnQr4Xhla1WulW42sLmNdEkjArvOihG/uxN0oNUJx 3pAd/fr3b9GfZ7JNcqpH6sEYIbTTeLXUKkWf259VIogjH8QWhJPPbkQAAAA== X-Change-ID: 20260626-luo-vmtest-v0-56849797a008 To: Pasha Tatashin , Pratyush Yadav Cc: Jordan Richards , Mike Rapoport , Shuah Khan , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Willy Tarreau , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kexec@lists.infradead.org X-Mailer: b4 0.15.2 From: Pasha Tatashin Add the end to end testing infrastructure required to verify the liveupdate feature. This includes a custom init process, a test orchestration script, and a batch runner. The framework consists of: init.c: A lightweight init process that manages the kexec lifecycle. It mounts necessary filesystems, determines the current execution stage (1 or 2) via the kernel command line, and handles the kexec_file_load() sequence to transition between kernels. vmtest.sh: The primary KTAP-compliant test driver. It handles: - Kernel configuration merging and building. - Cross-compilation detection for x86_64 and arm64. - Generation of the initrd containing the test binary and init. - QEMU execution with automatic accelerator detection (KVM, HVF, or TCG). run-vmtests.sh: A wrapper that runs vmtest.sh for each LUO test across supported architectures, providing a summary of pass/fail/skip results. Signed-off-by: Pasha Tatashin Co-developed-by: Jordan Richards Signed-off-by: Jordan Richards Co-developed-by: Mike Rapoport (Microsoft) Signed-off-by: Mike Rapoport (Microsoft) Acked-by: Pratyush Yadav --- v4 changes: * drop addition of ftruncate to nolibc, it is already merged * rename a single test runner to vmtest.sh and the wrapper to run-vmtests.sh * revamp run-vmtests.sh: - add luo_stress_files and luo_stress_files tests - only keep result logs if explicitly requested - replace chatty and colorful summary with use a single line print v3: https://lore.kernel.org/all/20260303010039.2969125-1-jordanrichards@goo= gle.com --- tools/testing/selftests/liveupdate/.gitignore | 1 + tools/testing/selftests/liveupdate/config | 1 + tools/testing/selftests/liveupdate/config.aarch64 | 2 + tools/testing/selftests/liveupdate/config.x86_64 | 2 + tools/testing/selftests/liveupdate/init.c | 179 ++++++++++++++ .../testing/selftests/liveupdate/luo_test_utils.c | 15 +- tools/testing/selftests/liveupdate/run-vmtests.sh | 97 ++++++++ tools/testing/selftests/liveupdate/vmtest.sh | 263 +++++++++++++++++= ++++ 8 files changed, 551 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/liveupdate/.gitignore b/tools/testing/= selftests/liveupdate/.gitignore index 661827083ab6..cb08ddb0dfee 100644 --- a/tools/testing/selftests/liveupdate/.gitignore +++ b/tools/testing/selftests/liveupdate/.gitignore @@ -6,4 +6,5 @@ !*.sh !.gitignore !config +!config.* !Makefile diff --git a/tools/testing/selftests/liveupdate/config b/tools/testing/self= tests/liveupdate/config index 91d03f9a6a39..016d009dba13 100644 --- a/tools/testing/selftests/liveupdate/config +++ b/tools/testing/selftests/liveupdate/config @@ -1,4 +1,5 @@ CONFIG_BLK_DEV_INITRD=3Dy +CONFIG_DEVTMPFS=3Dy CONFIG_KEXEC_FILE=3Dy CONFIG_KEXEC_HANDOVER=3Dy CONFIG_KEXEC_HANDOVER_ENABLE_DEFAULT=3Dy diff --git a/tools/testing/selftests/liveupdate/config.aarch64 b/tools/test= ing/selftests/liveupdate/config.aarch64 new file mode 100644 index 000000000000..445716403925 --- /dev/null +++ b/tools/testing/selftests/liveupdate/config.aarch64 @@ -0,0 +1,2 @@ +CONFIG_SERIAL_AMBA_PL011=3Dy +CONFIG_SERIAL_AMBA_PL011_CONSOLE=3Dy diff --git a/tools/testing/selftests/liveupdate/config.x86_64 b/tools/testi= ng/selftests/liveupdate/config.x86_64 new file mode 100644 index 000000000000..810d9c9d213e --- /dev/null +++ b/tools/testing/selftests/liveupdate/config.x86_64 @@ -0,0 +1,2 @@ +CONFIG_SERIAL_8250=3Dy +CONFIG_SERIAL_8250_CONSOLE=3Dy diff --git a/tools/testing/selftests/liveupdate/init.c b/tools/testing/self= tests/liveupdate/init.c new file mode 100644 index 000000000000..fb08bd58b9b9 --- /dev/null +++ b/tools/testing/selftests/liveupdate/init.c @@ -0,0 +1,179 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* + * Copyright (c) 2025, Google LLC. + * Pasha Tatashin + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define COMMAND_LINE_SIZE 2048 +#define KERNEL_IMAGE "/kernel" +#define INITRD_IMAGE "/initrd.img" +#define TEST_BINARY "/test_binary" + +static int mount_filesystems(void) +{ + if (mount("devtmpfs", "/dev", "devtmpfs", 0, NULL) < 0) { + fprintf(stderr, "INIT: Warning: Failed to mount devtmpfs\n"); + return -1; + } + + if (mount("debugfs", "/debugfs", "debugfs", 0, NULL) < 0) { + fprintf(stderr, "INIT: Failed to mount debugfs\n"); + return -1; + } + + if (mount("proc", "/proc", "proc", 0, NULL) < 0) { + fprintf(stderr, "INIT: Failed to mount proc\n"); + return -1; + } + + return 0; +} + +static long kexec_file_load(int kernel_fd, int initrd_fd, + unsigned long cmdline_len, const char *cmdline, + unsigned long flags) +{ + return syscall(__NR_kexec_file_load, kernel_fd, initrd_fd, cmdline_len, + cmdline, flags); +} + +static int kexec_load(void) +{ + char cmdline[COMMAND_LINE_SIZE]; + int kernel_fd, initrd_fd, err; + ssize_t len; + int fd; + + fd =3D open("/proc/cmdline", O_RDONLY); + if (fd < 0) { + fprintf(stderr, "INIT: Failed to read /proc/cmdline\n"); + + return -1; + } + + len =3D read(fd, cmdline, sizeof(cmdline) - 1); + close(fd); + if (len < 0) + return -1; + + cmdline[len] =3D 0; + if (len > 0 && cmdline[len - 1] =3D=3D '\n') + cmdline[len - 1] =3D 0; + + strncat(cmdline, " luo_stage=3D2", sizeof(cmdline) - strlen(cmdline) - 1); + + kernel_fd =3D open(KERNEL_IMAGE, O_RDONLY); + if (kernel_fd < 0) { + fprintf(stderr, "INIT: Failed to open kernel image\n"); + return -1; + } + + initrd_fd =3D open(INITRD_IMAGE, O_RDONLY); + if (initrd_fd < 0) { + fprintf(stderr, "INIT: Failed to open initrd image\n"); + close(kernel_fd); + return -1; + } + + err =3D kexec_file_load(kernel_fd, initrd_fd, strlen(cmdline) + 1, + cmdline, 0); + + close(initrd_fd); + close(kernel_fd); + + return err; +} + +static int run_test(int stage) +{ + char stage_arg[32]; + int status; + pid_t pid; + + snprintf(stage_arg, sizeof(stage_arg), "%d", stage); + + pid =3D fork(); + if (pid < 0) + return -1; + + if (!pid) { + char *const argv[] =3D {TEST_BINARY, "-s", stage_arg, NULL}; + + execve(TEST_BINARY, argv, NULL); + fprintf(stderr, "INIT: execve failed\n"); + _exit(1); + } + + waitpid(pid, &status, 0); + + return (WIFEXITED(status) && WEXITSTATUS(status) =3D=3D 0) ? 0 : -1; +} + +static int get_current_stage(void) +{ + char cmdline[COMMAND_LINE_SIZE]; + ssize_t len; + int fd; + + fd =3D open("/proc/cmdline", O_RDONLY); + if (fd < 0) + return -1; + + len =3D read(fd, cmdline, sizeof(cmdline) - 1); + close(fd); + + if (len < 0) + return -1; + + cmdline[len] =3D 0; + + return strstr(cmdline, "luo_stage=3D2") ? 2 : 1; +} + +int main(int argc, char *argv[]) +{ + int current_stage; + int err; + + if (mount_filesystems()) + goto err_reboot; + + current_stage =3D get_current_stage(); + if (current_stage < 0) { + fprintf(stderr, "INIT: Failed to read cmdline"); + goto err_reboot; + } + + printf("INIT: Starting Stage %d\n", current_stage); + + if (current_stage =3D=3D 1 && kexec_load()) { + fprintf(stderr, "INIT: Failed to load kexec kernel\n"); + goto err_reboot; + } + + if (run_test(current_stage)) { + fprintf(stderr, "INIT: Test binary returned failure\n"); + goto err_reboot; + } + + printf("INIT: Stage %d completed successfully.\n", current_stage); + reboot(current_stage =3D=3D 1 ? RB_KEXEC : RB_AUTOBOOT); + + return 0; + +err_reboot: + reboot(RB_AUTOBOOT); + + return -1; +} diff --git a/tools/testing/selftests/liveupdate/luo_test_utils.c b/tools/te= sting/selftests/liveupdate/luo_test_utils.c index 333a3530051b..1439b2b48ed0 100644 --- a/tools/testing/selftests/liveupdate/luo_test_utils.c +++ b/tools/testing/selftests/liveupdate/luo_test_utils.c @@ -21,6 +21,7 @@ #include #include #include +#include =20 #include "luo_test_utils.h" =20 @@ -81,7 +82,7 @@ int luo_retrieve_session(int luo_fd, const char *name) int create_and_preserve_memfd(int session_fd, int token, const char *data) { struct liveupdate_session_preserve_fd arg =3D { .size =3D sizeof(arg) }; - long page_size =3D sysconf(_SC_PAGE_SIZE); + long page_size =3D getpagesize(); void *map =3D MAP_FAILED; int mfd =3D -1, ret =3D -1; =20 @@ -117,7 +118,7 @@ int restore_and_verify_memfd(int session_fd, int token, const char *expected_data) { struct liveupdate_session_retrieve_fd arg =3D { .size =3D sizeof(arg) }; - long page_size =3D sysconf(_SC_PAGE_SIZE); + long page_size =3D getpagesize(); void *map =3D MAP_FAILED; int mfd =3D -1, ret =3D -1; =20 @@ -228,16 +229,11 @@ void daemonize_and_wait(void) =20 static int parse_stage_args(int argc, char *argv[]) { - static struct option long_options[] =3D { - {"stage", required_argument, 0, 's'}, - {0, 0, 0, 0} - }; - int option_index =3D 0; int stage =3D 1; int opt; =20 optind =3D 1; - while ((opt =3D getopt_long(argc, argv, "s:", long_options, &option_index= )) !=3D -1) { + while ((opt =3D getopt(argc, argv, "s:")) !=3D -1) { switch (opt) { case 's': stage =3D atoi(optarg); @@ -248,6 +244,7 @@ static int parse_stage_args(int argc, char *argv[]) fail_exit("Unknown argument"); } } + return stage; } =20 @@ -275,7 +272,7 @@ int luo_test(int argc, char *argv[], fail_exit("Failed to check for state session"); =20 if (target_stage !=3D detected_stage) { - ksft_exit_fail_msg("Stage mismatch Requested --stage %d, but system is i= n stage %d.\n" + ksft_exit_fail_msg("Stage mismatch Requested stage %d, but system is in = stage %d.\n" "(State session %s: %s)\n", target_stage, detected_stage, state_session_name, (detected_stage =3D=3D 2) ? "EXISTS" : "MISSING"); diff --git a/tools/testing/selftests/liveupdate/run-vmtests.sh b/tools/test= ing/selftests/liveupdate/run-vmtests.sh new file mode 100755 index 000000000000..d656ce58c5a7 --- /dev/null +++ b/tools/testing/selftests/liveupdate/run-vmtests.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +SCRIPT_DIR=3D$(dirname "$(realpath "$0")") +TEST_RUNNER=3D"$SCRIPT_DIR/vmtest.sh" + +TARGETS=3D("x86_64" "aarch64") + +GREEN=3D'\033[0;32m' +RED=3D'\033[0;31m' +YELLOW=3D'\033[1;33m' +NC=3D'\033[0m' + +passed=3D0 +failed=3D0 +skipped=3D0 + +TEST_NAMES=3D( + "luo_kexec_simple" + "luo_multi_session" + "luo_stress_files" + "luo_stress_sessions" +) + +function usage() { + cat < %-8s %-24s ... " "$arch" "$test_name" + + "$TEST_RUNNER" -t "$arch" -T "$test_name" &> "$log" + exit_code=3D$? + + case $exit_code in + 0) pass;; + 4) skip;; + *) fail;; + esac + done + echo "" + done + + echo "SUMMARY: PASS=3D$passed SKIP=3D$skipped FAIL=3D$failed" + if [ -n "$keep_logs" ]; then + echo "Logs: $output_dir" + fi + + exit $((failed !=3D 0)) +} + +main "$@" diff --git a/tools/testing/selftests/liveupdate/vmtest.sh b/tools/testing/s= elftests/liveupdate/vmtest.sh new file mode 100755 index 000000000000..b0000fae1461 --- /dev/null +++ b/tools/testing/selftests/liveupdate/vmtest.sh @@ -0,0 +1,263 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +set -ue + +CROSS_COMPILE=3D"${CROSS_COMPILE:-""}" + +test_dir=3D$(realpath "$(dirname "$0")") +kernel_dir=3D$(realpath "$test_dir/../../../..") + +workspace_dir=3D"" +headers_dir=3D"" +initrd=3D"" +KEEP_WORKSPACE=3D0 + +source "$test_dir/../kselftest/ktap_helpers.sh" + +function get_arch_conf() { + local arch=3D$1 + if [[ "$arch" =3D=3D "arm64" ]]; then + QEMU_CMD=3D"qemu-system-aarch64 -M virt -cpu max" + KERNEL_IMAGE=3D"Image" + KERNEL_CMDLINE=3D"console=3DttyAMA0" + elif [[ "$arch" =3D=3D "x86" ]]; then + QEMU_CMD=3D"qemu-system-x86_64" + KERNEL_IMAGE=3D"bzImage" + KERNEL_CMDLINE=3D"console=3DttyS0" + else + echo "Unsupported architecture: $arch" + exit 1 + fi +} + +function usage() { + cat <) + -j) number of jobs for compilation + -t) run test for target_arch (aarch64, x86_64) + -T) test name to run (default: luo_kexec_simple) + -w) custom workspace directory (default: creates temp dir) + -k) keep workspace directory after successful test + -h) display this help +EOF +} + +function cleanup() { + if [ "$KEEP_WORKSPACE" -eq 1 ]; then + echo "# Workspace preserved at: $workspace_dir" + else + rm -fr "$workspace_dir" + fi + + ktap_finished +} + +function skip() { + local msg=3D${1:-""} + ktap_test_skip "$msg" + exit "$KSFT_SKIP" +} + +function fail() { + local msg=3D${1:-""} + ktap_test_fail "$msg" + exit "$KSFT_FAIL" +} + +function detect_cross_compile() { + local target=3D$1 + local host=3D$(uname -m) + + [[ "$host" =3D=3D "arm64" ]] && host=3D"aarch64" + [[ "$target" =3D=3D "arm64" ]] && target=3D"aarch64" + + if [[ "$host" =3D=3D "$target" ]]; then + CROSS_COMPILE=3D"" + return + fi + + if [[ -n "$CROSS_COMPILE" ]]; then + return + fi + + local candidate=3D"" + case "$target" in + aarch64) candidate=3D"aarch64-linux-gnu-" ;; + x86_64) candidate=3D"x86_64-linux-gnu-" ;; + *) skip "Auto-detection for target '$target' not supported. Please= set CROSS_COMPILE manually." ;; + esac + + if command -v "${candidate}gcc" &> /dev/null; then + CROSS_COMPILE=3D"$candidate" + else + skip "Compiler '${candidate}gcc' not found. Please install it (e.g., 'ap= t install gcc-aarch64-linux-gnu') or set CROSS_COMPILE." + fi +} + +function build_kernel() { + local build_dir=3D$1 + local make_cmd=3D$2 + local kimage=3D$3 + local target_arch=3D$4 + + local luo_config=3D"$build_dir/luo.config" + local kconfig=3D"$build_dir/.config" + local common_conf=3D"$test_dir/config" + local arch_conf=3D"$test_dir/config.$target_arch" + + echo "# Building kernel in: $build_dir" + + cat "$arch_conf" "$common_conf" | tee "$kconfig" > "$luo_config" + $make_cmd olddefconfig + + # verify that kernel confiration has all necessary options + while read -r opt ; do + grep "$opt" "$kconfig" &>/dev/null || skip "$opt is missing" + done < "$luo_config" + + $make_cmd "$kimage" + $make_cmd headers_install INSTALL_HDR_PATH=3D"$headers_dir" +} + +function mkinitrd() { + local build_dir=3D$1 + local kernel_path=3D$2 + local test_name=3D$3 + + # Compile the test binary and the init process + "$CROSS_COMPILE"gcc -static -O2 -nostdinc -nostdlib \ + -I "$headers_dir/include" \ + -I "$kernel_dir/tools/include/nolibc" \ + -I "$test_dir" \ + -o "$workspace_dir/test_binary" \ + "$test_dir/$test_name.c" "$test_dir/luo_test_utils.c" + + "$CROSS_COMPILE"gcc -s -static -Os -nostdinc -nostdlib \ + -fno-asynchronous-unwind-tables -fno-ident \ + -fno-stack-protector \ + -I "$headers_dir/include" \ + -I "$kernel_dir/tools/include/nolibc" \ + -o "$workspace_dir/init" "$test_dir/init.c" + + cat > "$workspace_dir/cpio_list_inner" < "$works= pace_dir/inner_initrd.cpio" + + cat > "$workspace_dir/cpio_list" < "$initrd" +} + +function run_qemu() { + local qemu_cmd=3D$1 + local cmdline=3D$2 + local kernel_path=3D$3 + local serial=3D"$workspace_dir/qemu.serial" + + cmdline=3D"$cmdline liveupdate=3Don panic=3D-1" + + echo "# Serial Log: $serial" + timeout 30s \ + $qemu_cmd -m 1G -smp 2 -no-reboot -nographic -nodefaults \ + -accel tcg -accel hvf -accel kvm \ + -serial file:"$serial" \ + -append "$cmdline" \ + -kernel "$kernel_path" \ + -initrd "$initrd" + + grep "TEST PASSED" "$serial" &> /dev/null || fail "Liveupdate failed" +} + +function target_to_arch() { + local target=3D$1 + case $target in + aarch64) echo "arm64" ;; + x86_64) echo "x86" ;; + *) skip "architecture $target is not supported" + esac +} + +function main() { + local build_dir=3D"" + local jobs=3D$(nproc) + local target=3D"$(uname -m)" + local test_name=3D"luo_kexec_simple" + local workspace_arg=3D"" + + set -o errtrace + trap fail ERR + + while getopts 'hd:j:t:T:w:k' opt; do + case $opt in + d) build_dir=3D"$OPTARG" ;; + j) jobs=3D"$OPTARG" ;; + t) target=3D"$OPTARG" ;; + T) test_name=3D"$OPTARG" ;; + w) workspace_arg=3D"$OPTARG" ;; + k) KEEP_WORKSPACE=3D1 ;; + h) usage; exit 0 ;; + *) echo "Unknown argument $opt"; usage; exit 1 ;; + esac + done + + ktap_print_header + ktap_set_plan 1 + trap cleanup EXIT + + if [ -n "$workspace_arg" ]; then + workspace_dir=3D"$(realpath -m "$workspace_arg")" + mkdir -p "$workspace_dir" + else + workspace_dir=3D$(mktemp -d /tmp/luo-test.XXXXXXXX) + fi + + echo "# Workspace created at: $workspace_dir" + headers_dir=3D"$workspace_dir/usr" + initrd=3D"$workspace_dir/initrd.cpio" + + detect_cross_compile "$target" + + local arch=3D$(target_to_arch "$target") + + if [ -z "$build_dir" ]; then + build_dir=3D"$kernel_dir/.luo_test_build.$arch" + fi + + mkdir -p "$build_dir" + build_dir=3D$(realpath "$build_dir") + get_arch_conf "$arch" + + local make_cmd=3D"make -s ARCH=3D$arch CROSS_COMPILE=3D$CROSS_COMPILE -j$= jobs" + local make_cmd_build=3D"$make_cmd -C $kernel_dir O=3D$build_dir" + + build_kernel "$build_dir" "$make_cmd_build" "$KERNEL_IMAGE" "$target" + + local final_kernel=3D"$build_dir/arch/$arch/boot/$KERNEL_IMAGE" + mkinitrd "$build_dir" "$final_kernel" "$test_name" + + run_qemu "$QEMU_CMD" "$KERNEL_CMDLINE" "$final_kernel" + ktap_test_pass "$test_name succeeded" +} + +main "$@" --- base-commit: 962528fef90253aeded29cee20a9b6ff3595fed4 change-id: 20260626-luo-vmtest-v0-56849797a008 Best regards, -- =20 Sincerely yours, Mike.