selftests/liveupdate: Preserve VM workspaces with run-vmtests.sh -k
Subsystems (3)
PATCH 1/1 selftests/liveupdate: Preserve VM workspaces with run-vmtests.sh -k
From: George Guo <[email protected]>
run-vmtests.sh -k keeps the test output logs, but vmtest.sh still removes its workspace and qemu.serial, losing the guest output needed to debug failures.
Forward -k to vmtest.sh when keeping logs and update the help texts to match.
--- tools/testing/selftests/liveupdate/run-vmtests.sh | 7 +++++-- tools/testing/selftests/liveupdate/vmtest.sh | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)
tools/testing/selftests/liveupdate/run-vmtests.sh +5 -2
@@ -26,7 +26,7 @@ function usage() { cat <<EOF $0 [-k] [-o output_dir] [-h] Options: - -k) keep logs + -k) keep logs and VM workspaces, including guest serial logs -o) specify output directory -h) display this help EOF
@@ -48,6 +48,8 @@ function fail() { } function main() { + local -a vmtest_args=() + while getopts 'hko:' opt; do case $opt in k) keep_logs=1 ;;
@@ -59,6 +61,7 @@ function main() { done if [ -n "$keep_logs" ]; then + vmtest_args+=(-k) if [ -z "$output_dir" ]; then output_dir="$SCRIPT_DIR/results_$(date +%Y%m%d_%H%M%S)" fi;
@@ -74,7 +77,7 @@ function main() { printf " -> %-8s %-24s ... " "$arch" "$test_name" - "$TEST_RUNNER" -t "$arch" -T "$test_name" &> "$log" + "$TEST_RUNNER" "${vmtest_args[@]}" -t "$arch" -T "$test_name" &> "$log" exit_code=$? case $exit_code in
tools/testing/selftests/liveupdate/vmtest.sh +1 -1
@@ -40,7 +40,7 @@ Options: -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 + -k) keep workspace directory -h) display this help EOF }
base-commit: 9a6a70aefe77f6fb9ff2b3037dcf87f6dff65c8c
Signature · 1 line
2.53.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 10 lines
From: George Guo <[email protected]>
run-vmtests.sh-k keeps the test output logs, butvmtest.shstill removes its workspace and qemu.serial, losing the guest output needed to debug failures.Forward -k to
vmtest.shwhen keeping logs and update the help texts to match.Signed-off-by George Guo <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Hi George,
Quoted 46 lines · George Guo
From: George Guo <[email protected]>
run-vmtests.sh-k keeps the test output logs, butvmtest.shstill removes its workspace and qemu.serial, losing the guest output needed to debug failures.Forward -k to
vmtest.shwhen keeping logs and update the help texts to match.Signed-off-by George Guo <[email protected]>--- tools/testing/selftests/liveupdate/run-vmtests.sh | 7 +++++-- tools/testing/selftests/liveupdate/vmtest.sh | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)tools/testing/selftests/liveupdate/run-vmtests.sh +4
-1@@ -26,7 +26,7 @@ function usage() { cat <<EOF $0 [-k] [-o output_dir] [-h] Options: - -k) keep logs + -k) keep logs and VM workspaces, including guest serial logs -o) specify output directory -h) display this help EOF@@ -48,6 +48,8 @@ function fail() { } function main() { + local -a vmtest_args=() + while getopts 'hko:' opt; do case $opt in k) keep_logs=1 ;;@@ -59,6 +61,7 @@ function main() { done if [ -n "$keep_logs" ]; then + vmtest_args+=(-k) if [ -z "$output_dir" ]; then output_dir="$SCRIPT_DIR/results_$(date +%Y%m%d_%H%M%S)" fi;
tools/testing/selftests/liveupdate/run-vmtests.sh function main() { · line 83
Quoted 8 lines
tools/testing/selftests/liveupdate/run-vmtests.sh +1
-1@@ -74,7 +77,7 @@ function main() { printf " -> %-8s %-24s ... " "$arch" "$test_name" - "$TEST_RUNNER" -t "$arch" -T "$test_name" &> "$log" + "$TEST_RUNNER" "${vmtest_args[@]}" -t "$arch" -T "$test_name" &> "$log" exit_code=$? case $exit_code in
the "4) skip;;" branch in run-vmtests.sh can never be hit.
vmtest.sh's skip() exits with $KSFT_SKIP, but the EXIT trap runs cleanup(),which calls ktap_finished(), and that exits with $KSFT_PASS when the counts add up to the plan. So "./vmtest.sh -k -t bogus" prints "ok 1 ... # SKIP" and still exits 0 (and leaves an empty /tmp/luo-test.* with -k).
That's a pre-existing bug, not caused by forwarding -k, so it may require a separate fix that keeps the exit status in cleanup()? Something like saving $? at the top and exiting with it, calling ktap_finished() only when it's 0. kho/vmtest.sh has the same pattern, so it probably wants the same fix.
Quoted 15 lines
tools/testing/selftests/liveupdate/vmtest.sh +1
-1@@ -40,7 +40,7 @@ Options: -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 + -k) keep workspace directory -h) display this help EOF }base-commit:
9a6a70aefe77f6fb9ff2b3037dcf87f6dff65c8c
Signature · 2 lines
Regards, Mukesh Pilaniya
Hi George,
Quoted 10 lines · George Guo
From: George Guo <[email protected]>
run-vmtests.sh-k keeps the test output logs, butvmtest.shstill removes its workspace and qemu.serial, losing the guest output needed to debug failures.Forward -k to
vmtest.shwhen keeping logs and update the help texts to match.Signed-off-by George Guo <[email protected]>
Please feel free to use Reviewed-by: Mukesh Pilaniya <[email protected]> for this patch.
Quoted 59 lines
--- tools/testing/selftests/liveupdate/run-vmtests.sh | 7 +++++-- tools/testing/selftests/liveupdate/vmtest.sh | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)tools/testing/selftests/liveupdate/run-vmtests.sh +5
-2@@ -26,7 +26,7 @@ function usage() { cat <<EOF $0 [-k] [-o output_dir] [-h] Options: - -k) keep logs + -k) keep logs and VM workspaces, including guest serial logs -o) specify output directory -h) display this help EOF@@ -48,6 +48,8 @@ function fail() { } function main() { + local -a vmtest_args=() + while getopts 'hko:' opt; do case $opt in k) keep_logs=1 ;;@@ -59,6 +61,7 @@ function main() { done if [ -n "$keep_logs" ]; then + vmtest_args+=(-k) if [ -z "$output_dir" ]; then output_dir="$SCRIPT_DIR/results_$(date +%Y%m%d_%H%M%S)" fi;@@ -74,7 +77,7 @@ function main() { printf " -> %-8s %-24s ... " "$arch" "$test_name" - "$TEST_RUNNER" -t "$arch" -T "$test_name" &> "$log" + "$TEST_RUNNER" "${vmtest_args[@]}" -t "$arch" -T "$test_name" &> "$log" exit_code=$? case $exit_code intools/testing/selftests/liveupdate/vmtest.sh +1
-1@@ -40,7 +40,7 @@ Options: -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 + -k) keep workspace directory -h) display this help EOF }base-commit:
9a6a70aefe77f6fb9ff2b3037dcf87f6dff65c8c
Signature · 2 lines
Regards, Mukesh Pilaniya
Quoted 8 lines · George Guo
run-vmtests.sh-k keeps the test output logs, butvmtest.shstill removes its workspace and qemu.serial, losing the guest output needed to debug failures.Forward -k to
vmtest.shwhen keeping logs and update the help texts to match.[...]
Applied, thanks!
https://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux.git/log/?h=fixes
[1/1] selftests/liveupdate: Preserve VM workspaces with run-vmtests.sh -k
commit: 654efa9a6c4c455aca6f034f321c013f5b784157
Best regards,
Signature · 1 line
Pasha