From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <daniel.kiper@oracle.com>
Cc: Glenn Washburn <development@efficientek.com>
Subject: [PATCH v3 0/4] Various fixes/improvements for tests
Date: Thu, 7 Oct 2021 15:33:23 -0500 [thread overview]
Message-ID: <20211007203327.159098-1-development@efficientek.com> (raw)
In this update from the previous patch series, I've only included the patches
which required changes, which were the previous patches 4 and 7.
Patch 4 was broken up at the Daniel's request, also a little differently than
requested. It is now the first 3 patches. I've also changed the patch slightly
as can be seen in the interdiff, but its functionally equivalent to the
previous patch. The first is just adding missing 'set -e' commands to turn
on shell's errexit. The second move subshells containing grub-shell such that
the output goes to a shell variable as opposed to input of another command,
which occludes the exit code. The third fixes a different error code occlusion
issue, where if grub-shell is not the last command in a pipeline its exit code
will be ignored. Another way of preventing this is to use 'set -o pipefail' in
bash, but this is not recognized in dash and perhaps other shells.
The fourth patch is the same as the previous patch #7, except that a missing
skip exit code for the test grub_cmd_sleep was added.
Glenn
Glenn Washburn (4):
tests: Add set -e to missing tests
tests: Do not occlude subshell error codes
tests: Do not occlude grub-shell return code
tests: Exit with skipped exit code when test not performed
tests/ahci_test.in | 15 ++++++++++-----
tests/cdboot_test.in | 11 ++++++-----
tests/core_compress_test.in | 8 +++++---
tests/ehci_test.in | 15 ++++++++++-----
tests/fddboot_test.in | 19 ++++++++++---------
tests/grub_cmd_date.in | 5 +++--
tests/grub_cmd_set_date.in | 6 +++---
tests/grub_cmd_sleep.in | 2 +-
tests/grub_cmd_test.in | 1 +
tests/grub_script_blockarg.in | 1 +
tests/grub_script_expansion.in | 3 ++-
tests/gzcompress_test.in | 3 ++-
tests/hddboot_test.in | 9 +++++----
tests/lzocompress_test.in | 3 ++-
tests/netboot_test.in | 15 ++++++++-------
tests/ohci_test.in | 15 ++++++++++-----
tests/partmap_test.in | 12 ++++++------
tests/pata_test.in | 9 +++++----
tests/pseries_test.in | 2 +-
tests/test_sha512sum.in | 1 +
tests/uhci_test.in | 15 ++++++++++-----
tests/xzcompress_test.in | 3 ++-
22 files changed, 104 insertions(+), 69 deletions(-)
Interdiff against v2:
diff --git a/tests/ahci_test.in b/tests/ahci_test.in
index 0e1c3679b..6d2e61d4e 100644
--- a/tests/ahci_test.in
+++ b/tests/ahci_test.in
@@ -41,11 +41,12 @@ echo "hello" > "$outfile"
tar cf "$imgfile" "$outfile"
-echo "nativedisk; source '(ahci0)/$outfile';" |
+v=$(echo "nativedisk; source '(ahci0)/$outfile';" |
"${grubshell}" --qemu-opts="-drive id=disk,file=$imgfile,if=none
-device ahci,id=ahci
- -device ide-hd,drive=disk,bus=ahci.0" >$outfile
-if [ "$(cat "$outfile" | tail -n 1)" != "Hello World" ]; then
+ -device ide-hd,drive=disk,bus=ahci.0")
+v=$(echo "$v" | tail -n 1)
+if [ "$v" != "Hello World" ]; then
rm "$imgfile"
rm "$outfile"
exit 1
diff --git a/tests/ehci_test.in b/tests/ehci_test.in
index bd80f93d4..df671b4b6 100644
--- a/tests/ehci_test.in
+++ b/tests/ehci_test.in
@@ -41,11 +41,12 @@ echo "hello" > "$outfile"
tar cf "$imgfile" "$outfile"
-echo "nativedisk; source '(usb0)/$outfile';" |
+v=$(echo "nativedisk; source '(usb0)/$outfile';" |
"${grubshell}" --qemu-opts="-device ich9-usb-ehci1
-drive id=my_usb_disk,file=$imgfile,if=none
- -device usb-storage,drive=my_usb_disk" >$outfile
-if [ "$(cat "$outfile" | tail -n 1)" != "Hello World" ]; then
+ -device usb-storage,drive=my_usb_disk")
+v=$(echo "$v" | tail -n 1)
+if [ "$v" != "Hello World" ]; then
rm "$imgfile"
rm "$outfile"
exit 1
diff --git a/tests/grub_cmd_sleep.in b/tests/grub_cmd_sleep.in
index 8797f6632..1a57fb388 100644
--- a/tests/grub_cmd_sleep.in
+++ b/tests/grub_cmd_sleep.in
@@ -5,7 +5,7 @@ set -e
# FIXME: OpenBIOS on sparc64 doesn't implement RTC
if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then
- exit 0
+ exit 77
fi
# Compare RTC with interval timer.
diff --git a/tests/grub_script_blockarg.in b/tests/grub_script_blockarg.in
index 6d63a345a..a91c7ca82 100644
--- a/tests/grub_script_blockarg.in
+++ b/tests/grub_script_blockarg.in
@@ -1,4 +1,5 @@
-#! @BUILD_SHEBANG@ -e
+#! @BUILD_SHEBANG@
+set -e
# Run GRUB script in a Qemu instance
# Copyright (C) 2010 Free Software Foundation, Inc.
diff --git a/tests/ohci_test.in b/tests/ohci_test.in
index 105220856..741ad881f 100644
--- a/tests/ohci_test.in
+++ b/tests/ohci_test.in
@@ -41,11 +41,12 @@ echo "hello" > "$outfile"
tar cf "$imgfile" "$outfile"
-echo "nativedisk; source '(usb0)/$outfile';" |
+v=$(echo "nativedisk; source '(usb0)/$outfile';" |
"${grubshell}" --qemu-opts="-device pci-ohci
-drive id=my_usb_disk,file=$imgfile,if=none
- -device usb-storage,drive=my_usb_disk" >$outfile
-if [ "$(cat "$outfile" | tail -n 1)" != "Hello World" ]; then
+ -device usb-storage,drive=my_usb_disk")
+v=$(echo "$v" | tail -n 1)
+if [ "$v" != "Hello World" ]; then
rm "$imgfile"
rm "$outfile"
exit 1
diff --git a/tests/uhci_test.in b/tests/uhci_test.in
index 2984283c0..5aa5eb726 100644
--- a/tests/uhci_test.in
+++ b/tests/uhci_test.in
@@ -41,11 +41,12 @@ echo "hello" > "$outfile"
tar cf "$imgfile" "$outfile"
-echo "nativedisk; source '(usb0)/$outfile';" |
+v=$(echo "nativedisk; source '(usb0)/$outfile';" |
"${grubshell}" --qemu-opts="-device ich9-usb-uhci1
-drive id=my_usb_disk,file=$imgfile,if=none
- -device usb-storage,drive=my_usb_disk" >$outfile
-if [ "$(cat "$outfile" | tail -n 1)" != "Hello World" ]; then
+ -device usb-storage,drive=my_usb_disk")
+v=$(echo "$v" | tail -n 1)
+if [ "$v" != "Hello World" ]; then
rm "$imgfile"
rm "$outfile"
exit 1
--
2.27.0
next reply other threads:[~2021-10-07 20:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-07 20:33 Glenn Washburn [this message]
2021-10-07 20:33 ` [PATCH v3 1/4] tests: Add set -e to missing tests Glenn Washburn
2021-10-11 14:04 ` Daniel Kiper
2021-10-07 20:33 ` [PATCH v3 2/4] tests: Do not occlude subshell error codes Glenn Washburn
2021-10-11 14:20 ` Daniel Kiper
2021-10-11 18:06 ` Glenn Washburn
2021-10-12 19:40 ` Daniel Kiper
2021-10-13 0:39 ` Glenn Washburn
2021-10-07 20:33 ` [PATCH v3 3/4] tests: Do not occlude grub-shell return code Glenn Washburn
2021-10-11 14:31 ` Daniel Kiper
2021-10-07 20:33 ` [PATCH v3 4/4] tests: Exit with skipped exit code when test not performed Glenn Washburn
2021-10-11 14:34 ` Daniel Kiper
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=20211007203327.159098-1-development@efficientek.com \
--to=development@efficientek.com \
--cc=daniel.kiper@oracle.com \
--cc=grub-devel@gnu.org \
/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.