Various fixes/improvements for tests
cover Various fixes/improvements for tests
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(-)
Signature · 1 line
2.27.0
PATCH 1/8 tests: Make sure LANG is set properly for iso9660_test
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.
--- tests/iso9660_test.in | 6 ++++++ 1 file changed, 6 insertions(+)
tests/iso9660_test.in +6 -0
@@ -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
Signature · 1 line
2.27.0
PATCH 2/8 tests: Fix partmap_test for arm*-efi, disk numbering has changed
In reply to Glenn WashburnPerhaps using a newer UEFI firmware is the reason for the created test disk showing up as hd2 instead of hd3.
--- tests/partmap_test.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/partmap_test.in +1 -1
@@ -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
Signature · 1 line
2.27.0
PATCH 3/8 tests: When checking squashfs fstime, use superblock last modified time
In reply to Glenn WashburnCurrently, 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.
--- tests/util/grub-fs-tester.in | 6 ++++++ 1 file changed, 6 insertions(+)
tests/util/grub-fs-tester.in +6 -0
@@ -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
Signature · 1 line
2.27.0
PATCH 4/8 tests: Fail immediately when grub-shell fails and do not occlude the error code
In reply to Glenn WashburnIf 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.
--- 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(-)
tests/ahci_test.in +5 -1
@@ -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
tests/cdboot_test.in +2 -1
@@ -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
tests/core_compress_test.in +4 -2
@@ -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
tests/ehci_test.in +5 -1
@@ -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
tests/fddboot_test.in +2 -1
@@ -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
tests/grub_cmd_date.in +2 -1
@@ -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)"
tests/grub_cmd_test.in +1 -0
@@ -1,4 +1,5 @@ #! @BUILD_SHEBANG@ +set -e # create a randome file empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
tests/grub_script_blockarg.in +1 -1
@@ -1,4 +1,4 @@ -#! @BUILD_SHEBANG@ +#! @BUILD_SHEBANG@ -e # Run GRUB script in a Qemu instance # Copyright (C) 2010 Free Software Foundation, Inc.
tests/grub_script_expansion.in +2 -1
@@ -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
tests/gzcompress_test.in +2 -1
@@ -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
tests/hddboot_test.in +2 -1
@@ -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
tests/lzocompress_test.in +2 -1
@@ -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
tests/netboot_test.in +2 -1
@@ -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
tests/ohci_test.in +5 -1
@@ -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
tests/partmap_test.in +2 -2
@@ -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 }
tests/pata_test.in +2 -1
@@ -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
tests/test_sha512sum.in +1 -0
@@ -1,4 +1,5 @@ #! @BUILD_SHEBANG@ +set -e # create a randome file file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
tests/uhci_test.in +5 -1
@@ -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
tests/xzcompress_test.in +2 -1
@@ -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
Signature · 1 line
2.27.0
PATCH 5/8 tests: Make setup errors in grub-fs-tester hard errors
In reply to Glenn WashburnWhen 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.
--- tests/util/grub-fs-tester.in | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
tests/util/grub-fs-tester.in +6 -5
@@ -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
Signature · 1 line
2.27.0
PATCH 6/8 tests: A failure of mktemp should cause the test script to exit with code 99
In reply to Glenn WashburnA 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).
--- 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(-)
tests/ahci_test.in +2 -2
@@ -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"
tests/ehci_test.in +2 -2
@@ -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"
tests/gettext_strings_test.in +1 -1
@@ -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
tests/grub_cmd_test.in +3 -3
@@ -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
tests/grub_script_blockarg.in +1 -1
@@ -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 } }'
tests/ohci_test.in +2 -2
@@ -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"
tests/partmap_test.in +2 -2
@@ -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
tests/pata_test.in +2 -2
@@ -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"
tests/syslinux_test.in +1 -1
@@ -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"
tests/test_sha512sum.in +3 -3
@@ -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\ `
tests/uhci_test.in +2 -2
@@ -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"
Signature · 1 line
2.27.0
PATCH 7/8 tests: Exit with skipped exit code when test not performed
In reply to Glenn WashburnThese 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.
--- 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(-)
tests/ahci_test.in +4 -4
@@ -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
tests/cdboot_test.in +4 -4
@@ -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`
tests/core_compress_test.in +1 -1
@@ -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
tests/ehci_test.in +4 -4
@@ -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
tests/fddboot_test.in +8 -8
@@ -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"`
tests/grub_cmd_date.in +1 -1
@@ -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)"
tests/grub_cmd_set_date.in +3 -3
@@ -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
tests/hddboot_test.in +3 -3
@@ -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`
tests/netboot_test.in +6 -6
@@ -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`
tests/ohci_test.in +4 -4
@@ -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
tests/partmap_test.in +4 -4
@@ -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 ;;
tests/pata_test.in +3 -3
@@ -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
tests/pseries_test.in +1 -1
@@ -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
tests/uhci_test.in +4 -4
@@ -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
Signature · 1 line
2.27.0
PATCH 8/8 tests: Use @BUILD_SHEBANG@ autoconf var instead of literal shell
In reply to Glenn WashburnThis bring this test in line with the rest of the test scripts.
--- tests/f2fs_test.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/f2fs_test.in +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!@BUILD_SHEBANG@ set -e
Signature · 1 line
2.27.0