[PATCH 3/8] tests: weaken t0202-gpt-pmbr to assume a preexisting GPT table

Jim Meyering meyering at redhat.com
Fri Nov 13 10:38:34 UTC 2009


* tests/t0202-gpt-pmbr.sh: Lay down an initial GPT table before
writing to the MBR, so this test passes with the new semantics.
---
 tests/t0202-gpt-pmbr.sh |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/tests/t0202-gpt-pmbr.sh b/tests/t0202-gpt-pmbr.sh
index 4ca520b..209dcc7 100755
--- a/tests/t0202-gpt-pmbr.sh
+++ b/tests/t0202-gpt-pmbr.sh
@@ -28,16 +28,21 @@ dev=loop-file
 bootcode_size=446

 fail=0
-# Create a 100k test file with random content
+dd if=/dev/null of=$dev bs=1 seek=1M || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare out /dev/null
+
+# Fill the first $bootcode_size bytes with 0's.
+# This affects only the protective MBR, so doesn't affect validity of gpt table.
 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
+dd of=$dev bs=1 seek=0 count=$bootcode_size conv=notrunc < in || fail=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
+parted -s $dev p || fail=1

-# create a GPT partition table
+# create a GPT partition table on top of the existing one.
 parted -s $dev mklabel gpt > out 2>&1 || fail=1
 # expect no output
 compare out /dev/null
@@ -46,6 +51,6 @@ compare out /dev/null
 dd if=$dev of=after bs=1c count=$bootcode_size > /dev/null 2>&1 || fail=1

 # Compare the before and after
-compare before after || fail=1
+compare in after || fail=1

 Exit $fail
--
1.6.5.2.372.gc0502




More information about the parted-devel mailing list