[parted-devel] [PATCH] tests/t3000: Check for hfs and vfat support separately

Brian C. Lane bcl at redhat.com
Thu Jul 15 17:59:37 BST 2021


Previously the whole test would be skipped if either mkfs.hfs or
mkfs.vfat were not installed, leading to missing test coverage. This
change checks for them individually so that the test will run with
either or both of them installed
---
 tests/t3000-resize-fs.sh | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
index 1f2e46e..282b6fc 100755
--- a/tests/t3000-resize-fs.sh
+++ b/tests/t3000-resize-fs.sh
@@ -17,12 +17,22 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/init.sh"; path_prepend_ ../parted .
-require_hfs_
-require_fat_
 require_root_
 require_scsi_debug_module_
 require_512_byte_sector_size_
 
+
+FSTYPES=""
+
+# Is mkfs.hfs available?
+mkfs.hfs 2>&1 | grep '^usage:' && FSTYPES="hfs+"
+
+# Is mkfs.vfat available?
+mkfs.vfat 2>&1 | grep '^Usage:' && FSTYPES="$FSTYPES fat32 fat16"
+
+[ -n "$FSTYPES" ] || skip_ "Neither mkfs.hfs nor mkfs.vfat installed"
+
+
 ss=$sector_size_
 
 start=63s
@@ -53,7 +63,7 @@ mkdir "$mount_point" || fail=1
 # be sure to unmount upon interrupt, failure, etc.
 cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; }
 
-for fs_type in hfs+ fat32 fat16; do
+for fs_type in $FSTYPES; do
   echo "fs_type=$fs_type"
 
   # create an empty $fs_type partition, cylinder aligned, size > 256 MB
-- 
2.31.1




More information about the parted-devel mailing list