OSDN Git Service

tests: convert t4100-msdos-starting-sector.sh
authorJim Meyering <meyering@redhat.com>
Thu, 18 Nov 2010 11:26:18 +0000 (12:26 +0100)
committerJim Meyering <meyering@redhat.com>
Sat, 20 Nov 2010 16:03:02 +0000 (17:03 +0100)
* tests/t4100-msdos-starting-sector.sh: Use init.sh.

tests/t4100-msdos-starting-sector.sh

index 3d0233b..370a7f3 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/sh
+# Consistency in msdos free space starting sector.
 
 # Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
 # 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='Consistency in msdos free space starting sector.'
-
-: ${srcdir=.}
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
 ss=$sector_size_
 
 ######################################################################
@@ -29,14 +27,13 @@ ss=$sector_size_
 
 N=4096 # number of sectors
 dev=loop-file
-test_expect_success \
-    'create a file to simulate the underlying device' \
-    'dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null'
+# create a file to simulate the underlying device
+dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null || fail=1
 
-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'
+# label the test disk
+parted -s $dev mklabel msdos > out 2>&1 || fail=1
+# expect no output
+compare out /dev/null || fail=1
 
 # Test the output of print free with no partitions.
 fail=0
@@ -46,19 +43,16 @@ path:${N}s:file:$ss:$ss:msdos:;
 1:32s:4095s:4064s:free;
 EOF
 
-test_expect_success 'create expected output file' 'test $fail = 0'
+create expected output file' 'test $fail = 0'
 
-test_expect_success \
-    'display output of label without partitions' \
-    'parted -m -s $dev unit s print free > out 2>&1'
+# display output of label without partitions
+parted -m -s $dev unit s print free > out 2>&1 || fail=1
 
-test_expect_success \
-    'check for expected output' \
-    'sed "2s/^[^:]*:/path:/" < out > k; mv k out
-    compare out exp'
+# check for expected output
+sed "2s/^[^:]*:/path:/" < out > k; mv k out
+compare out exp || fail=1
 
 # Test the output of print free with one partition.
-fail=0
 cat <<EOF > exp || fail=1
 BYT;
 path:${N}s:file:$ss:$ss:msdos:;
@@ -66,19 +60,14 @@ path:${N}s:file:$ss:$ss:msdos:;
 1:2048s:4095s:2048s:::;
 EOF
 
-test_expect_success 'create expected output file' 'test $fail = 0'
-
-test_expect_success \
-    'create a partition at the end of the label' \
-    'parted -s $dev mkpart primary 2048s 4095s'
+# create a partition at the end of the label
+parted -s $dev mkpart primary 2048s 4095s || fail=1
 
-test_expect_success \
-    'display output of label with partition' \
-    'parted -m -s $dev unit s print free > out 2>&1'
+# display output of label with partition
+parted -m -s $dev unit s print free > out 2>&1 || fail=1
 
-test_expect_success \
-    'check for expected output' \
-    'sed "2s/^[^:]*:/path:/" < out > k; mv k out
-    compare out exp'
+# check for expected output
+sed "2s/^[^:]*:/path:/" < out > k; mv k out
+compare out exp || fail=1
 
-test_done
+Exit $fail