[parted-devel] [PATCH 2/3] tests: t3000-resize-fs.sh: Add FAT16 resizing test

Mike Fleetwood mike.fleetwood at googlemail.com
Sun Sep 28 15:15:49 UTC 2014


Add FAT16 resizing test so that we don't regress again.
---
 tests/t3000-resize-fs.sh |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
index 8cab476..9084eb4 100755
--- a/tests/t3000-resize-fs.sh
+++ b/tests/t3000-resize-fs.sh
@@ -46,7 +46,7 @@ device_sectors_required=$(echo $default_end | sed 's/s$//')
 # Ensure that $dev is large enough for this test
 test $device_sectors_required -le $dev_n_sectors || fail=1
 
-for fs_type in hfs+ fat32; do
+for fs_type in hfs+ fat32 fat16; do
 
   # create an empty $fs_type partition, cylinder aligned, size > 256 MB
   parted -a min -s $dev mkpart p1 $start $default_end > out 2>&1 || fail=1
@@ -59,6 +59,7 @@ for fs_type in hfs+ fat32; do
   wait_for_dev_to_appear_ ${dev}1
 
   case $fs_type in
+    fat16) mkfs_cmd='mkfs.vfat -F 16'; fsck='fsck.vfat -v';;
     fat32) mkfs_cmd='mkfs.vfat -F 32'; fsck='fsck.vfat -v';;
     hfs*) mkfs_cmd='mkfs.hfs';         fsck=fsck.hfs;;
     *) error "internal error: unhandled fs type: $fs_type";;
@@ -70,8 +71,17 @@ for fs_type in hfs+ fat32; do
   # NOTE: shrinking is the only type of resizing that works.
   # resize that file system to be one cylinder (8MiB) smaller
   fs-resize ${dev}1 0 $new_end > out 2>&1 || fail=1
-  # expect no output
-  compare /dev/null out || fail=1
+
+  # check for expected output
+  case $fs_type in
+    fat16) cat << EOF > exp || framework_failure
+Information: Would you like to use FAT32?  If you leave your file system as FAT16, then you will have no problems.  If you convert to FAT32, and MS Windows is installed on this partition, then you must re-install the MS Windows boot loader.  If you want to do this, you should consult the Parted manual (or your distribution's manual).  Also, converting to FAT32 will make the file system unreadable by MS DOS, MS Windows 95a, and MS Windows NT.
+EOF
+      ;;
+    fat32) cat /dev/null > exp || framework_failure;;     # expect no output
+    hfs*)  cat /dev/null > exp || framework_failure;;     # expect no output
+  esac
+  compare exp out || fail=1
 
   # This is known to segfault with fsck.hfs from
   # Fedora 16's hfsplus-tools-332.14-12.fc15.x86_64.
-- 
1.7.1




More information about the parted-devel mailing list