[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/6] grub-shell: Only cleanup working directory file if QEMU does
From: |
Glenn Washburn |
Subject: |
[PATCH 2/6] grub-shell: Only cleanup working directory file if QEMU does not fail or timeout |
Date: |
Tue, 10 Jan 2023 16:08:56 -0600 |
This keeps the generated files to aid in diagnosing the source of the
failure.
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
tests/util/grub-shell.in | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 2c0e654c1f..e5d34d1d35 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -537,8 +537,6 @@ elif [ x$boot = xemu ]; then
(cd "$rootdir"; tar cf "$roottar" .)
setup_qemu_logger
"${builddir}/grub-core/grub-emu" -m "$device_map" --memdisk "$roottar" -r
memdisk -d "/boot/grub" > "$work_directory/qemu-pipe" || ret=$?
- test -n "$debug" || rm -rf "$rootdir"
- test -n "$debug" || rm -f "$roottar"
else
setup_qemu_logger
timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial
file:/dev/stdout -${device}"${isofile}" ${bootdev} >
"$work_directory/qemu-pipe" || ret=$?
@@ -547,8 +545,16 @@ fi
wait
rm -f "$work_directory/qemu-pipe"
+if [ "$ret" -ne 0 ]; then
+ # If QEMU failure, keep generated files to reproduce
+ exit $ret
+fi
+
if [ x$boot = xcoreboot ]; then
test -n "$debug" || rm -f "${imgfile}"
+elif [ x$boot = xemu ]; then
+ test -n "$debug" || rm -rf "$rootdir"
+ test -n "$debug" || rm -f "$roottar"
fi
test -n "$debug" || rm -f "${isofile}"
test -n "$debug" || rm -rf "${rom_directory}"
--
2.34.1
- [PATCH 0/6] Cryptomount testing, Glenn Washburn, 2023/01/10
- [PATCH 1/6] grub-shell: Set exit status to qemu exit status, Glenn Washburn, 2023/01/10
- [PATCH 2/6] grub-shell: Only cleanup working directory file if QEMU does not fail or timeout,
Glenn Washburn <=
- [PATCH 3/6] grub-shell: Allow specifying non-default trim line contents, Glenn Washburn, 2023/01/10
- [PATCH 4/6] grub-shell: Trim line should always be matched from the beginning of the line, Glenn Washburn, 2023/01/10
- [PATCH 5/6] grub-shell: Add halt_cmd variable to testcase namespace, Glenn Washburn, 2023/01/10
- [PATCH 6/6] tests: Add cryptomount functional test, Glenn Washburn, 2023/01/10
- Re: [PATCH 0/6] Cryptomount testing, Daniel Kiper, 2023/01/12