All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Various fixes/improvements for tests
@ 2021-03-15  2:20 Glenn Washburn
  2021-03-15  2:20 ` [PATCH 1/8] tests: Make sure LANG is set properly for iso9660_test Glenn Washburn
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Glenn Washburn @ 2021-03-15  2:20 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn

The first 4 patches in the series have already been submitted as part of the
GitLab CI patch series. I've included them here because they logically go with
the subsequent 4 patches and because I suspect that the GitLab CI patch series
is given lower priority than this one will be. So the first 4 patches here
where needed for the GitLab CI and thus have been tested as such.

Patch #1 is needed when runing on systems that do not have LANG set to something
UTF capable. We need UTF to successfully run some of the filesystem tests on
internationalization.

Patch #2 was required to get the arm-efi tests to be successful, but I wonder
if it can change depending on setup (eg. qemu version). Is anyone currently
running arm-efi tests successfully?

Patch #3 seems obviously the right way to do it. So that makes me question why
it wasn't done this way to begin with. Am I missing something? Was there a
reason not to do it this way (perhaps running these tests on OS/arches I'm not)?

Patch #4 was not strictly necessary for the GitLab CI, but it was valuable in
debugging test failures (we really only care about the failure code of
grub-shell).

Patches #5 and #6 decrease false positive test results, that is tests shown
as failing that are not actually failing (ie something prevented the test
from actually running).

Patch #7 marks tests as skipped when they are skipped, instead of marking them
with success as is currently done.

Patch #8 is trivial

Glenn

Glenn Washburn (8):
  tests: Make sure LANG is set properly for iso9660_test
  tests: Fix partmap_test for arm*-efi, disk numbering has changed
  tests: When checking squashfs fstime, use superblock last modified
    time
  tests: Fail immediately when grub-shell fails and do not occlude the
    error code
  tests: Make setup errors in grub-fs-tester hard errors
  tests: A failure of mktemp should cause the test script to exit with
    code 99
  tests: Exit with skipped exit code when test not performed
  tests: Use @BUILD_SHEBANG@ autoconf var instead of literal shell

 tests/ahci_test.in             | 18 +++++++++++-------
 tests/cdboot_test.in           | 11 ++++++-----
 tests/core_compress_test.in    |  8 +++++---
 tests/ehci_test.in             | 18 +++++++++++-------
 tests/f2fs_test.in             |  2 +-
 tests/fddboot_test.in          | 19 ++++++++++---------
 tests/gettext_strings_test.in  |  2 +-
 tests/grub_cmd_date.in         |  5 +++--
 tests/grub_cmd_set_date.in     |  6 +++---
 tests/grub_cmd_test.in         |  7 ++++---
 tests/grub_script_blockarg.in  |  4 ++--
 tests/grub_script_expansion.in |  3 ++-
 tests/gzcompress_test.in       |  3 ++-
 tests/hddboot_test.in          |  9 +++++----
 tests/iso9660_test.in          |  6 ++++++
 tests/lzocompress_test.in      |  3 ++-
 tests/netboot_test.in          | 15 ++++++++-------
 tests/ohci_test.in             | 18 +++++++++++-------
 tests/partmap_test.in          | 18 +++++++++---------
 tests/pata_test.in             | 13 +++++++------
 tests/pseries_test.in          |  2 +-
 tests/syslinux_test.in         |  2 +-
 tests/test_sha512sum.in        |  7 ++++---
 tests/uhci_test.in             | 18 +++++++++++-------
 tests/util/grub-fs-tester.in   | 17 ++++++++++++-----
 tests/xzcompress_test.in       |  3 ++-
 26 files changed, 140 insertions(+), 97 deletions(-)

-- 
2.27.0



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/8] tests: Make sure LANG is set properly for iso9660_test
  2021-03-15  2:20 [PATCH 0/8] Various fixes/improvements for tests Glenn Washburn
@ 2021-03-15  2:20 ` Glenn Washburn
  2021-03-15  2:20 ` [PATCH 2/8] tests: Fix partmap_test for arm*-efi, disk numbering has changed Glenn Washburn
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Glenn Washburn @ 2021-03-15  2:20 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn

LANG must be set to something that supports international characters,
otherwise xorriso will refuse to include the file with name having
international characters, causing the test to fail. So if LANG is not set,
set it to en_US.UTF-8, a very common UTF-8 locale. And if it is set, but
does not look like a UTF-8 locale, print a warning so the user will have a
clue as to why the iso9660_test might be failing.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 tests/iso9660_test.in | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/iso9660_test.in b/tests/iso9660_test.in
index 571b938d7..37b1d30af 100644
--- a/tests/iso9660_test.in
+++ b/tests/iso9660_test.in
@@ -7,6 +7,12 @@ if ! which xorriso >/dev/null 2>&1; then
    exit 77
 fi
 
+if [ -z "$LANG" ]; then
+   export LANG=en_US.UTF-8
+elif [ -n "${LANG##*UTF*}" ]; then
+   echo "WARNING: LANG=$LANG appears to not be unicode, international file test may fail."
+fi
+
 "@builddir@/grub-fs-tester" joliet
 "@builddir@/grub-fs-tester" rockridge
 "@builddir@/grub-fs-tester" rockridge_joliet
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/8] tests: Fix partmap_test for arm*-efi, disk numbering has changed
  2021-03-15  2:20 [PATCH 0/8] Various fixes/improvements for tests Glenn Washburn
  2021-03-15  2:20 ` [PATCH 1/8] tests: Make sure LANG is set properly for iso9660_test Glenn Washburn
@ 2021-03-15  2:20 ` Glenn Washburn
  2021-03-15  2:20 ` [PATCH 3/8] tests: When checking squashfs fstime, use superblock last modified time Glenn Washburn
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Glenn Washburn @ 2021-03-15  2:20 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn

Perhaps using a newer UEFI firmware is the reason for the created test disk
showing up as hd2 instead of hd3.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 tests/partmap_test.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/partmap_test.in b/tests/partmap_test.in
index 6ef518b0a..7353dc70e 100644
--- a/tests/partmap_test.in
+++ b/tests/partmap_test.in
@@ -89,7 +89,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	disk=arc/scsi0/disk0/rdisk0
 	;;
     arm*-efi)
-	disk=hd3
+	disk=hd2
 	;;
     *)
 	disk=hd0
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/8] tests: When checking squashfs fstime, use superblock last modified time
  2021-03-15  2:20 [PATCH 0/8] Various fixes/improvements for tests Glenn Washburn
  2021-03-15  2:20 ` [PATCH 1/8] tests: Make sure LANG is set properly for iso9660_test Glenn Washburn
  2021-03-15  2:20 ` [PATCH 2/8] tests: Fix partmap_test for arm*-efi, disk numbering has changed Glenn Washburn
@ 2021-03-15  2:20 ` Glenn Washburn
  2021-03-15  2:20 ` [PATCH 4/8] tests: Fail immediately when grub-shell fails and do not occlude the error code Glenn Washburn
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Glenn Washburn @ 2021-03-15  2:20 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn

Currently, the filesystem timestamp check in grub-fs-tester uses the
squashfs image file's last modified timestamp and checks to see if that
time stamp is within 3 seconds of the superblock timestamp as determined by
grub. The image file's timestamp could be more than 3 seconds off if
mksquashfs takes more than 3 seconds to generate the image, as is the case
on a virtual machine. Instead use squashfs tools to get the filesystem
timestamp directly.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 tests/util/grub-fs-tester.in | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in
index bfc425e1f..4213b7bfc 100644
--- a/tests/util/grub-fs-tester.in
+++ b/tests/util/grub-fs-tester.in
@@ -1351,6 +1351,12 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
 			# With some abstractions like mdraid flushing to disk
 			# may be delayed for a long time.
 			FSTIME="$UMOUNT_TIME";;
+		    xsquash*)
+			# Creating the squash image may take more than a few
+			# seconds. Use the more accurate timestamp from the
+			# superblock.
+			FSTIME="$(unsquashfs -s "${FSIMAGEP}0.img" | grep ^Creation | awk '{print $6 " " $7 " " $8 " " $9 " " $10; }')"
+			FSTIME="$(date -d "$FSTIME" -u '+%Y-%m-%d %H:%M:%S')";;
 		    *)
 			FSTIME="$(TZ=UTC ls --time-style="+%Y-%m-%d_%H:%M:%S" -l -d "${FSIMAGEP}0.img"|awk '{print $6; }'|sed 's,_, ,g')";;
 		esac
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/8] tests: Fail immediately when grub-shell fails and do not occlude the error code
  2021-03-15  2:20 [PATCH 0/8] Various fixes/improvements for tests Glenn Washburn
                   ` (2 preceding siblings ...)
  2021-03-15  2:20 ` [PATCH 3/8] tests: When checking squashfs fstime, use superblock last modified time Glenn Washburn
@ 2021-03-15  2:20 ` Glenn Washburn
  2021-03-15  2:20 ` [PATCH 5/8] tests: Make setup errors in grub-fs-tester hard errors Glenn Washburn
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Glenn Washburn @ 2021-03-15  2:20 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn

If grub-shell fails, that means that whatever was being tested was not
actually tested. So fail immediately. Sometimes grub-shell is not the last
command in a pipeline of several commands, and in this case the failed error
code can be hidden by a later failing command or hidden when 'set -e' is not
set and there are subsequent successful commands. When the test script fails
because of a failure in grub-shell, then test script should exit with the
failed exit code of grub-shell.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 tests/ahci_test.in             | 6 +++++-
 tests/cdboot_test.in           | 3 ++-
 tests/core_compress_test.in    | 6 ++++--
 tests/ehci_test.in             | 6 +++++-
 tests/fddboot_test.in          | 3 ++-
 tests/grub_cmd_date.in         | 3 ++-
 tests/grub_cmd_test.in         | 1 +
 tests/grub_script_blockarg.in  | 2 +-
 tests/grub_script_expansion.in | 3 ++-
 tests/gzcompress_test.in       | 3 ++-
 tests/hddboot_test.in          | 3 ++-
 tests/lzocompress_test.in      | 3 ++-
 tests/netboot_test.in          | 3 ++-
 tests/ohci_test.in             | 6 +++++-
 tests/partmap_test.in          | 4 ++--
 tests/pata_test.in             | 3 ++-
 tests/test_sha512sum.in        | 1 +
 tests/uhci_test.in             | 6 +++++-
 tests/xzcompress_test.in       | 3 ++-
 19 files changed, 49 insertions(+), 19 deletions(-)

diff --git a/tests/ahci_test.in b/tests/ahci_test.in
index 7df560462..3fb7f54a2 100644
--- a/tests/ahci_test.in
+++ b/tests/ahci_test.in
@@ -41,7 +41,11 @@ echo "hello" > "$outfile"
 
 tar cf "$imgfile" "$outfile"
 
-if [ "$(echo "nativedisk; source '(ahci0)/$outfile';" | "${grubshell}" --qemu-opts="-drive id=disk,file=$imgfile,if=none -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 " | tail -n 1)" != "Hello World" ]; then
+echo "nativedisk; source '(ahci0)/$outfile';" |
+    "${grubshell}" --qemu-opts="-drive id=disk,file=$imgfile,if=none
+				-device ahci,id=ahci
+				-device ide-drive,drive=disk,bus=ahci.0" >$outfile
+if [ "$(cat "$outfile" | tail -n 1)" != "Hello World" ]; then
    rm "$imgfile"
    rm "$outfile"
    exit 1
diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in
index 75acdfedb..7229f79fb 100644
--- a/tests/cdboot_test.in
+++ b/tests/cdboot_test.in
@@ -34,6 +34,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-if [ "$(echo hello | "${grubshell}" --boot=cd)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --boot=cd`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
diff --git a/tests/core_compress_test.in b/tests/core_compress_test.in
index 9d216ebcf..90dd00607 100644
--- a/tests/core_compress_test.in
+++ b/tests/core_compress_test.in
@@ -27,10 +27,12 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 esac
 
 
-if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=--compress=xz)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --grub-mkimage-extra=--compress=xz`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
 
-if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=--compress=none)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --grub-mkimage-extra=--compress=none`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
diff --git a/tests/ehci_test.in b/tests/ehci_test.in
index b197f8cdc..64bd80070 100644
--- a/tests/ehci_test.in
+++ b/tests/ehci_test.in
@@ -41,7 +41,11 @@ echo "hello" > "$outfile"
 
 tar cf "$imgfile" "$outfile"
 
-if [ "$(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" | tail -n 1)" != "Hello World" ]; then
+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
    rm "$imgfile"
    rm "$outfile"
    exit 1
diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in
index 2d7dfc889..1bbe60ee5 100644
--- a/tests/fddboot_test.in
+++ b/tests/fddboot_test.in
@@ -46,6 +46,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-if [ "$(echo hello | "${grubshell}" --boot=fd --mkrescue-arg="--compress=xz --fonts= --locales= --themes= -no-pad")" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --boot=fd --mkrescue-arg="--compress=xz --fonts= --locales= --themes= -no-pad"`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in
index f7c9ca004..f9156691e 100644
--- a/tests/grub_cmd_date.in
+++ b/tests/grub_cmd_date.in
@@ -9,7 +9,8 @@ if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ];
 fi
 
 pdt="$(date -u +%s)"
-dt=`echo date | @builddir@/grub-shell | sed 's, [A-Z][a-z]*$,,'`
+dt=`echo date | @builddir@/grub-shell`
+dt=`echo "$dt" | sed 's, [A-Z][a-z]*$,,'`
 dtg="$(date -u -d "$dt" +%s)"
 ndt="$(date -u +%s)"
 
diff --git a/tests/grub_cmd_test.in b/tests/grub_cmd_test.in
index 3399eb292..dac6f7d6a 100644
--- a/tests/grub_cmd_test.in
+++ b/tests/grub_cmd_test.in
@@ -1,4 +1,5 @@
 #! @BUILD_SHEBANG@
+set -e
 
 # create a randome file
 empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
diff --git a/tests/grub_script_blockarg.in b/tests/grub_script_blockarg.in
index 6ea9b8c3d..6152cc141 100644
--- a/tests/grub_script_blockarg.in
+++ b/tests/grub_script_blockarg.in
@@ -1,4 +1,4 @@
-#! @BUILD_SHEBANG@
+#! @BUILD_SHEBANG@ -e
 
 # Run GRUB script in a Qemu instance
 # Copyright (C) 2010  Free Software Foundation, Inc.
diff --git a/tests/grub_script_expansion.in b/tests/grub_script_expansion.in
index 9d0dcdd29..98d5a9068 100644
--- a/tests/grub_script_expansion.in
+++ b/tests/grub_script_expansion.in
@@ -17,7 +17,8 @@ set -e
 # You should have received a copy of the GNU General Public License
 # along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 
-disks=`echo ls | @builddir@/grub-shell| grep -av '^Network protocols:$'| grep -av '^tftp http $'`
+disks=`echo ls | @builddir@/grub-shell`
+disks=`echo "$disks"| grep -av '^Network protocols:$'| grep -av '^tftp http $'`
 other=`echo insmod regexp\; echo \* | @builddir@/grub-shell`
 for d in $disks; do
     if echo "$d" |grep ',' >/dev/null; then
diff --git a/tests/gzcompress_test.in b/tests/gzcompress_test.in
index 42c8fe7c4..572b2a1a5 100644
--- a/tests/gzcompress_test.in
+++ b/tests/gzcompress_test.in
@@ -24,6 +24,7 @@ if ! which gzip >/dev/null 2>&1; then
    exit 77
 fi
 
-if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=gz)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --mkrescue-arg=--compress=gz`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
diff --git a/tests/hddboot_test.in b/tests/hddboot_test.in
index 6d70847a5..abe3e0ae1 100644
--- a/tests/hddboot_test.in
+++ b/tests/hddboot_test.in
@@ -31,7 +31,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-if [ "$(echo hello | "${grubshell}" --boot=hd)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --boot=hd`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
 
diff --git a/tests/lzocompress_test.in b/tests/lzocompress_test.in
index 4e5f7e078..8f08a8046 100644
--- a/tests/lzocompress_test.in
+++ b/tests/lzocompress_test.in
@@ -24,6 +24,7 @@ if ! which lzop >/dev/null 2>&1; then
    exit 77
 fi
 
-if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=lzo)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --mkrescue-arg=--compress=lzo`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
diff --git a/tests/netboot_test.in b/tests/netboot_test.in
index 9f71e3d88..6a1d95a22 100644
--- a/tests/netboot_test.in
+++ b/tests/netboot_test.in
@@ -40,6 +40,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-if [ "$(echo hello | "${grubshell}" --boot=net)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --boot=net`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
diff --git a/tests/ohci_test.in b/tests/ohci_test.in
index 8693f8c47..cc35f67a9 100644
--- a/tests/ohci_test.in
+++ b/tests/ohci_test.in
@@ -41,7 +41,11 @@ echo "hello" > "$outfile"
 
 tar cf "$imgfile" "$outfile"
 
-if [ "$(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" | tail -n 1)" != "Hello World" ]; then
+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
    rm "$imgfile"
    rm "$outfile"
    exit 1
diff --git a/tests/partmap_test.in b/tests/partmap_test.in
index 7353dc70e..5f18ab51c 100644
--- a/tests/partmap_test.in
+++ b/tests/partmap_test.in
@@ -58,8 +58,8 @@ list_parts () {
     shift
 
     echo ls | "${grubshell}" --disk="${imgfile}" \
-	--modules=$mod | tr -d "\n\r" > "${outfile}"
-    cat "${outfile}"
+	--modules=$mod > "${outfile}"
+    cat "${outfile}" | tr -d "\n\r"
     echo
 }
 
diff --git a/tests/pata_test.in b/tests/pata_test.in
index 4b18fdef3..3d19cecde 100644
--- a/tests/pata_test.in
+++ b/tests/pata_test.in
@@ -45,7 +45,8 @@ echo "hello" > "$outfile"
 
 tar cf "$imgfile" "$outfile"
 
-if [ "$(echo "nativedisk; source '($indisk)/$outfile';" | "${grubshell}" --qemu-opts="-$disk $imgfile")" != "Hello World" ]; then
+v=`echo "nativedisk; source '($indisk)/$outfile';" | "${grubshell}" --qemu-opts="-$disk $imgfile"`
+if [ "$v" != "Hello World" ]; then
    rm "$imgfile"
    rm "$outfile"
    exit 1
diff --git a/tests/test_sha512sum.in b/tests/test_sha512sum.in
index 027092a8b..d97b7ae2c 100644
--- a/tests/test_sha512sum.in
+++ b/tests/test_sha512sum.in
@@ -1,4 +1,5 @@
 #! @BUILD_SHEBANG@
+set -e
 
 # create a randome file
 file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
diff --git a/tests/uhci_test.in b/tests/uhci_test.in
index f0eec5032..6aab10ba6 100644
--- a/tests/uhci_test.in
+++ b/tests/uhci_test.in
@@ -41,7 +41,11 @@ echo "hello" > "$outfile"
 
 tar cf "$imgfile" "$outfile"
 
-if [ "$(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" | tail -n 1)" != "Hello World" ]; then
+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
    rm "$imgfile"
    rm "$outfile"
    exit 1
diff --git a/tests/xzcompress_test.in b/tests/xzcompress_test.in
index 03bfb5e95..61acba33b 100644
--- a/tests/xzcompress_test.in
+++ b/tests/xzcompress_test.in
@@ -24,6 +24,7 @@ if ! which xz >/dev/null 2>&1; then
    exit 77
 fi
 
-if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=xz)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --mkrescue-arg=--compress=xz`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/8] tests: Make setup errors in grub-fs-tester hard errors
  2021-03-15  2:20 [PATCH 0/8] Various fixes/improvements for tests Glenn Washburn
                   ` (3 preceding siblings ...)
  2021-03-15  2:20 ` [PATCH 4/8] tests: Fail immediately when grub-shell fails and do not occlude the error code Glenn Washburn
@ 2021-03-15  2:20 ` Glenn Washburn
  2021-03-15  2:20 ` [PATCH 6/8] tests: A failure of mktemp should cause the test script to exit with code 99 Glenn Washburn
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Glenn Washburn @ 2021-03-15  2:20 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn

When a test program fails because it failed to setup the test properly, this
does not indicate a failure in what is attempting to be tested because the
test is never run. So exit with a hard error exit status to note this
difference. This will allow easier detection of tests that are not actually
being run and those that are really failing.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 tests/util/grub-fs-tester.in | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in
index 4213b7bfc..eacb1e0a7 100644
--- a/tests/util/grub-fs-tester.in
+++ b/tests/util/grub-fs-tester.in
@@ -6,7 +6,8 @@ fs="$1"
 
 GRUBFSTEST="@builddir@/grub-fstest"
 
-tempdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
+tempdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` ||
+{ echo "Failed to make temporary directory"; exit 99; }
 
 # This wrapper is to ease insertion of valgrind or time statistics
 run_it () {
@@ -273,7 +274,7 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
 	    done
 	    if test "$CFILESRC" = "" ; then
 		echo "Couldn't find compressible file" >&2
-		exit 1
+		exit 99
 	    fi
 	    case x"$fs" in
 		    # FS LIMITATION: 8.3 names
@@ -616,7 +617,7 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
 		    mkdir -p "$MNTPOINTRO"
 		    for i in $(range 0 $((NDEVICES-1)) 1); do
 			dd if=/dev/zero of="$FSIMAGEP${i}.img" count=1 bs=1 seek=$((DISKSIZE-1)) &> /dev/null
-			LODEVICE=$(losetup --find --show "$FSIMAGEP${i}.img")
+			LODEVICE=$(losetup --find --show "$FSIMAGEP${i}.img") || exit 99
 			LODEVICES="$LODEVICES $LODEVICE"
 			if test "$i" = 0; then
 			    MOUNTDEVICE="$LODEVICE"
@@ -820,7 +821,7 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
 		    "mkfs.xfs" -m crc=1 -b size=$BLKSIZE -s size=$SECSIZE -L "$FSLABEL" -q "${MOUNTDEVICE}" ;;
 		*)
 		    echo "Add appropriate mkfs command here"
-		    exit 1
+		    exit 99
 		    ;;
 	    esac
 	    BASEFILE="1.img"
@@ -926,7 +927,7 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
 			for i in $(range 0 $((NDEVICES-1)) 1); do
 			    rm "$FSIMAGEP${i}.img"
 			done
-			exit 1;
+			exit 99;
 		    fi
 		    ;;
 	    esac
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/8] tests: A failure of mktemp should cause the test script to exit with code 99
  2021-03-15  2:20 [PATCH 0/8] Various fixes/improvements for tests Glenn Washburn
                   ` (4 preceding siblings ...)
  2021-03-15  2:20 ` [PATCH 5/8] tests: Make setup errors in grub-fs-tester hard errors Glenn Washburn
@ 2021-03-15  2:20 ` Glenn Washburn
  2021-03-15  2:20 ` [PATCH 7/8] tests: Exit with skipped exit code when test not performed Glenn Washburn
  2021-03-15  2:20 ` [PATCH 8/8] tests: Use @BUILD_SHEBANG@ autoconf var instead of literal shell Glenn Washburn
  7 siblings, 0 replies; 9+ messages in thread
From: Glenn Washburn @ 2021-03-15  2:20 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn

A test exiting with code 99 means that there was an error in the test itself
and not a failure in the thing being tested (also known as a hard error).

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 tests/ahci_test.in            | 4 ++--
 tests/ehci_test.in            | 4 ++--
 tests/gettext_strings_test.in | 2 +-
 tests/grub_cmd_test.in        | 6 +++---
 tests/grub_script_blockarg.in | 2 +-
 tests/ohci_test.in            | 4 ++--
 tests/partmap_test.in         | 4 ++--
 tests/pata_test.in            | 4 ++--
 tests/syslinux_test.in        | 2 +-
 tests/test_sha512sum.in       | 6 +++---
 tests/uhci_test.in            | 4 ++--
 11 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/tests/ahci_test.in b/tests/ahci_test.in
index 3fb7f54a2..eb83bebf8 100644
--- a/tests/ahci_test.in
+++ b/tests/ahci_test.in
@@ -34,8 +34,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
-outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 
 echo "hello" > "$outfile"
 
diff --git a/tests/ehci_test.in b/tests/ehci_test.in
index 64bd80070..da7652bd3 100644
--- a/tests/ehci_test.in
+++ b/tests/ehci_test.in
@@ -34,8 +34,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
-outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 
 echo "hello" > "$outfile"
 
diff --git a/tests/gettext_strings_test.in b/tests/gettext_strings_test.in
index 813999ebe..1c37fe41b 100644
--- a/tests/gettext_strings_test.in
+++ b/tests/gettext_strings_test.in
@@ -2,7 +2,7 @@
 
 cd '@srcdir@'
 
-tdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")"
+tdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")" || exit 99
 
 xgettext -f po/POTFILES.in -L C -o "$tdir/"skip.pot -x po/grub.pot --keyword=grub_util_info --keyword=grub_dprintf:1,2 --keyword=grub_register_command --keyword=grub_register_extcmd --keyword=grub_efiemu_resolve_symbol --keyword=grub_efiemu_register_symbol --keyword=grub_dl_load --keyword=grub_crypto_lookup_md_by_name --keyword=grub_crypto_lookup_cipher_by_name --keyword=grub_efiemu_resolve_symbol --keyword=alias --keyword=grub_ieee1275_get_property:2 --keyword=grub_ieee1275_find_device --keyword=grub_ieee1275_get_integer_property:2 --keyword=INIT_IEEE1275_COMMON:2  --keyword=grub_boot_time --keyword=grub_env_get --keyword=grub_env_set --keyword=grub_register_variable_hook --keyword=grub_fatal --keyword=__asm__ --keyword=volatile --keyword=__volatile__  --keyword=grub_error:2 --from-code=iso-8859-1
 xgettext -f po/POTFILES.in -L C -o "$tdir/"skip2.pot -x po/grub.pot --keyword=volatile:2 --keyword=__volatile__:2 --keyword=grub_dprintf:2 --from-code=iso-8859-1
diff --git a/tests/grub_cmd_test.in b/tests/grub_cmd_test.in
index dac6f7d6a..043c3a634 100644
--- a/tests/grub_cmd_test.in
+++ b/tests/grub_cmd_test.in
@@ -2,8 +2,8 @@
 set -e
 
 # create a randome file
-empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
-non_empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
+non_empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 cat >$non_empty <<EOF
 hello world!
 EOF
@@ -21,7 +21,7 @@ else
 fi
 
 
-outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 @builddir@/grub-shell --files=$grub_empty=$empty  --files=$grub_non_empty=$non_empty>$outfile <<EOF
 if ! test -f $grub_empty; then
   echo FAIL1
diff --git a/tests/grub_script_blockarg.in b/tests/grub_script_blockarg.in
index 6152cc141..6d63a345a 100644
--- a/tests/grub_script_blockarg.in
+++ b/tests/grub_script_blockarg.in
@@ -27,7 +27,7 @@ cmd='test_blockarg { true }'
 v=`echo "$cmd" | @builddir@/grub-shell`
 error_if_not "$v" '{ true }'
 
-tmp=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
+tmp=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 99
 cmd='test_blockarg { test_blockarg { true } }'
 echo "$cmd" | @builddir@/grub-shell >$tmp
 error_if_not "`head -n1 $tmp|tail -n1`" '{ test_blockarg { true } }'
diff --git a/tests/ohci_test.in b/tests/ohci_test.in
index cc35f67a9..c55aad4ad 100644
--- a/tests/ohci_test.in
+++ b/tests/ohci_test.in
@@ -34,8 +34,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
-outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 
 echo "hello" > "$outfile"
 
diff --git a/tests/partmap_test.in b/tests/partmap_test.in
index 5f18ab51c..7906db43d 100644
--- a/tests/partmap_test.in
+++ b/tests/partmap_test.in
@@ -101,8 +101,8 @@ if ! which parted >/dev/null 2>&1; then
    exit 77
 fi
 
-imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
-outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 
 #
 # MSDOS partition types
diff --git a/tests/pata_test.in b/tests/pata_test.in
index 3d19cecde..0db4778d7 100644
--- a/tests/pata_test.in
+++ b/tests/pata_test.in
@@ -38,8 +38,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	;;
 esac
 
-imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
-outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 
 echo "hello" > "$outfile"
 
diff --git a/tests/syslinux_test.in b/tests/syslinux_test.in
index 4ea86390e..44d3cdf7a 100644
--- a/tests/syslinux_test.in
+++ b/tests/syslinux_test.in
@@ -2,7 +2,7 @@
 
 set -e
 
-outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 
 "@builddir@/grub-syslinux2cfg" -r "@abs_top_srcdir@/tests/syslinux/ubuntu10.04" "@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg" -o "$outfile"
 
diff --git a/tests/test_sha512sum.in b/tests/test_sha512sum.in
index d97b7ae2c..b2bd89609 100644
--- a/tests/test_sha512sum.in
+++ b/tests/test_sha512sum.in
@@ -2,7 +2,7 @@
 set -e
 
 # create a randome file
-file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 cat >$file <<EOF
 hello world!
 EOF
@@ -16,12 +16,12 @@ else
 fi
 
 
-outfile1="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+outfile1="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 @builddir@/grub-shell --files=/boot/grub/file=$file >$outfile1 <<EOF
 sha512sum $grub_file
 EOF
 
-outfile2="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+outfile2="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 sha512sum $file >$outfile2
 
 SHA1=`cat $outfile1 | tr -d '\n' | cut -f1 -d\ `
diff --git a/tests/uhci_test.in b/tests/uhci_test.in
index 6aab10ba6..193129687 100644
--- a/tests/uhci_test.in
+++ b/tests/uhci_test.in
@@ -34,8 +34,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
-outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
+imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
 
 echo "hello" > "$outfile"
 
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/8] tests: Exit with skipped exit code when test not performed
  2021-03-15  2:20 [PATCH 0/8] Various fixes/improvements for tests Glenn Washburn
                   ` (5 preceding siblings ...)
  2021-03-15  2:20 ` [PATCH 6/8] tests: A failure of mktemp should cause the test script to exit with code 99 Glenn Washburn
@ 2021-03-15  2:20 ` Glenn Washburn
  2021-03-15  2:20 ` [PATCH 8/8] tests: Use @BUILD_SHEBANG@ autoconf var instead of literal shell Glenn Washburn
  7 siblings, 0 replies; 9+ messages in thread
From: Glenn Washburn @ 2021-03-15  2:20 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn

These tests were not performed and therefore did not pass, nor fail. This
fixes misleading test exit code where, for instance, the pseries_test will
pass on i386-pc, which is not a pseries architecture.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 tests/ahci_test.in          |  8 ++++----
 tests/cdboot_test.in        |  8 ++++----
 tests/core_compress_test.in |  2 +-
 tests/ehci_test.in          |  8 ++++----
 tests/fddboot_test.in       | 16 ++++++++--------
 tests/grub_cmd_date.in      |  2 +-
 tests/grub_cmd_set_date.in  |  6 +++---
 tests/hddboot_test.in       |  6 +++---
 tests/netboot_test.in       | 12 ++++++------
 tests/ohci_test.in          |  8 ++++----
 tests/partmap_test.in       |  8 ++++----
 tests/pata_test.in          |  6 +++---
 tests/pseries_test.in       |  2 +-
 tests/uhci_test.in          |  8 ++++----
 14 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/tests/ahci_test.in b/tests/ahci_test.in
index eb83bebf8..683405b01 100644
--- a/tests/ahci_test.in
+++ b/tests/ahci_test.in
@@ -22,16 +22,16 @@ grubshell=@builddir@/grub-shell
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # PLATFORM: Don't mess with real devices when OS is active
     *-emu)
-	exit 0;;
+	exit 77;;
     # FIXME: qemu gets bonito DMA wrong
     mipsel-loongson)
-	exit 0;;
+	exit 77;;
     # PLATFORM: no AHCI on ARC and qemu-mips platforms
     mips*-arc | mips*-qemu_mips)
-	exit 0;;
+	exit 77;;
     # FIXME: No native drivers are available for those
     powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi)
-	exit 0;;
+	exit 77;;
 esac
 
 imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in
index 7229f79fb..c0a5212ff 100644
--- a/tests/cdboot_test.in
+++ b/tests/cdboot_test.in
@@ -22,16 +22,16 @@ grubshell=@builddir@/grub-shell
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # PLATFORM: emu is different
     *-emu)
-	exit 0;;
+	exit 77;;
     # PLATFORM: Flash targets
     i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
-	exit 0;;
+	exit 77;;
     # FIXME: currently grub-shell uses only -kernel for loongson
     mipsel-loongson)
-	exit 0;;
+	exit 77;;
     # FIXME: OFW fails to open CD-ROM
     i386-ieee1275)
-	exit 0;;
+	exit 77;;
 esac
 
 v=`echo hello | "${grubshell}" --boot=cd`
diff --git a/tests/core_compress_test.in b/tests/core_compress_test.in
index 90dd00607..72d2eca7d 100644
--- a/tests/core_compress_test.in
+++ b/tests/core_compress_test.in
@@ -22,7 +22,7 @@ grubshell=@builddir@/grub-shell
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # FIXME: Only mips currently supports configurable core compression
     *-emu | i386-* | x86_64-* | sparc64-* | ia64-*)
-	exit 0
+	exit 77
 	;;
 esac
 
diff --git a/tests/ehci_test.in b/tests/ehci_test.in
index da7652bd3..bd80f93d4 100644
--- a/tests/ehci_test.in
+++ b/tests/ehci_test.in
@@ -22,16 +22,16 @@ grubshell=@builddir@/grub-shell
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # PLATFORM: Don't mess with real devices when OS is active
     *-emu)
-	exit 0;;
+	exit 77;;
     # FIXME: qemu gets bonito DMA wrong
     mipsel-loongson)
-	exit 0;;
+	exit 77;;
     # PLATFORM: no USB on ARC and qemu-mips platforms
     mips*-arc | mips*-qemu_mips)
-	exit 0;;
+	exit 77;;
     # FIXME: No native drivers are available for those
     powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi)
-	exit 0;;
+	exit 77;;
 esac
 
 imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in
index 1bbe60ee5..5348ac56b 100644
--- a/tests/fddboot_test.in
+++ b/tests/fddboot_test.in
@@ -22,28 +22,28 @@ grubshell=@builddir@/grub-shell
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # PLATFORM: emu is different
     *-emu)
-	exit 0;;
+	exit 77;;
     # PLATFORM: Flash targets
     i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
-	exit 0;;
+	exit 77;;
     # FIXME: currently grub-shell uses only -kernel for loongson
     mipsel-loongson)
-	exit 0;;
+	exit 77;;
     # FIXME: We don't support EFI floppy boot in grub-mkrescue
     *-efi)
-	exit 0;;
+	exit 77;;
     # FIXME: no floppy support
     i386-multiboot)
-	exit 0;;
+	exit 77;;
     # FIXME: QEMU firmware crashes when trying to boot from floppy
     sparc64-ieee1275)
-	exit 0;;
+	exit 77;;
     # FIXME: QEMU doesn't emulate SCSI floppies
     mipsel-arc | mips-arc)
-	exit 0;;
+	exit 77;;
     # PLATFORM: powerpc doesn't boot from floppy except OldWorld Macs which we don't support anyway
     powerpc-ieee1275)
-	exit 0;;
+	exit 77;;
 esac
 
 v=`echo hello | "${grubshell}" --boot=fd --mkrescue-arg="--compress=xz --fonts= --locales= --themes= -no-pad"`
diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in
index f9156691e..409cb684a 100644
--- a/tests/grub_cmd_date.in
+++ b/tests/grub_cmd_date.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
 
 pdt="$(date -u +%s)"
diff --git a/tests/grub_cmd_set_date.in b/tests/grub_cmd_set_date.in
index aac120a6c..17673cd8a 100644
--- a/tests/grub_cmd_set_date.in
+++ b/tests/grub_cmd_set_date.in
@@ -6,15 +6,15 @@ set -e
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # FIXME: OpenBIOS on sparc64 doesn't implement RTC
     sparc64-ieee1275)
-	exit 0;;
+	exit 77;;
     # PLATFORM: ARC doesn't provide any way to set time
     *-arc)
-	exit 0;;
+	exit 77;;
     # PLATFORM: EMU doesn't provide any way to set time
     # Even if it did we'd need some kind of sandbox to avoid
     # modifying real system time.
     *-emu)
-	exit 0;;
+	exit 77;;
 esac
 
 out=$(cat <<EOF | @builddir@/grub-shell
diff --git a/tests/hddboot_test.in b/tests/hddboot_test.in
index abe3e0ae1..110c70950 100644
--- a/tests/hddboot_test.in
+++ b/tests/hddboot_test.in
@@ -22,13 +22,13 @@ grubshell=@builddir@/grub-shell
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # PLATFORM: emu is different
     *-emu)
-	exit 0;;
+	exit 77;;
     # PLATFORM: Flash targets
     i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
-	exit 0;;
+	exit 77;;
     # FIXME: currently grub-shell uses only -kernel for loongson
     mipsel-loongson)
-	exit 0;;
+	exit 77;;
 esac
 
 v=`echo hello | "${grubshell}" --boot=hd`
diff --git a/tests/netboot_test.in b/tests/netboot_test.in
index 6a1d95a22..e0b2c9d25 100644
--- a/tests/netboot_test.in
+++ b/tests/netboot_test.in
@@ -22,22 +22,22 @@ grubshell=@builddir@/grub-shell
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # PLATFORM: emu is different
     *-emu)
-	exit 0;;
+	exit 77;;
     # PLATFORM: Flash targets
     i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
-	exit 0;;
+	exit 77;;
     # FIXME: currently grub-shell uses only -kernel for loongson
     mipsel-loongson)
-	exit 0;;
+	exit 77;;
     # FIXME: no rtl8139 support
     i386-multiboot)
-	exit 0;;
+	exit 77;;
     # FIXME: We don't fully support netboot on ARC
     *-arc)
-	exit 0;;
+	exit 77;;
     # FIXME: Many QEMU firmware have no netboot capability
     *-efi | i386-ieee1275 | powerpc-ieee1275 | sparc64-ieee1275)
-	exit 0;;
+	exit 77;;
 esac
 
 v=`echo hello | "${grubshell}" --boot=net`
diff --git a/tests/ohci_test.in b/tests/ohci_test.in
index c55aad4ad..105220856 100644
--- a/tests/ohci_test.in
+++ b/tests/ohci_test.in
@@ -22,16 +22,16 @@ grubshell=@builddir@/grub-shell
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # PLATFORM: Don't mess with real devices when OS is active
     *-emu)
-	exit 0;;
+	exit 77;;
     # FIXME: qemu gets bonito DMA wrong
     mipsel-loongson)
-	exit 0;;
+	exit 77;;
     # PLATFORM: no USB on ARC and qemu-mips platforms
     mips*-arc | mips*-qemu_mips)
-	exit 0;;
+	exit 77;;
     # FIXME: No native drivers are available for those
     powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi)
-	exit 0;;
+	exit 77;;
 esac
 
 imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
diff --git a/tests/partmap_test.in b/tests/partmap_test.in
index 7906db43d..e72af9ce4 100644
--- a/tests/partmap_test.in
+++ b/tests/partmap_test.in
@@ -70,21 +70,21 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     powerpc-ieee1275)
 	disk=ieee1275//pci@80000000/mac-io@4/ata-3@20000/disk@0
 	# FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
-	exit 0
+	exit 77
 	;;
     sparc64-ieee1275)
 	disk=ieee1275//pci@1fe\,0/pci-ata@5/ide0@500/disk@0
 	# FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
-	exit 0
+	exit 77
 	;;
     i386-ieee1275)
 	disk=ieee1275/d
 	# FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
-	exit 0
+	exit 77
 	;;
     mips-arc)
 	# FIXME: ARC firmware has bugs which prevent it from accessing hard disk w/o dvh disklabel.
-	exit 0 ;;
+	exit 77 ;;
     mipsel-arc)
 	disk=arc/scsi0/disk0/rdisk0
 	;;
diff --git a/tests/pata_test.in b/tests/pata_test.in
index 0db4778d7..4a9c68ae4 100644
--- a/tests/pata_test.in
+++ b/tests/pata_test.in
@@ -25,13 +25,13 @@ indisk=ata0
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # PLATFORM: Don't mess with real devices when OS is active
     *-emu)
-	exit 0;;
+	exit 77;;
     # PLATFORM: no ATA on ARC platforms (they use SCSI)
     *-arc)
-	exit 0;;
+	exit 77;;
     # FIXME: No native drivers are available for those
     powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi)
-	exit 0;;
+	exit 77;;
     i386-ieee1275)
 	disk=hdb
 	indisk=ata1
diff --git a/tests/pseries_test.in b/tests/pseries_test.in
index 655eb4f3a..9b4090cf5 100644
--- a/tests/pseries_test.in
+++ b/tests/pseries_test.in
@@ -20,7 +20,7 @@ grubshell=@builddir@/grub-shell
 . "@builddir@/grub-core/modinfo.sh"
 
 if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" != powerpc-ieee1275 ]; then
-   exit 0
+   exit 77
 fi
 
 if [ "$(echo hello | "${grubshell}" --pseries --timeout=180 --boot=cd)" != "Hello World" ]; then
diff --git a/tests/uhci_test.in b/tests/uhci_test.in
index 193129687..2984283c0 100644
--- a/tests/uhci_test.in
+++ b/tests/uhci_test.in
@@ -22,16 +22,16 @@ grubshell=@builddir@/grub-shell
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # PLATFORM: Don't mess with real devices when OS is active
     *-emu)
-	exit 0;;
+	exit 77;;
     # FIXME: qemu gets bonito DMA wrong
     mipsel-loongson)
-	exit 0;;
+	exit 77;;
     # PLATFORM: no USB on ARC and qemu-mips platforms
     mips*-arc | mips*-qemu_mips)
-	exit 0;;
+	exit 77;;
     # FIXME: No native drivers are available for those
     powerpc-ieee1275 | sparc64-ieee1275 | arm*-efi)
-	exit 0;;
+	exit 77;;
 esac
 
 imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 8/8] tests: Use @BUILD_SHEBANG@ autoconf var instead of literal shell
  2021-03-15  2:20 [PATCH 0/8] Various fixes/improvements for tests Glenn Washburn
                   ` (6 preceding siblings ...)
  2021-03-15  2:20 ` [PATCH 7/8] tests: Exit with skipped exit code when test not performed Glenn Washburn
@ 2021-03-15  2:20 ` Glenn Washburn
  7 siblings, 0 replies; 9+ messages in thread
From: Glenn Washburn @ 2021-03-15  2:20 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper; +Cc: Glenn Washburn

This bring this test in line with the rest of the test scripts.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 tests/f2fs_test.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/f2fs_test.in b/tests/f2fs_test.in
index 1ea77c826..8c415db61 100644
--- a/tests/f2fs_test.in
+++ b/tests/f2fs_test.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@BUILD_SHEBANG@
 
 set -e
 
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-03-15  2:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15  2:20 [PATCH 0/8] Various fixes/improvements for tests Glenn Washburn
2021-03-15  2:20 ` [PATCH 1/8] tests: Make sure LANG is set properly for iso9660_test Glenn Washburn
2021-03-15  2:20 ` [PATCH 2/8] tests: Fix partmap_test for arm*-efi, disk numbering has changed Glenn Washburn
2021-03-15  2:20 ` [PATCH 3/8] tests: When checking squashfs fstime, use superblock last modified time Glenn Washburn
2021-03-15  2:20 ` [PATCH 4/8] tests: Fail immediately when grub-shell fails and do not occlude the error code Glenn Washburn
2021-03-15  2:20 ` [PATCH 5/8] tests: Make setup errors in grub-fs-tester hard errors Glenn Washburn
2021-03-15  2:20 ` [PATCH 6/8] tests: A failure of mktemp should cause the test script to exit with code 99 Glenn Washburn
2021-03-15  2:20 ` [PATCH 7/8] tests: Exit with skipped exit code when test not performed Glenn Washburn
2021-03-15  2:20 ` [PATCH 8/8] tests: Use @BUILD_SHEBANG@ autoconf var instead of literal shell Glenn Washburn

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.