[PATCH] Add a test for an ext2-resize failure.
Matt Davis
mattdavis9 at gmail.com
Fri Jun 1 02:36:58 UTC 2007
This patch is based on the change from Matt Davis:
http://thread.gmane.org/gmane.comp.gnu.parted.devel/1695/focus=1704
Demonstrate an ext2-resize failure in parted-1.8.7, based on the report in
http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/22
Signed-off-by: Jim Meyering <jim at meyering.net>
---
tests/Makefile.am | 3 +-
tests/t3100-resize-ext2-partion.sh | 58 ++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 1 deletions(-)
create mode 100755 tests/t3100-resize-ext2-partion.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ecce727..0a42a8d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -5,7 +5,8 @@ TESTS = \
t1100-busy-label.sh \
t1500-small-ext2.sh \
t2000-mkfs.sh \
- t3000-constraints.sh
+ t3000-constraints.sh \
+ t3100-resize-ext2-partion.sh
EXTRA_DIST = \
$(TESTS) test-lib.sh mkdtemp
diff --git a/tests/t3100-resize-ext2-partion.sh b/tests/t3100-resize-ext2-partion.sh
new file mode 100755
index 0000000..0e763db
--- /dev/null
+++ b/tests/t3100-resize-ext2-partion.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+# Exercise an EXT2-resizing bug.
+
+# Copyright (C) 2007 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+test_description='Exercise an EXT2-resize bug in at least 1.8.7'
+
+. ./init.sh
+
+dev=loop-file
+# The "device size", $N, must be larger than $NEW_SIZE.
+N=1500M
+
+# To trigger the bug, the target size must be 269M or larger.
+NEW_SIZE=269M
+
+# $ORIG_SIZE may be just about anything smaller than $NEW_SIZE.
+ORIG_SIZE=1M
+
+test_expect_success \
+ 'create the test file' \
+ 'dd if=/dev/null of=$dev bs=1 seek=$N 2> /dev/null'
+
+test_expect_success \
+ 'run parted -s FILE mklabel msdos' \
+ 'parted -s $dev mklabel msdos > out 2>&1'
+test_expect_success 'check for empty output' '$compare out /dev/null'
+
+test_expect_success \
+ 'make an ext2 primary partition' \
+ 'parted -s $dev mkpartfs primary ext2 0 $ORIG_SIZE > out 2>&1'
+test_expect_success 'check for empty output' '$compare out /dev/null'
+
+# FIXME: this test currently fails with the diagnostic "error: block
+# relocator should have relocated 64".
+# Eventually, when this bug is fixed, change each of the following
+# expected failures to "test_expect_success".
+test_expect_failure \
+ 'resize ext2 primary partition' \
+ 'parted -s $dev resize 1 0 $NEW_SIZE > out 2>&1'
+test_expect_failure 'check for empty output' '$compare out /dev/null'
+
+test_done
More information about the parted-devel
mailing list