[parted-devel] [PATCH] tests/t9024: Add a test for using 1 sector of free space

Brian C. Lane bcl at redhat.com
Tue Jun 25 23:01:05 BST 2019


Previously this would result in "Error: Can't have overlapping
partitions." even though it doesn't really overlap.

This makes sure that a 1 sector partition can be placed into 1 sector of
free space between existing partitions.
---
 tests/Makefile.am                   |  1 +
 tests/t9024-one-sector-partition.sh | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 tests/t9024-one-sector-partition.sh

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0d7c022..3916dc5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -85,6 +85,7 @@ TESTS = \
   t9021-maxima.sh \
   t9022-one-unit-snap.sh \
   t9023-value-lt-one.sh \
+  t9024-one-sector-partition.sh \
   t9030-align-check.sh \
   t9040-many-partitions.sh \
   t9041-undetected-in-use-16th-partition.sh \
diff --git a/tests/t9024-one-sector-partition.sh b/tests/t9024-one-sector-partition.sh
new file mode 100644
index 0000000..df6209f
--- /dev/null
+++ b/tests/t9024-one-sector-partition.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Confirm that a 1 sector partition can be added into 1 sector of free space
+
+# Copyright (C) 2019 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/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+ss=$sector_size_
+n_sectors=300
+dev=dev-file
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || framework_failure
+parted -s -a min $dev mklabel msdos mkpart pri 10s 20s mkpart pri 22s 30s mkpart pri 21s 21s || fail=1
+
+Exit $fail
-- 
2.21.0




More information about the parted-devel mailing list