[parted-devel] [PATCH 2/2] test for the bootcode-in-extended-partition fix

Petr Uzel petr.uzel at suse.cz
Thu Aug 20 13:27:30 UTC 2009


* tests/t2300-dos-label-extended-bootcode.sh: New file.
* tests/Makefile.am (TESTS): Add t2300-dos-label-extended-bootcode.sh.

Signed-off-by: Petr Uzel <petr.uzel at suse.cz>
---
 tests/Makefile.am                          |    1 +
 tests/t2300-dos-label-extended-bootcode.sh |   70 ++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 0 deletions(-)
 create mode 100755 tests/t2300-dos-label-extended-bootcode.sh

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 09caf3d..ac49acb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -13,6 +13,7 @@ TESTS = \
   t2000-mkfs.sh \
   t2100-mkswap.sh \
   t2200-dos-label-recog.sh \
+  t2300-dos-label-extended-bootcode.sh \
   t3000-constraints.sh \
   t3100-resize-ext2-partion.sh \
   t4000-sun-raid-type.sh \
diff --git a/tests/t2300-dos-label-extended-bootcode.sh b/tests/t2300-dos-label-extended-bootcode.sh
new file mode 100755
index 0000000..f2f3a83
--- /dev/null
+++ b/tests/t2300-dos-label-extended-bootcode.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# 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='Ensure parted preserves bootcode in extended partition.'
+
+: ${srcdir=.}
+. $srcdir/test-lib.sh
+
+require_512_byte_sector_size_
+
+# Note: the bootcode size is 440B
+
+dev=loop-file
+
+test_expect_success \
+  'Create the test file' \
+  'dd if=/dev/zero of=$dev bs=1024c count=100 >/dev/null 2>&1'
+
+test_expect_success \
+  'Create msdos label' \
+  'parted -s $dev mklabel msdos > out 2>&1'
+test_expect_success 'Expect no output' 'compare out /dev/null'
+
+test_expect_success \
+  'Create extended partition' \
+  'parted -s $dev mkpart extended 32s 127s > out 2>&1'
+test_expect_success 'Expect no output' 'compare out /dev/null'
+
+test_expect_success \
+  'Create logical partition' \
+  'parted -s $dev mkpart logical 64s 127s > out 2>&1'
+test_expect_success 'Expect no output' 'compare out /dev/null'
+
+test_expect_success \
+  'Install fake bootcode' \
+  'dd if=/dev/urandom of=$dev bs=1c seek=16384 count=400 \
+    conv=notrunc > /dev/null 2>&1'
+
+test_expect_success \
+  'Save fake bootcode for later comparison' \
+  'dd if=$dev of=before bs=1 skip=16384 count=440 > /dev/null 2>&1'
+
+test_expect_success \
+  'Do something to the label' \
+  'parted -s $dev rm 5 > out 2>&1'
+test_expect_success 'Expect no output' 'compare out /dev/null'
+
+test_expect_success \
+  'Extract the bootcode for comparison' \
+  'dd if=$dev of=after bs=1 skip=16384 count=440 > /dev/null 2>&1'
+
+test_expect_success \
+  'Expect bootcode has not changed' \
+  'compare before after'
+
+test_done
-- 
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/20090820/9df27445/attachment.pgp>


More information about the parted-devel mailing list