[PATCH] test for improved DOS-partition-table recognition
Jim Meyering
meyering at redhat.com
Thu May 29 09:21:05 UTC 2008
* tests/t2200-dos-label-recog.sh: New file.
* tests/Makefile.am (TESTS): Add t2200-dos-label-recog.sh.
---
tests/Makefile.am | 1 +
tests/t2200-dos-label-recog.sh | 61 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 0 deletions(-)
create mode 100755 tests/t2200-dos-label-recog.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d9b0878..e41b5ae 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,6 +6,7 @@ TESTS = \
t1500-small-ext2.sh \
t2000-mkfs.sh \
t2100-mkswap.sh \
+ t2200-dos-label-recog.sh \
t3000-constraints.sh \
t3100-resize-ext2-partion.sh \
t4100-msdos-partition-limits.sh \
diff --git a/tests/t2200-dos-label-recog.sh b/tests/t2200-dos-label-recog.sh
new file mode 100755
index 0000000..d5d2670
--- /dev/null
+++ b/tests/t2200-dos-label-recog.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Copyright (C) 2008 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='improved MSDOS partition-table recognition'
+
+. ./init.sh
+
+######################################################################
+# With vestiges of a preceding FAT file system boot sector in the MBR,
+# parted 1.8.8.1.29 and earlier would fail to recognize a DOS
+# partition table.
+######################################################################
+N=100k
+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 msdos > out 2>&1'
+test_expect_success 'expect no output' '$compare out /dev/null'
+
+test_expect_success \
+ 'create two partition' \
+ '
+ parted -s $dev mkpart primary 1s 40s > out 2>&1 &&
+ parted -s $dev mkpart primary 41s 80s > out 2>&1
+
+ '
+test_expect_success 'expect no output' '$compare out /dev/null'
+
+test_expect_success \
+ 'write "FAT" where it would cause trouble' \
+ 'printf FAT|dd bs=1c seek=82 count=3 of=$dev conv=notrunc'
+
+test_expect_success \
+ 'print the partition table' \
+ '
+ parted -m -s $dev unit s p > out &&
+ tail -2 out > k && mv k out &&
+ printf "1:1s:40s:40s:::;\n2:41s:80s:40s:::;\n" > exp
+
+ '
+test_expect_success 'expect two partitions' '$compare out exp'
+
+test_done
--
1.5.6.rc0.30.g51263
More information about the parted-devel
mailing list