From: Jim Meyering Date: Fri, 13 Nov 2009 08:45:49 +0000 (+0100) Subject: tests: rewrite t0202 to use new framework X-Git-Tag: android-x86-4.4-r1~517 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=180cfdf56f1d65ae1564d0a8f750417c09738ad5;p=android-x86%2Fexternal-parted.git tests: rewrite t0202 to use new framework * tests/t0202-gpt-pmbr.sh: Rewrite. --- diff --git a/tests/t0202-gpt-pmbr.sh b/tests/t0202-gpt-pmbr.sh index 996cfe9..4ca520b 100755 --- a/tests/t0202-gpt-pmbr.sh +++ b/tests/t0202-gpt-pmbr.sh @@ -1,4 +1,5 @@ #!/bin/sh +# Preserve first 446B of the Protected MBR for gpt partitions. # Copyright (C) 2009 Free Software Foundation, Inc. @@ -15,36 +16,36 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -test_description='Preserve first 446B of the Protected MBR for gpt partitions.' +if test "$VERBOSE" = yes; then + set -x + parted --version +fi : ${srcdir=.} -. $srcdir/test-lib.sh +. $srcdir/t-lib.sh dev=loop-file bootcode_size=446 -test_expect_success \ - 'Create a 100k test file with random content' \ - 'printf %0${bootcode_size}d 0 > in && - dd if=in of=$dev bs=1c count=$bootcode_size && - dd if=/dev/zero of=$dev bs=1c seek=$bootcode_size \ - count=101954 > /dev/null 2>&1' +fail=0 +# Create a 100k test file with random content +printf %0${bootcode_size}d 0 > in || fail=1 +dd if=in of=$dev bs=1c count=$bootcode_size || fail=1 +dd if=/dev/zero of=$dev bs=1c seek=$bootcode_size \ + count=101954 > /dev/null 2>&1 || fail=1 -test_expect_success \ - 'Extract the first $bootcode_size Bytes before GPT creation' \ - 'dd if=$dev of=before bs=1c count=$bootcode_size > /dev/null 2>&1' +# Extract the first $bootcode_size Bytes before GPT creation +dd if=$dev of=before bs=1c count=$bootcode_size > /dev/null 2>&1 || fail=1 -test_expect_success \ - 'create a GPT partition table' \ - 'parted -s $dev mklabel gpt > out 2>&1' -test_expect_success 'expect no output' 'compare out /dev/null' +# create a GPT partition table +parted -s $dev mklabel gpt > out 2>&1 || fail=1 +# expect no output +compare out /dev/null -test_expect_success \ - 'Extract the first $bootcode_size Bytes after GPT creation' \ - 'dd if=$dev of=after bs=1c count=$bootcode_size > /dev/null 2>&1' +# Extract the first $bootcode_size Bytes after GPT creation +dd if=$dev of=after bs=1c count=$bootcode_size > /dev/null 2>&1 || fail=1 -test_expect_success \ - 'Compare the before and after' \ - 'compare before after' +# Compare the before and after +compare before after || fail=1 -test_done +Exit $fail