diff options
author | Jim Meyering <meyering@redhat.com> | 2010-02-26 19:28:36 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-03-01 08:43:07 +0100 |
commit | a5a875cd4f65331df299965730c4a42e234f13eb (patch) | |
tree | 05dc3e33b5029f7b24730e176764a4f565593bb5 /tests/t2200-dos-label-recog.sh | |
parent | 9c7167e1d2fa8d7114152b0f2a996e0c054590ad (diff) | |
download | parted-a5a875cd4f65331df299965730c4a42e234f13eb.tar.gz |
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.
Diffstat (limited to 'tests/t2200-dos-label-recog.sh')
-rwxr-xr-x | tests/t2200-dos-label-recog.sh | 65 |
1 files changed, 30 insertions, 35 deletions
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 |