[parted-devel] Adding a test for ticket #22 (resizing ext2 partitions)

David Cantrell dcantrell at redhat.com
Mon Jun 11 15:47:42 UTC 2007


ACK

On Mon, 2007-06-11 at 17:20 +0200, Jim Meyering wrote:
> "Matt Davis" <mattdavis9 at gmail.com> wrote:
> > Corrected the changes per your suggestions.
> 
> Thanks.
> 
> I've made some minor changes.  Here's the patch I'm prepared to commit:
> 
> From 0108b0ed7d3839f2663ba22e09738163468deece Mon Sep 17 00:00:00 2001
> From: Matt Davis <mattdavis9 at gmail.com>
> Date: Thu, 31 May 2007 22:36:58 -0400
> Subject: [PATCH] Add a test for an ext2-resize failure.
> 
> 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
> 
> _______________________________________________
> parted-devel mailing list
> parted-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/parted-devel
-- 
David Cantrell <dcantrell at redhat.com>
Red Hat / Westford, MA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20070611/d4c0e37f/attachment-0001.pgp 


More information about the parted-devel mailing list