[parted-devel] [PATCH v2 2/2] tests: t0202-gpt-pmbr.sh: various fixes

Petr Uzel petr.uzel at suse.cz
Wed Aug 26 13:10:49 UTC 2009


* use bootcode_size variable instead of plain 446
* do not use /dev/urandom since it might not exist

Signed-off-by: Petr Uzel <petr.uzel at suse.cz>
---
 tests/t0202-gpt-pmbr.sh |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/tests/t0202-gpt-pmbr.sh b/tests/t0202-gpt-pmbr.sh
index 2c365c2..9322be6 100755
--- a/tests/t0202-gpt-pmbr.sh
+++ b/tests/t0202-gpt-pmbr.sh
@@ -21,14 +21,18 @@ test_description='Preserve first 446B of the Protected MBR for gpt partitions.'
 . $srcdir/test-lib.sh
 
 dev=loop-file
+bootcode_size=446
+
 test_expect_success \
     'Create a 100k test file with random content' \
-    'dd if=/dev/urandom of=$dev bs=1c count=446 &&
-     dd if=/dev/zero of=$dev bs=1c seek=446 count=101954 > /dev/null 2>&1'
+    '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'
 
 test_expect_success \
-    'Extract the first 446 Bytes before GPT creation' \
-    'dd if=$dev of=before bs=1c count=446 > /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'
 
 test_expect_success \
     'create a GPT partition table' \
@@ -36,8 +40,8 @@ test_expect_success \
 test_expect_success 'expect no output' 'compare out /dev/null'
 
 test_expect_success \
-    'Extract the first 446 Bytes after GPT creation' \
-    'dd if=$dev of=after bs=1c count=446 > /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'
 
 test_expect_success \
     'Compare the before and after' \
-- 
1.6.3.3


-- 
Best regards / s pozdravem

Petr Uzel, openSUSE Community Multiplier Team
-----------------------------------------------------------------
SUSE LINUX, s.r.o.                          e-mail: puzel at suse.cz
Lihovarská 1060/12                          http://www.suse.cz
190 00 Prague 9, CR                             
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20090826/8ca32c9e/attachment.pgp>


More information about the parted-devel mailing list