[parted-devel] [PATCH 4/4] Add test for msdos starting sector.

Joel Granados jgranado at redhat.com
Mon May 18 09:21:48 UTC 2009


Shit!!! just notice a very big no-no!!!
On Wed, May 13, 2009 at 05:24:33PM +0200, Joel Granados Moreno wrote:
> * tests/t4100-msdos-starting-sector.sh : Make sure we are consistent
>   when displaying starting sector for msdos lables.
> ---
>  tests/Makefile.am                    |    1 +
>  tests/t4100-msdos-starting-sector.sh |   91 ++++++++++++++++++++++++++++++++++
>  2 files changed, 92 insertions(+), 0 deletions(-)
>  create mode 100755 tests/t4100-msdos-starting-sector.sh
> 
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 0beedd4..2931e98 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -15,6 +15,7 @@ TESTS = \
>    t4000-sun-raid-type.sh \
>    t4100-msdos-partition-limits.sh \
>    t4100-dvh-partition-limits.sh \
> +  t4100-msdos-starting-sector.sh \
>    t4200-partprobe.sh \
>    t5000-tags.sh \
>    t6000-dm.sh \
> diff --git a/tests/t4100-msdos-starting-sector.sh b/tests/t4100-msdos-starting-sector.sh
> new file mode 100755
> index 0000000..f70dbc9
> --- /dev/null
> +++ b/tests/t4100-msdos-starting-sector.sh
> @@ -0,0 +1,91 @@
> +#!/bin/sh
> +
> +# Copyright (C) 2008 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='Consistency in msdos free space starting sector.'
> +
> +: ${srcdir=.}
> +. $srcdir/test-lib.sh
> +
> +######################################################################
> +# parted 1.8.8.1 and earlier was inconsistent when calculating the
> +# start sector for free space in msdos type lables.  parted was not
> +# consistent in the use of metadata padding for msdos labels.
> +######################################################################
> +
> +N=100
> +dev=loop-file
> +test_expect_success \
> +    'create a file to simulate the underlying device' \
> +    'dd if=/dev/zero of=$dev bs=1K count=$N 2> /dev/null'
> +
> +test_expect_success \
> +    'label the test disk' \
> +    'parted -s $dev mklabel msdos > out 2>&1'
> +test_expect_success 'expect no output' 'compare out /dev/null'
> +
> +# Test the output of print free with no partitions.
> +fail=0
> +cat <<EOF > exp || fail=1
> +Model:  (file)
> +Disk $(pwd)/$dev: 200s
> +Sector size (logical/physical): 512B/512B
> +Partition Table: msdos
> +
> +Number  Start  End   Size  Type  File system  Flags
> +        32s    127s  96s         Free Space
> +
> +EOF
> +
> +test_expect_success 'create expected output file' 'test $fail = 0'
> +
> +test_expect_success \
> +    'display output of label without partitions' \
> +    'parted -s $dev unit s print free > out 2>&1'
> +
> +test_expect_success \
> +    'check for expected output' \
> +    'compare out exp'
> +
> +# Test the output of print free with one partition.
> +fail=0
> +cat <<EOF > exp || fail=1
> +Model:  (file)
> +Disk $(pwd)/$dev: 200s
> +Sector size (logical/physical): 512B/512B
> +Partition Table: msdos
> +
> +Number  Start  End   Size  Type     File system  Flags
> +        32s    96s   65s            Free Space
> +         1      97s    195s  99s   primary
> +
> +EOF
> +
> +test_expect_success 'create expected output file' 'test $fail = 0'
> +
> +test_expect_success \
> +    'create a partition at the end of the label' \
> +    'parted -s $dev mkpart primary 50K 100K'
> +
> +test_expect_success \
> +    'display output of label with partition' \
> +    'parted -s $dev unit s print free > out 2>&1'
> +
> +test_expect_success \
> +    'check for expected output' \
> +    'compare out exp; cp out /tmp/out ; cp exp /tmp/exp'

This does not belong in the test ^^^^^^^^^^^^^^^^^^^^^
Will correct.

> +
> +test_done
> -- 
> 1.6.0.6
> 
> 
> _______________________________________________
> parted-devel mailing list
> parted-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/parted-devel

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



More information about the parted-devel mailing list