#!/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_
######################################################################
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
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:;
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