[parted-devel] [PATCH v2] tests: Add ntfs vfat hfsplus to t1700 probe test

Brian C. Lane bcl at redhat.com
Fri Apr 18 15:57:34 UTC 2014


Add some new filesystems to test. Adjust how mkfs.* tests, since some of
them don't support -V, and add fsname so that the printed filesystem
name doesn't have to match the type.

* tests/t1700-probe-fs.sh: Add new filesystems to test

-- NOTE this is v2, adding force to nilfs2 and removing the file before each fs is created.
---
 tests/t1700-probe-fs.sh | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
index bf6ad9c..695f9ef 100755
--- a/tests/t1700-probe-fs.sh
+++ b/tests/t1700-probe-fs.sh
@@ -23,28 +23,37 @@ dev=loop-file
 ss=$sector_size_
 n_sectors=$((257*1024))
 
-for type in ext2 ext3 ext4 btrfs xfs nilfs2; do
+for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus; do
 
-  ( mkfs.$type -V ) >/dev/null 2>&1 \
+  ( mkfs.$type 2>&1 | grep -i '^usage' ) > /dev/null \
       || { warn_ "$ME: no $type support"; continue; }
 
-  case $type in ext*) force=-F;;
+  fsname=$type
+  force=
+  case $type in
+      ext*) force=-F;;
       xfs) force=-f;;
-      *) force=;; esac
+      nilfs2) force=-f;;
+      ntfs) force=-F;;
+      vfat) fsname=fat16;;
+      hfsplus) fsname=hfs+;;
+  esac
 
   # create an $type file system
+  [ -e $dev ] && rm -f $dev
   dd if=/dev/null of=$dev bs=$ss seek=$n_sectors >/dev/null || fail=1
   mkfs.$type $force $dev || { warn_ $ME: mkfs.$type failed; fail=1; continue; }
 
   # probe the $type file system
   parted -m -s $dev u s print >out 2>&1 || fail=1
-  grep '^1:.*:'$type'::;$' out || { cat out; fail=1; }
+  grep '^1:.*:'$fsname'::;$' out || { cat out; fail=1; }
 
 done
 
 # Some features should indicate ext4 by themselves.
 for feature in uninit_bg flex_bg; do
   # create an ext3 file system
+  [ -e $dev ] && rm -f $dev
   dd if=/dev/null of=$dev bs=1024 seek=4096 >/dev/null || fail=1
   mkfs.ext3 -F $dev >/dev/null || skip_ "mkfs.ext3 failed"
 
-- 
1.9.0




More information about the parted-devel mailing list