]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
tests: Skip tests if required tools are not available
authorLeo Sandoval <lsandova@redhat.com>
Fri, 19 Sep 2025 21:45:03 +0000 (15:45 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 6 Nov 2025 18:27:06 +0000 (19:27 +0100)
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>
29 files changed:
tests/btrfs_test.in
tests/cpio_test.in
tests/erofs_test.in
tests/exfat_test.in
tests/ext234_test.in
tests/f2fs_test.in
tests/fat_test.in
tests/grub_cmd_cryptomount.in
tests/gzcompress_test.in
tests/hfs_test.in
tests/hfsplus_test.in
tests/iso9660_test.in
tests/jfs_test.in
tests/luks1_test.in
tests/luks2_test.in
tests/lzocompress_test.in
tests/minixfs_test.in
tests/nilfs2_test.in
tests/ntfs_test.in
tests/partmap_test.in
tests/reiserfs_test.in
tests/romfs_test.in
tests/squashfs_test.in
tests/tar_test.in
tests/tpm2_key_protector_test.in
tests/udf_test.in
tests/xfs_test.in
tests/xzcompress_test.in
tests/zfs_test.in

index 0d098c9a27bc6e58c82af16a71f221312579b12d..a07d2e5d18cd2a22bcebaa80579cdbe1ec250f54 100644 (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
index e2e668cf6be1d7fece8e46c4ce128600f5d4d9cf..5742cf17b9d8f587d00590d481f0a00aaf6cada8 100644 (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
index 51111627acec7096366fa80579c6b31291d7313f..436468dac6f51016962a511b956b05689795631e 100644 (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
index 7939f25d2728979b3afa09e57c0c3d05b342ea3e..7acde1977eba0fb708537186f7ea002150cecb97 100644 (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
index 4df696710d283a709f1f1993d131182d866a09a6..c9a8c1056a1056fc4a90c6885762e2f37d885991 100644 (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
index 85f8cc8bc391472b961924271ad358c1c9fc912c..a020a0f96d80d1d537529de9ef1ca9a650c6b2a5 100644 (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
 
 
index 8a2b37c5c676c4c9505e493a69eea1e94c8fdad8..77e3f16c67396974200ff0166e28816dba946881 100644 (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
index eaa187efad0acc277ca41027af65571099e4e54b..25d7d8c3687fe066af02ea897a3ab84cf33d2c48 100644 (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"'
index 8e7e6a63351c39d2c281f009d0c264569a521dc3..d7a594bb2c3b8c3608a4502cb54300c051e5a89c 100644 (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)
index 960f1cbd0f4215e02d5beba2b21b4b574262c2e3..c916b9bac955e7e19f5f58e1627898433dda90c6 100644 (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
index f727cf0e2e209ac6bf63d472f067d07943b4b174..cb36a3661c4fb3ba5f61965c30fe5787c3447704 100644 (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
index a1f752adfaff9452fedeb6e5f7d3ef5a50b8c275..793664c87426ae0dc4e3bfe40f493868ed24743f 100644 (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
index d13780e230c35245d7b4046b222d06d4abb019b9..86f9ebeaa048d3f2ea2956ea2426103e92207341 100644 (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
index cd28fd7149caba47db6bc2b5db7bd39c48ae6cae..0bfb53c98c654cb73e8d180862b0ca05e21c47a5 100644 (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
index 6a26ba6266c05aee57adc43564f2fdaf816e1e30..49db47380eb6037462f77c9a56d03051e9527111 100644 (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
index 915f74bd9f567c54b21d9cf6d4cd106c890fb3da..42e270df02643c8ecc2e0217ed621c4203a6185b 100644 (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)
index c62f56c8b44af5c60f7c7593090343cb340f8c73..78577fec8c5ea8272733abcb2836145a4f6d7590 100644 (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
index 8cc93754cd64eb2d153462cb527540ee83739ff5..719972f53f1aeb63bddb0b9540967737418fff62 100644 (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
index c2b08d27f892018ad2320fe9dbc9d18088ef7452..da73c59f9e179f71e709fd8d05a3a376e33058fb 100644 (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
index 4138e88fe94bd6c14bb25ce0e3157ebc9810b56b..9810cc1accae48acec523fb5e2aac948cae0dcc1 100644 (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
index 37226c01b7630c83b1d06ff62885f541f45e7fd7..36e34c3050cb82e464b6df25f91f222cbc57dd42 100644 (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
index f968e9b7dbd2c40cd103e7eaf528b977404c2d8f..98bb50c324b6e8cd1163c772a78271b64768ae57 100644 (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
index 15e70218f2dd4636b9f251e1f343173979e64e63..2f044f95d99b2ee7a6ddf1d2b2e54be3944f235f 100644 (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
index 97944b2433768b0515527a7cad13b63f82938509..6e2f2de8b7ff78ca84401213dadd011a0b65f281 100644 (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
index 5dd86d6ee19d0f99240a200f7ac0a965bcedadf9..6dbd697876d946f2d5442c52e2706e24aad8d929 100644 (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
index 302b28ab26afebe7562c45e04f6500c98279b5fd..8968fb1033c5d6c33475b4723f830d1177aad388 100644 (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
index 5e029c18278e341c0b0eb11303d909febaa6bdc9..8a648aa4a757080ebeb9e2aacb5ba49cfcd056f2 100644 (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
 
 
index 6ef73e41e8cc17ae4cb5c44d5a2cf13fb83b7f62..cfc6ccba66352c5c37d026f0f354b7902a14db17 100644 (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)
index 0d0a57f7d024f4dd05086177f57360ddbf8225e7..c8bb7937fe8caea50458afdb58eaa4dcb480743e 100644 (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