OSDN Git Service

tests: make two partition-related tests work for other sector sizes
authorJim Meyering <meyering@redhat.com>
Fri, 28 Aug 2009 16:53:39 +0000 (18:53 +0200)
committerJim Meyering <meyering@redhat.com>
Fri, 28 Aug 2009 16:57:43 +0000 (18:57 +0200)
These two root-only tests would fail with the PARTED_SECTOR_SIZE envvar
set to anything other than 512.  Now they also work for multiples.
* tests/t4100-dvh-partition-limits.sh: Make sector-size agnostic.
* tests/t4100-msdos-partition-limits.sh: Likewise.

tests/t4100-dvh-partition-limits.sh
tests/t4100-msdos-partition-limits.sh

index 0606a7e..89302f1 100755 (executable)
@@ -23,6 +23,7 @@ privileges_required_=1
 : ${srcdir=.}
 . $srcdir/test-lib.sh
 require_xfs_
+ss=$sector_size_
 
 ####################################################
 # Create and mount a file system capable of dealing with >=2TB files.
@@ -58,7 +59,7 @@ do_mkpart()
   start_sector=$1
   end_sector=$2
   # echo '********' $(echo $end_sector - $start_sector + 1 |bc)
-  dd if=/dev/zero of=$dev bs=1b count=2k seek=$end_sector 2> /dev/null &&
+  dd if=/dev/zero of=$dev bs=$ss count=2k seek=$end_sector 2> /dev/null &&
   parted -s $dev mklabel $table_type &&
   parted -s $dev mkpart p xfs ${start_sector}s ${end_sector}s
 }
@@ -136,7 +137,7 @@ test_expect_success \
 cat > exp <<EOF
 Model:  (file)
 Disk: 4294970342s
-Sector size (logical/physical): 512B/512B
+Sector size (logical/physical): ${ss}B/${ss}B
 Partition Table: $table_type
 
 Number  Start        End          Size   Type      File system  Name  Flags
index d58c387..554b230 100755 (executable)
@@ -23,6 +23,7 @@ privileges_required_=1
 : ${srcdir=.}
 . $srcdir/test-lib.sh
 require_xfs_
+ss=$sector_size_
 
 ####################################################
 # Create and mount a file system capable of dealing with >=2TB files.
@@ -58,7 +59,7 @@ do_mkpart()
   start_sector=$1
   end_sector=$2
   # echo '********' $(echo $end_sector - $start_sector + 1 |bc)
-  dd if=/dev/zero of=$dev bs=1b count=2k seek=$end_sector 2> /dev/null &&
+  dd if=/dev/zero of=$dev bs=$ss count=2k seek=$end_sector 2> /dev/null &&
   parted -s $dev mklabel $table_type &&
   parted -s $dev mkpart p xfs ${start_sector}s ${end_sector}s
 }
@@ -136,7 +137,7 @@ test_expect_success \
 cat > exp <<EOF
 Model:  (file)
 Disk: 4294970342s
-Sector size (logical/physical): 512B/512B
+Sector size (logical/physical): ${ss}B/${ss}B
 Partition Table: $table_type
 
 Number  Start        End          Size   Type     File system  Flags