[PATCH 2/8] tests: rewrite t0202 to use new framework
Jim Meyering
meyering at redhat.com
Fri Nov 13 08:45:49 UTC 2009
* tests/t0202-gpt-pmbr.sh: Rewrite.
---
tests/t0202-gpt-pmbr.sh | 45 +++++++++++++++++++++++----------------------
1 files changed, 23 insertions(+), 22 deletions(-)
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 <http://www.gnu.org/licenses/>.
-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
--
1.6.5.2.372.gc0502
More information about the parted-devel
mailing list