On Mon, Feb 16, 2009 at 07:27:18PM +0100, Jim Meyering wrote: > From efeaceacd3af6a8b1b7dcc006e87f99daf15f997 Mon Sep 17 00:00:00 2001 > From: Jim Meyering <[email protected]> > Date: Mon, 16 Feb 2009 17:54:57 +0100 > Subject: [PATCH 1/2] gpt: add a test: printing a partition table must not > modify it > > * tests/t0200-gpt.sh: New file. > * tests/Makefile.am (TESTS): Add the new test. > --- > tests/Makefile.am | 1 + > tests/t0200-gpt.sh | 55 > ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 56 insertions(+), 0 deletions(-) > create mode 100755 tests/t0200-gpt.sh > > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 1214f9c..14e4862 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -1,6 +1,7 @@ > TESTS = \ > t0000-basic.sh \ > t0100-print.sh \ > + t0200-gpt.sh \ > t1000-mkpartfs.sh \ > t1100-busy-label.sh \ > t1500-small-ext2.sh \ > diff --git a/tests/t0200-gpt.sh b/tests/t0200-gpt.sh > new file mode 100755 > index 0000000..013b0a4 > --- /dev/null > +++ b/tests/t0200-gpt.sh > @@ -0,0 +1,55 @@ > +#!/bin/sh <SNIP> > + > +test_description='ensure that printing a partition table does not modify it' > + > +: ${srcdir=.} > +. $srcdir/test-lib.sh > + > +N=2M > +dev=loop-file > +test_expect_success \ > + 'create a file large enough to hold a gpt partition table' \ > + "dd if=/dev/null of=$dev bs=1 seek=$N 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 \ > + 'save a copy of the original primary GPT table' \ > + 'dd if=$dev of=before count=1 skip=1'
isn't bs=512 missing here ^^^ ? > + > +test_expect_success \ > + 'extend the backing file by 1 byte' \ > + 'printf x >> $dev' > + > +test_expect_success \ > + 'use parted simply to print the partition table' \ > + 'parted -m -s $dev p > out 2> err' > +# FIXME compare expected out and err > + > +test_expect_success \ > + 'extract the primary GPT table again' \ > + 'dd if=$dev of=after count=1 skip=1' isn't bs=512 missing here ^^^ ? > + > +test_expect_success \ > + 'compare partition tables (they had better be identical)' \ > + 'compare before after' > + > +test_done > -- -- 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

