From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <dkiper@net-space.pl>
Cc: Patrick Steinhardt <ps@pks.im>,
Glenn Washburn <development@efficientek.com>
Subject: [PATCH 1/6] grub-shell: Set exit status to qemu exit status
Date: Tue, 10 Jan 2023 16:08:55 -0600 [thread overview]
Message-ID: <20230110220900.1248367-2-development@efficientek.com> (raw)
In-Reply-To: <20230110220900.1248367-1-development@efficientek.com>
This allows us to test if unexpected output in test scripts is because of a
bug in grub, because there was an error in qemu, or qemu was killed due to a
timeout.
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
tests/util/grub-shell.in | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 43672e0804..2c0e654c1f 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -502,6 +502,12 @@ copy_extra_files() {
done
}
+setup_qemu_logger() {
+ cat < "$work_directory/qemu-pipe" | tr -d "\r" | tee "${goutfile}" | do_trim &
+}
+
+ret=0
+mkfifo "$work_directory/qemu-pipe"
if [ x$boot = xnet ]; then
netdir="$work_directory/netdir"
mkdir -p "$netdir"
@@ -509,7 +515,8 @@ if [ x$boot = xnet ]; then
cp "${cfgfile}" "$netdir/boot/grub/grub.cfg"
cp "${source}" "$netdir/boot/grub/testcase.cfg"
[ -z "$files" ] || copy_extra_files "$netdir" $files
- timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic | cat | tr -d "\r" | tee "${goutfile}" | do_trim
+ setup_qemu_logger
+ timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic > "$work_directory/qemu-pipe" || ret=$?
elif [ x$boot = xemu ]; then
rootdir="$work_directory/rootdir"
grubdir="$rootdir/boot/grub"
@@ -528,12 +535,18 @@ elif [ x$boot = xemu ]; then
[ -z "$files" ] || copy_extra_files "$rootdir" $files
roottar="$work_directory/root.tar"
(cd "$rootdir"; tar cf "$roottar" .)
- "${builddir}/grub-core/grub-emu" -m "$device_map" --memdisk "$roottar" -r memdisk -d "/boot/grub" | tr -d "\r" | tee "${goutfile}" | do_trim
+ 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
- timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -${device}"${isofile}" ${bootdev} | cat | tr -d "\r" | tee "${goutfile}" | do_trim
+ setup_qemu_logger
+ timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -${device}"${isofile}" ${bootdev} > "$work_directory/qemu-pipe" || ret=$?
fi
+
+wait
+rm -f "$work_directory/qemu-pipe"
+
if [ x$boot = xcoreboot ]; then
test -n "$debug" || rm -f "${imgfile}"
fi
@@ -541,6 +554,6 @@ test -n "$debug" || rm -f "${isofile}"
test -n "$debug" || rm -rf "${rom_directory}"
test -n "$debug" || rm -f "${tmpfile}" "${cfgfile}" "${goutfile}"
-exit 0
+exit $ret
--
2.34.1
next prev parent reply other threads:[~2023-01-10 22:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-10 22:08 [PATCH 0/6] Cryptomount testing Glenn Washburn
2023-01-10 22:08 ` Glenn Washburn [this message]
2023-01-10 22:08 ` [PATCH 2/6] grub-shell: Only cleanup working directory file if QEMU does not fail or timeout Glenn Washburn
2023-01-10 22:08 ` [PATCH 3/6] grub-shell: Allow specifying non-default trim line contents Glenn Washburn
2023-01-10 22:08 ` [PATCH 4/6] grub-shell: Trim line should always be matched from the beginning of the line Glenn Washburn
2023-01-10 22:08 ` [PATCH 5/6] grub-shell: Add halt_cmd variable to testcase namespace Glenn Washburn
2023-01-10 22:09 ` [PATCH 6/6] tests: Add cryptomount functional test Glenn Washburn
2023-01-12 16:23 ` [PATCH 0/6] Cryptomount testing Daniel Kiper
2023-01-13 8:13 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230110220900.1248367-2-development@efficientek.com \
--to=development@efficientek.com \
--cc=dkiper@net-space.pl \
--cc=grub-devel@gnu.org \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.