"Tom \"spot\" Callaway" <tcall...@redhat.com> wrote: > On Sun, 2008-12-21 at 17:21 +0100, Jim Meyering wrote: >> Now that I've done the above, it should be easy to make >> that into a test case, since there are already several >> very similar ones (see tests/t*). >> >> Would you like to do that? > > Thanks Jim, that makes it very clear! > > Attached is a patch to add a test case. You'll need to chmod 755 the > test file (afaik, you can't set permissions in a patch). I tested this > with my previous patch applied and the test succeeds (without it, it > fails).
Thanks, Spot. Great service for a Sunday ;-) If you feel like one more iteration, it'd be nice if you would add a ChangeLog-style log entry and create diffs against the latest upstream git repository. E.g., check it out like this: git clone git://git.debian.org/git/parted/parted.git apply your diffs, and follow these patch-preparation guidelines: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob;f=HACKING;hb=HEAD Then I'll be able to apply it and won't risk forgetting to "git add" the new file or to set its executable bit; when I apply your patch(prepared as above) with "git am FILE", that would all happen automatically, and you're listed as Author: with whatever name/email you chose. A couple of nits: please use printf; it is more portable than echo -e. Please split the lines that go past 80 columns. Since almost all of this line is duplicated farther down, "BYT;\n$pwd/$dev:20480s:file:512:512:sun:;\n1:0s:50s:51s:::;" factor it out: exp="BYT;\n$pwd/$dev:20480s:file:512:512:sun:;\n1:0s:50s:51s" printf "$exp:::;" > exp && ... printf "$exp:::raid;" > exp && Then they don't need to be split ;-) Jim > diff -up parted-1.8.8/tests/Makefile.am.sparc-raid-test > parted-1.8.8/tests/Makefile.am > --- parted-1.8.8/tests/Makefile.am.sparc-raid-test 2007-07-14 > 13:31:40.000000000 -0400 > +++ parted-1.8.8/tests/Makefile.am 2008-12-21 12:39:51.000000000 -0500 > @@ -6,7 +6,8 @@ TESTS = \ > t1500-small-ext2.sh \ > t2000-mkfs.sh \ > t3000-constraints.sh \ > - t3100-resize-ext2-partion.sh > + t3100-resize-ext2-partion.sh \ > + t4000-sun-raid-type.sh > > EXTRA_DIST = \ > $(TESTS) test-lib.sh mkdtemp > diff -up parted-1.8.8/tests/Makefile.in.sparc-raid-test > parted-1.8.8/tests/Makefile.in > --- parted-1.8.8/tests/Makefile.in.sparc-raid-test 2007-08-09 > 14:49:33.000000000 -0400 > +++ parted-1.8.8/tests/Makefile.in 2008-12-21 12:41:23.000000000 -0500 > @@ -357,7 +357,8 @@ TESTS = \ > t1500-small-ext2.sh \ > t2000-mkfs.sh \ > t3000-constraints.sh \ > - t3100-resize-ext2-partion.sh > + t3100-resize-ext2-partion.sh \ > + t4000-sun-raid-type.sh > > EXTRA_DIST = \ > $(TESTS) test-lib.sh mkdtemp > diff -up /dev/null parted-1.8.8/tests/t4000-sun-raid-type.sh > --- /dev/null 2008-12-19 21:49:53.735009642 -0500 > +++ parted-1.8.8/tests/t4000-sun-raid-type.sh 2008-12-21 12:52:58.000000000 > -0500 > @@ -0,0 +1,63 @@ > +#!/bin/sh > + > +# Copyright (C) 2008 Tom "spot" Callaway <tcall...@redhat.com> > +# Derived from an example by Jim Meyering <j...@meyering.net> > + > +# 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='RAID support on sun disk type' > + > +. ./init.sh > + > +N=10M > +dev=sun-disk-file > +pwd=`pwd` > +test_expect_success \ > + 'create an empty file as a test disk' \ > + 'dd if=/dev/null of=$dev bs=1 seek=$N 2> /dev/null' > + > +test_expect_success \ > + 'label the test disk as a sun disk' \ > + 'parted -s $dev mklabel sun > out 2>&1' > +test_expect_success 'check for empty output' '$compare out /dev/null' > + > +test_expect_success \ > + 'create a single partition' \ > + 'parted -s $dev unit s mkpart ext2 0s 50s > out 2>&1' > +test_expect_success 'check for empty output' '$compare out /dev/null' > + > +test_expect_success \ > + 'print the partition data in machine readable format' \ > + 'parted -m -s $dev unit s p > out 2>&1' > + > +test_expect_success \ > + 'check for expected values for the partition' ' > + echo -e "BYT;\n$pwd/$dev:20480s:file:512:512:sun:;\n1:0s:50s:51s:::;" > > exp && > + $compare out exp' > + > +test_expect_success \ > + 'set the raid flag' \ > + 'parted -s $dev set 1 raid >out 2>&1' > +test_expect_success 'check for empty output' '$compare out /dev/null' > + > +test_expect_success \ > + 'print the partition data in machine readable format again' \ > + 'parted -m -s $dev unit s p > out 2>&1' > + > +test_expect_success \ > + 'check for expected values (including raid flag) for the partition' ' > + echo -e > "BYT;\n$pwd/$dev:20480s:file:512:512:sun:;\n1:0s:50s:51s:::raid;" > exp && > + $compare out exp' > + > +test_done _______________________________________________ bug-parted mailing list bug-parted@gnu.org http://lists.gnu.org/mailman/listinfo/bug-parted