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

Signed-off-by: Petr Uzel <[email protected]>
---
 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: [email protected]
Lihovarská 1060/12                          http://www.suse.cz
190 00 Prague 9, CR                             

Attachment: pgpgRo0G6kO9b.pgp
Description: PGP signature

_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to