Hi, attached patch adds test for Jim's fix (failed assertion when creating GPT label). My first parted test, so please let me know what you think.
Thanks, --- tests/Makefile.am | 1 + tests/t0201-gpt.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 0 deletions(-) create mode 100755 tests/t0201-gpt.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index 14e4862..0beedd4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,6 +2,7 @@ TESTS = \ t0000-basic.sh \ t0100-print.sh \ t0200-gpt.sh \ + t0201-gpt.sh \ t1000-mkpartfs.sh \ t1100-busy-label.sh \ t1500-small-ext2.sh \ diff --git a/tests/t0201-gpt.sh b/tests/t0201-gpt.sh new file mode 100755 index 0000000..0974e1a --- /dev/null +++ b/tests/t0201-gpt.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# Copyright (C) 2009 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='avoid failed assertion when creating a GPT on top of an old one for a larger device' + +: ${srcdir=.} +. $srcdir/test-lib.sh + +N1=10M +N2=5M +dev=loop-file +tmp=loop-file-tmp +test_expect_success \ + 'create a file large enough to hold a GPT partition table' \ + 'dd if=/dev/null of=$dev bs=1 seek=$N1 2> /dev/null' + +test_expect_success \ + 'create a GPT partition table' \ + 'parted -s $dev mklabel gpt > out 2>&1' +test_expect_success 'expect no output' 'compare out /dev/null' + +test_expect_success \ + 'shrink the backing file' \ + 'dd if=$dev of=$tmp bs=$N2 count=1 && mv $tmp $dev' + +test_expect_success \ + 'create GPT on top of the shrunken backing file' \ + 'parted -s $dev mklabel gpt > out 2>&1' +test_expect_success 'expect no output' 'compare out /dev/null' + +test_done -- 1.6.0.2 -- Best regards / s pozdravem Petr Uzel, Packages maintainer --------------------------------------------------------------------- SUSE LINUX, s.r.o. e-mail: [email protected] Lihovarská 1060/12 tel: +420 284 028 964 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz _______________________________________________ parted-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/parted-devel

