[parted-devel] [PATCH 2/2] test for the bootcode-in-extended-partition fix

Joel Granados jgranado at redhat.com
Fri May 22 16:41:12 UTC 2009


On Fri, May 22, 2009 at 04:42:48PM +0200, Petr Uzel wrote:
> Hi!
> 
> On Fri, May 22, 2009 at 01:57:31PM +0200, Joel Granados wrote:
> > 
> > This is great!!! my comments bellow.
> > On Fri, May 22, 2009 at 11:11:32AM +0200, Petr Uzel wrote:
> > > * tests/t2300-dos-label-extended-bootcode.sh: New file.
> > > * tests/Makefile.am (TESTS): Add t2300-dos-label-extended-bootcode.sh.
> > > 
> > > Signed-off-by: Petr Uzel <petr.uzel at suse.cz>
> <SNIP>
> > > +
.
.
.
> > > +
> > 
> > I think you can install the boot code with the following code.  I tested
> > this and it works pretty well.  You would have to apply it to your
> > test.
> > 
> > <snip>
> > dd if=file of=file2 bs=512c count=32 &&
> > dd if=/dev/urandom of=file2 seek=16384c bs=1c count=446 &&
> > dd if=file of=file2 skip=16830 seek=16830 bs=1c count=85570
> > </snip>
> 
> OK, this can make the test simpler. But when we know the position of
> extended partition, we could even install the bootcode directly with
> on call to dd:
> 
> [*] dd if=/dev/urandom of=file bs=1c count=440 seek=16384 conv=notrunc

This is even better. :>)  I'll implement this trick in some of my test
(that I have not posted yet).

> 
> > 
> > Note that those three lines install a randomised boot section (I used
> > 446 but 440 is better).  Also note that the calculations expect the
> > partitions to be in certain places.  With this in mind the previous code
> > must be preceeded by the following partition creation (I think the
> > parted lines need the -s arg)
> > 
> > <snip>
> > dd if=/dev/zero of=file bs=1024c count=100
> > parted file mklabel msdos
> > parted file unit s mkpart extended 32s 127s
> > parted file unit s mkpart logical 64s 127s
> > </snip>
> > 
> > I have attached a bash script of what I think the test should look like.
> > IMO its much cleaner than what you propose.  Pls have a look and tell me
> > what you think.
> 
> Yes, let's keep the test simple. So if you agree, I will rework the
> test according to your script, but with [*].

Sounds good

> 
> 
> Thanks a lot for your feedback!

np

> 
> 
> > > +test_expect_success \
> > > +	'Get start of extended partition' \
> > > +	'ep_start=`parted -s $dev unit B print | grep extended | sed -e "s/^ *[[:digit:]]* *\([[:digit:]]*\)B.*$/\1/"`'
> > > +
> > > +test_expect_success \
> > > +	'Prepare fake bootcode' \
> > > +	'rm -rf $bootcode && for char in `seq 1 440`; do echo -n "X" >> $bootcode; done'
> > > +
> > > +test_expect_success \
> > > +	'Install fake bootcode' \
> > > +	'dd if=$bootcode of=$dev bs=1 seek=$ep_start count=$bootcode_size conv=notrunc 2> /dev/null'
.
.
.
> 
> -- 
> Best regards / s pozdravem
> 
> Petr Uzel, Packages maintainer
> ---------------------------------------------------------------------
> SUSE LINUX, s.r.o.                          e-mail: puzel at suse.cz
> Lihovarská 1060/12                          tel: +420 284 028 964
> 190 00 Prague 9                             fax: +420 284 028 951
> Czech Republic                              http://www.suse.cz

-- 
Joel Andres Granados
Brno, Czech Republic, Red Hat.



More information about the parted-devel mailing list