[PATCH] tests: convert t4001 to use the new framework

Jim Meyering meyering at redhat.com
Thu Feb 25 17:19:10 UTC 2010


* tests/t4001-sun-vtoc.sh: Convert.
* tests/Makefile.am (TESTS): Add it to the list.
---
 tests/Makefile.am       |    1 +
 tests/t4001-sun-vtoc.sh |   64 +++++++++++++++++++++++++---------------------
 2 files changed, 36 insertions(+), 29 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index d0d301d..8159a32 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -24,6 +24,7 @@ TESTS = \
   t2300-dos-label-extended-bootcode.sh \
   t3000-resize-fs.sh \
   t4000-sun-raid-type.sh \
+  t4001-sun-vtoc.sh \
   t4100-msdos-partition-limits.sh \
   t4100-dvh-partition-limits.sh \
   t4100-msdos-starting-sector.sh \
diff --git a/tests/t4001-sun-vtoc.sh b/tests/t4001-sun-vtoc.sh
index 78c10c6..839d399 100755
--- a/tests/t4001-sun-vtoc.sh
+++ b/tests/t4001-sun-vtoc.sh
@@ -18,37 +18,43 @@

 # Written by Karel Zak <kzak at redhat.com>

-test_description='test Sun VTOC initialization'
+if test "$VERBOSE" = yes; then
+  set -x
+  parted --version
+fi

 : ${srcdir=.}
-. $srcdir/test-lib.sh
+. $srcdir/t-lib.sh

 N=2M
 dev=loop-file
-test_expect_success \
-    'create a file to simulate the underlying device' \
-    'dd if=/dev/null of=$dev bs=1 seek=$N 2> /dev/null'
-
-test_expect_success \
-    'label the test disk' \
-    'parted -s $dev mklabel sun > out 2>&1'
-test_expect_success 'expect no output' 'compare out /dev/null'
-
-test_expect_success \
-    'extract version' \
-    'od -t x1 -An -j128 -N4 $dev > out && echo " 00 00 00 01" > exp'
-test_expect_success 'expect it to be 00 00 00 01, not 00 00 00 00' \
-    'compare out exp'
-
-test_expect_success \
-    'extract nparts' \
-    'od -t x1 -An -j140 -N2 $dev > out && echo " 00 08" > exp'
-test_expect_success 'expect it to be 00 08, not 00 00' 'compare out exp'
-
-test_expect_success \
-    'extract sanity magic' \
-    'od -t x1 -An -j188 -N4 $dev > out && echo " 60 0d de ee" > exp'
-test_expect_success 'expect it to be 60 0d de ee, not 00 00 00 00' \
-    'compare out exp'
-
-test_done
+# create a file to simulate the underlying device
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+fail=0
+
+# label the test disk
+parted -s $dev mklabel sun > out 2>&1 || fail=1
+# expect no output
+compare out /dev/null || fail=1
+
+# extract version
+od -t x1 -An -j128 -N4 $dev > out || fail=1
+echo " 00 00 00 01" > exp || fail=1
+# expect it to be 00 00 00 01, not 00 00 00 00
+compare out exp || fail=1
+
+# extract nparts
+od -t x1 -An -j140 -N2 $dev > out || fail=1
+echo " 00 08" > exp || fail=1
+
+# expect it to be 00 08, not 00 00
+compare out exp || fail=1
+
+# extract sanity magic
+od -t x1 -An -j188 -N4 $dev > out || fail=1
+echo " 60 0d de ee" > exp
+# expect it to be 60 0d de ee, not 00 00 00 00
+compare out exp || fail=1
+
+Exit $fail
--
1.7.0.401.g84adb



More information about the parted-devel mailing list