[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Tue Mar 2 10:58:23 UTC 2010


 tests/t-lib.sh                             |    6 ++
 tests/t1700-ext-probe.sh                   |   32 ++++++----
 tests/t2200-dos-label-recog.sh             |   65 ++++++++++-----------
 tests/t2300-dos-label-extended-bootcode.sh |   87 ++++++++++++++---------------
 tests/t3000-resize-fs.sh                   |    1 
 5 files changed, 97 insertions(+), 94 deletions(-)

New commits:
commit efc9f9b256577862f99da2f06791ebb5c2d0fba1
Author: Petr Uzel <petr.uzel at suse.cz>
Date:   Mon Mar 1 17:04:51 2010 +0100

    tests: skip tests that require mkfs.hfs, when it is unavailable
    
    t3000-resize-fs.sh would fails if mkfs.hfs is not installed.
    * tests/t-lib.sh (require_hfs_): New function.
    * tests/t3000-resize-fs.sh: Use require_hfs_.

diff --git a/tests/t-lib.sh b/tests/t-lib.sh
index 73454ce..834a017 100644
--- a/tests/t-lib.sh
+++ b/tests/t-lib.sh
@@ -54,6 +54,12 @@ require_acl_()
     || skip_test_ "This test requires a local user named bin."
 }
 
+require_hfs_()
+{
+  mkfs.hfs 2>&1 | grep '^usage:' \
+    || skip_test_ "This test requires HFS support."
+}
+
 # Skip this test if we're not in SELinux "enforcing" mode.
 require_selinux_enforcing_()
 {
diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
index d6af67d..4d0f5cb 100755
--- a/tests/t3000-resize-fs.sh
+++ b/tests/t3000-resize-fs.sh
@@ -23,6 +23,7 @@ fi
 
 : ${srcdir=.}
 . $srcdir/t-lib.sh
+require_hfs_
 
 require_root_
 require_scsi_debug_module_

commit a5a875cd4f65331df299965730c4a42e234f13eb
Author: Jim Meyering <meyering at redhat.com>
Date:   Fri Feb 26 19:28:36 2010 +0100

    tests: convert more tests to the newer infrastructure
    
    * tests/t1700-ext-probe.sh: Convert from test-lib.sh to t-lib.sh.
    * tests/t2200-dos-label-recog.sh: Likewise.
    * tests/t2300-dos-label-extended-bootcode.sh: Likewise.

diff --git a/tests/t1700-ext-probe.sh b/tests/t1700-ext-probe.sh
index e68912f..4b3a5a4 100755
--- a/tests/t1700-ext-probe.sh
+++ b/tests/t1700-ext-probe.sh
@@ -1,4 +1,5 @@
 #!/bin/sh
+# Probe Ext2, Ext3 and Ext4 file systems
 
 # Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
@@ -15,30 +16,33 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-test_description='Probe Ext2, Ext3 and Ext4 file systems.'
+if test "$VERBOSE" = yes; then
+  set -x
+  parted --version
+fi
 
 : ${srcdir=.}
-. $srcdir/test-lib.sh
-
+. $srcdir/t-lib.sh
 require_512_byte_sector_size_
 
 dev=loop-file
+ss=$sector_size_
+n_sectors=8000
+
+fail=0
 
 for type in ext2 ext3 ext4; do
 
-( mkfs.$type -V ) >/dev/null 2>&1 ||
-  { echo "no $type support; skipping that test"; continue; }
+  ( mkfs.$type -V ) >/dev/null 2>&1 || skip_test_ "no $type support"
 
-test_expect_success \
-    "create an $type file system" '
-    dd if=/dev/zero of=$dev bs=1024 count=4096 >/dev/null &&
-    mkfs.$type -F $dev >/dev/null'
+  # create an $type file system
+  dd if=/dev/zero of=$dev bs=1024 count=4096 >/dev/null || fail=1
+  mkfs.$type -F $dev >/dev/null || fail=1
 
-test_expect_success \
-    "probe the $type file system" '
-    parted -s $dev print >out 2>1
-    grep -w $type out'
+  # probe the $type file system
+  parted -s $dev print >out 2>1 || fail=1
+  grep -w $type out || fail=1
 
 done
 
-test_done
+Exit $fail
diff --git a/tests/t2200-dos-label-recog.sh b/tests/t2200-dos-label-recog.sh
index 92e6d42..d60c24d 100755
--- a/tests/t2200-dos-label-recog.sh
+++ b/tests/t2200-dos-label-recog.sh
@@ -1,4 +1,5 @@
 #!/bin/sh
+# improved MSDOS partition-table recognition
 
 # Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
@@ -15,10 +16,13 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-test_description='improved MSDOS partition-table recognition'
+if test "$VERBOSE" = yes; then
+  set -x
+  parted --version
+fi
 
 : ${srcdir=.}
-. $srcdir/test-lib.sh
+. $srcdir/t-lib.sh
 
 ######################################################################
 # With vestiges of a preceding FAT file system boot sector in the MBR,
@@ -28,36 +32,27 @@ test_description='improved MSDOS partition-table recognition'
 ss=$sector_size_
 N=8192
 dev=loop-file
-test_expect_success \
-    'create a file to simulate the underlying device' \
-    'dd if=/dev/null of=$dev bs=$ss seek=$N 2> /dev/null'
-
-test_expect_success \
-    'label the test disk' \
-    'parted -s $dev mklabel msdos > out 2>&1'
-test_expect_success 'expect no output' 'compare out /dev/null'
-
-test_expect_success \
-    'create two partition' \
-    '
-    parted -s $dev mkpart primary 2048s 4095s > out 2>&1 &&
-    parted -s $dev mkpart primary 4096s 8191s >> out 2>&1
-
-    '
-test_expect_success 'expect no output' 'compare out /dev/null'
-
-test_expect_success \
-    'write "FAT" where it would cause trouble' \
-    'printf FAT|dd bs=1c seek=82 count=3 of=$dev conv=notrunc'
-
-test_expect_success \
-    'print the partition table' \
-    '
-    parted -m -s $dev unit s p > out &&
-    tail -2 out > k && mv k out &&
-    printf "1:2048s:4095s:2048s:::;\n2:4096s:8191s:4096s:::;\n" > exp
-
-    '
-test_expect_success 'expect two partitions' 'compare out exp'
-
-test_done
+
+# create a file to simulate the underlying device
+dd if=/dev/null of=$dev bs=$ss seek=$N 2> /dev/null || fail=1
+
+# label the test disk
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+compare out /dev/null || fail=1 # expect no output
+
+# create two partitions
+parted -s $dev mkpart primary 2048s 4095s \
+               mkpart primary 4096s 8191s > out 2>&1 || fail=1
+compare out /dev/null || fail=1 # expect no output
+
+# write "FAT" where it would cause trouble
+printf FAT | dd bs=1c seek=82 count=3 of=$dev conv=notrunc || fail=1
+
+# print the partition table
+parted -m -s $dev unit s p > out || fail=1
+tail -2 out > k && mv k out || fail=1
+printf "1:2048s:4095s:2048s:::;\n2:4096s:8191s:4096s:::;\n" > exp || fail=1
+
+compare out exp || fail=1
+
+Exit $fail
diff --git a/tests/t2300-dos-label-extended-bootcode.sh b/tests/t2300-dos-label-extended-bootcode.sh
index 73fa45b..7ef1529 100755
--- a/tests/t2300-dos-label-extended-bootcode.sh
+++ b/tests/t2300-dos-label-extended-bootcode.sh
@@ -1,4 +1,5 @@
 #!/bin/sh
+# Ensure parted preserves bootcode in extended partition.
 
 # Copyright (C) 2009-2010 Free Software Foundation, Inc.
 
@@ -15,56 +16,52 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-test_description='Ensure parted preserves bootcode in extended partition.'
+if test "$VERBOSE" = yes; then
+  set -x
+  parted --version
+fi
 
 : ${srcdir=.}
-. $srcdir/test-lib.sh
+. $srcdir/t-lib.sh
 
 require_512_byte_sector_size_
 
 dev=loop-file
 bootcode_size=446
 
-test_expect_success \
-  'Create the test file' \
-  'dd if=/dev/zero of=$dev bs=1M count=4 >/dev/null 2>&1'
-
-test_expect_success \
-  'Create msdos label' \
-  'parted -s $dev mklabel msdos > out 2>&1'
-test_expect_success 'Expect no output' 'compare out /dev/null'
-
-test_expect_success \
-  'Create extended partition' \
-  'parted -s $dev mkpart extended 2048s 8191s > out 2>&1'
-test_expect_success 'Expect no output' 'compare out /dev/null'
-
-test_expect_success \
-  'Create logical partition' \
-  'parted -s $dev mkpart logical 4096s 8191s > out 2>&1'
-test_expect_success 'Expect no output' 'compare out /dev/null'
-
-test_expect_success \
-  'Install fake bootcode' \
-  'printf %0${bootcode_size}d 0 > in &&
-   dd if=in of=$dev bs=1c seek=1M count=$bootcode_size \
-      conv=notrunc > /dev/null 2>&1'
-
-test_expect_success \
-  'Save fake bootcode for later comparison' \
-  'dd if=$dev of=before bs=1 skip=1M count=$bootcode_size > /dev/null 2>&1'
-
-test_expect_success \
-  'Do something to the label' \
-  'parted -s $dev rm 5 > out 2>&1'
-test_expect_success 'Expect no output' 'compare out /dev/null'
-
-test_expect_success \
-  'Extract the bootcode for comparison' \
-  'dd if=$dev of=after bs=1 skip=1M count=$bootcode_size > /dev/null 2>&1'
-
-test_expect_success \
-  'Expect bootcode has not changed' \
-  'compare before after'
-
-test_done
+fail=0
+
+# Create the test file
+dd if=/dev/zero of=$dev bs=1M count=4 || fail=1
+
+# Create msdos label
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+compare out /dev/null || fail=1 # Expect no output
+
+# Create extended partition
+parted -s $dev mkpart extended 2048s 8191s > out 2>&1 || fail=1
+compare out /dev/null || fail=1 # Expect no output
+
+# Create logical partition
+parted -s $dev mkpart logical 4096s 8191s > out 2>&1 || fail=1
+compare out /dev/null || fail=1 # Expect no output
+
+# Install fake bootcode
+printf %0${bootcode_size}d 0 > in || fail=1
+dd if=in of=$dev bs=1c seek=1M count=$bootcode_size \
+  conv=notrunc > /dev/null 2>&1 || fail=1
+
+# Save fake bootcode for later comparison
+dd if=$dev of=before bs=1 skip=1M count=$bootcode_size || fail=1
+
+# Do something to the label
+parted -s $dev rm 5 > out 2>&1 || fail=1
+compare out /dev/null || fail=1 # Expect no output
+
+# Extract the bootcode for comparison
+dd if=$dev of=after bs=1 skip=1M count=$bootcode_size || fail=1
+
+# Expect bootcode has not changed
+compare before after || fail=1
+
+Exit $fail



More information about the Parted-commits mailing list