[PATCH 2/2] tests: test for new 2-sector minimum ext-logical-separation

Jim Meyering meyering at redhat.com
Tue Mar 30 09:57:35 UTC 2010


* tests/t2310-dos-extended-2-sector-min-offset.sh: New file.
* tests/Makefile.am (TESTS): Add it.
---
 tests/Makefile.am                               |    1 +
 tests/t2310-dos-extended-2-sector-min-offset.sh |   66 +++++++++++++++++++++++
 2 files changed, 67 insertions(+), 0 deletions(-)
 create mode 100644 tests/t2310-dos-extended-2-sector-min-offset.sh

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 49829c5..4667522 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,6 +22,7 @@ TESTS = \
   t2100-mkswap.sh \
   t2200-dos-label-recog.sh \
   t2300-dos-label-extended-bootcode.sh \
+  t2310-dos-extended-2-sector-min-offset.sh \
   t2400-dos-hfs-partition-type.sh \
   t3000-resize-fs.sh \
   t3200-type-change.sh \
diff --git a/tests/t2310-dos-extended-2-sector-min-offset.sh b/tests/t2310-dos-extended-2-sector-min-offset.sh
new file mode 100644
index 0000000..50dac28
--- /dev/null
+++ b/tests/t2310-dos-extended-2-sector-min-offset.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+# Ensure that parted leaves at least 2 sectors between the beginning
+# of an extended partition and the first logical partition.
+# Before parted-2.3, it could be made to leave just one, and that
+# would cause trouble with the Linux kernel.
+
+# Copyright (C) 2010 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/>.
+
+if test "$VERBOSE" = yes; then
+  set -x
+  parted --version
+fi
+
+: ${srcdir=.}
+. $srcdir/t-lib.sh
+
+require_root_
+require_scsi_debug_module_
+
+# check for scsi_debug module
+modprobe -n scsi_debug ||
+  skip_test_ "you lack the scsi_debug kernel module"
+
+# create memory-backed device
+scsi_debug_setup_ dev_size_mb=1 > dev-name ||
+  skip_test_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+p1=${scsi_dev}1
+
+cat <<EOF > exp || framework_failure
+BYT;
+$scsi_dev:2048s:scsi:512:512:msdos:Linux scsi_debug;
+1:64s:128s:65s:::lba;
+5:65s:128s:64s:::;
+EOF
+
+fail=0
+
+# Create a DOS label with an extended partition starting at sector 64.
+parted -s $scsi_dev mklabel msdos || fail=1
+parted --align=min -s $scsi_dev mkpart extended 64s 128s> out 2>&1 || fail=1
+parted -m -s $scsi_dev u s print
+compare out /dev/null || fail=1
+
+# Provoke a failure by starting just one sector after start of extended part.
+# FIXME: currently this does not fail as I expected it would.
+parted --align=min -s $scsi_dev mkpart logical  65s 128s > out 2>&1 || fail=1
+compare out /dev/null || fail=1
+
+parted -m -s $scsi_dev u s print > out 2>&1
+compare out exp || fail=1
+
+Exit $fail
--
1.7.1.rc0.239.g8b27e



More information about the parted-devel mailing list