tests: Skip tests if required tools are not available

There is no reason to fail a test if the required testing tool is not
present on the system, so skip the test instead of failing it.

Signed-off-by: Leo Sandoval <lsandova@redhat.com>
Reviewed-by: Andrew Hamilton <adhamilt@gmail.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Leo Sandoval 2025-09-19 15:45:03 -06:00 committed by Daniel Kiper
parent d9b7b23d2d
commit bf13fed5fe
29 changed files with 36 additions and 36 deletions

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.btrfs >/dev/null 2>&1; then
echo "mkfs.btrfs not installed; cannot test btrfs."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" btrfs

View File

@ -4,7 +4,7 @@ set -e
if ! which cpio >/dev/null 2>&1; then
echo "cpio not installed; cannot test cpio."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" cpio_bin

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.erofs >/dev/null 2>&1; then
echo "mkfs.erofs not installed; cannot test erofs."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" erofs_compact

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.exfat >/dev/null 2>&1; then
echo "mkfs.exfat not installed; cannot test exFAT."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" exfat

View File

@ -12,17 +12,17 @@ fi
if ! which mkfs.ext2 >/dev/null 2>&1; then
echo "mkfs.ext2 not installed; cannot test ext2."
exit 99
exit 77
fi
if ! which mkfs.ext3 >/dev/null 2>&1; then
echo "mkfs.ext3 not installed; cannot test ext3."
exit 99
exit 77
fi
if ! which mkfs.ext4 >/dev/null 2>&1; then
echo "mkfs.ext4 not installed; cannot test ext4."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" ext2_old

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.f2fs >/dev/null 2>&1; then
echo "mkfs.f2fs not installed; cannot test f2fs."
exit 99
exit 77
fi

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.vfat >/dev/null 2>&1; then
echo "mkfs.vfat not installed; cannot test FAT."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" vfat16a

View File

@ -27,12 +27,12 @@ fi
if ! which cryptsetup >/dev/null 2>&1; then
echo "cryptsetup not installed; cannot test cryptomount."
exit 99
exit 77
fi
if ! which mkfs.vfat >/dev/null 2>&1; then
echo "mkfs.vfat not installed; cannot test cryptomount."
exit 99
exit 77
fi
COMMON_OPTS='${V:+--debug=$V} --cs-opts="--pbkdf-force-iterations 1000"'

View File

@ -21,7 +21,7 @@ grubshell=@builddir@/grub-shell
if ! which gzip >/dev/null 2>&1; then
echo "gzip not installed; cannot test gzip compression."
exit 99
exit 77
fi
v=$(echo hello | "${grubshell}" --mkrescue-arg=--compress=gz)

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.hfs >/dev/null 2>&1; then
echo "mkfs.hfs not installed; cannot test HFS."
exit 99
exit 77
fi
if ! grep -q mac_roman /proc/modules && ! modprobe mac_roman; then

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.hfsplus >/dev/null 2>&1; then
echo "mkfs.hfsplus not installed; cannot test hfsplus."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" hfsplus

View File

@ -4,7 +4,7 @@ set -e
if ! which xorriso >/dev/null 2>&1; then
echo "xorriso not installed; cannot test iso9660."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" joliet

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.jfs >/dev/null 2>&1; then
echo "mkfs.jfs not installed; cannot test JFS."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" jfs

View File

@ -12,12 +12,12 @@ fi
if ! which mkfs.ext2 >/dev/null 2>&1; then
echo "mkfs.ext2 not installed; cannot test luks."
exit 99
exit 77
fi
if ! which cryptsetup >/dev/null 2>&1; then
echo "cryptsetup not installed; cannot test luks."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" luks1

View File

@ -12,12 +12,12 @@ fi
if ! which mkfs.ext2 >/dev/null 2>&1; then
echo "mkfs.ext2 not installed; cannot test luks2."
exit 99
exit 77
fi
if ! which cryptsetup >/dev/null 2>&1; then
echo "cryptsetup not installed; cannot test luks2."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" luks2

View File

@ -21,7 +21,7 @@ grubshell=@builddir@/grub-shell
if ! which lzop >/dev/null 2>&1; then
echo "lzop not installed; cannot test lzo compression."
exit 99
exit 77
fi
v=$(echo hello | "${grubshell}" --mkrescue-arg=--compress=lzo)

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.minix >/dev/null 2>&1; then
echo "mkfs.minix not installed; cannot test minixfs."
exit 99
exit 77
fi
if ! mkfs.minix -h | grep -- -v > /dev/null; then

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.nilfs2 >/dev/null 2>&1; then
echo "mkfs.nilfs2 not installed; cannot test nilfs2."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" nilfs2

View File

@ -12,12 +12,12 @@ fi
if ! which mkfs.ntfs >/dev/null 2>&1; then
echo "mkfs.ntfs not installed; cannot test ntfs."
exit 99
exit 77
fi
if ! which setfattr >/dev/null 2>&1; then
echo "setfattr not installed; cannot test ntfs."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" ntfs

View File

@ -100,7 +100,7 @@ esac
if ! which ${parted} >/dev/null 2>&1; then
echo "${parted} not installed; cannot test partmap"
exit 99
exit 77
fi
imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.reiserfs >/dev/null 2>&1; then
echo "mkfs.reiserfs not installed; cannot test reiserfs."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" reiserfs

View File

@ -4,7 +4,7 @@ set -e
if ! which genromfs >/dev/null 2>&1; then
echo "genromfs not installed; cannot test romfs."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" romfs

View File

@ -4,7 +4,7 @@ set -e
if ! which mksquashfs >/dev/null 2>&1; then
echo "mksquashfs not installed; cannot test squashfs."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" squash4_gzip

View File

@ -4,7 +4,7 @@ set -e
if ! which tar >/dev/null 2>&1; then
echo "tar not installed; cannot test tar."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" tarfs

View File

@ -41,7 +41,7 @@ fi
if ! command -v cryptsetup >/dev/null 2>&1; then
echo "cryptsetup not installed; cannot test tpm2."
exit 99
exit 77
fi
if ! grep -q tpm_vtpm_proxy /proc/modules && ! modprobe tpm_vtpm_proxy; then
@ -51,7 +51,7 @@ fi
if ! command -v swtpm >/dev/null 2>&1; then
echo "swtpm not installed; cannot test tpm2."
exit 99
exit 77
fi
if ! command -v tpm2_startup >/dev/null 2>&1; then

View File

@ -12,7 +12,7 @@ fi
if ! which mkudffs >/dev/null 2>&1; then
echo "mkudffs not installed; cannot test UDF."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" udf

View File

@ -12,7 +12,7 @@ fi
if ! which mkfs.xfs >/dev/null 2>&1; then
echo "mkfs.xfs not installed; cannot test xfs."
exit 99
exit 77
fi

View File

@ -21,7 +21,7 @@ grubshell=@builddir@/grub-shell
if ! which xz >/dev/null 2>&1; then
echo "xz not installed; cannot test xz compression."
exit 99
exit 77
fi
v=$(echo hello | "${grubshell}" --mkrescue-arg=--compress=xz)

View File

@ -12,7 +12,7 @@ fi
if ! which zpool >/dev/null 2>&1; then
echo "zpool not installed; cannot test zfs."
exit 99
exit 77
fi
"@builddir@/grub-fs-tester" zfs