[parted-devel] [PATCH 4/4] Add test for msdos starting sector.
Joel Granados
jgranado at redhat.com
Tue May 26 13:01:34 UTC 2009
Jim.
Thx, the changes you introduced seem sound.
regards.
On Tue, May 26, 2009 at 02:43:42PM +0200, Jim Meyering wrote:
> Jim Meyering wrote:
> > Joel Granados Moreno wrote:
> >> * tests/t4100-msdos-starting-sector.sh : Make sure we are consistent
> >> when displaying starting sector for msdos lables.
> ...
> >> +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
> >
> > Thanks for adding the test.
> >
> > Would you please adjust this to use parted's -m option
> > and to filter out the "Disk.*:" part?
>
> I've gone ahead and done it:
>
> From 560909f2452914848134376ba3c75b05c4ed6b7e Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Tue, 26 May 2009 14:36:18 +0200
> Subject: [PATCH] tests: adjust t4100-msdos-starting-sector.sh
>
> * tests/t4100-msdos-starting-sector.sh: Use parted's -m option
> when printing, and adjust expected output to match.
> Filter out "Disk...:" part to avoid false-positive failures due
> to mount-point- related differences.
> ---
> tests/t4100-msdos-starting-sector.sh | 36 +++++++++++++--------------------
> 1 files changed, 14 insertions(+), 22 deletions(-)
>
> diff --git a/tests/t4100-msdos-starting-sector.sh b/tests/t4100-msdos-starting-sector.sh
> index f70dbc9..6a5916b 100755
> --- a/tests/t4100-msdos-starting-sector.sh
> +++ b/tests/t4100-msdos-starting-sector.sh
> @@ -1,6 +1,6 @@
> #!/bin/sh
>
> -# Copyright (C) 2008 Free Software Foundation, Inc.
> +# Copyright (C) 2008, 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
> @@ -40,38 +40,29 @@ 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
> -
> +BYT;
> +path:200s:file:512:512:msdos:;
> +1:32s:127s:96s:free;
> 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'
> + 'parted -m -s $dev unit s print free > out 2>&1'
>
> test_expect_success \
> 'check for expected output' \
> - 'compare out exp'
> + 'sed "2s/^[^:]*:/path:/" < out > k; mv k out
> + 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
> -
> +BYT;
> +path:200s:file:512:512:msdos:;
> +1:32s:96s:65s:free;
> +1:97s:195s:99s:::;
> EOF
>
> test_expect_success 'create expected output file' 'test $fail = 0'
> @@ -82,10 +73,11 @@ test_expect_success \
>
> test_expect_success \
> 'display output of label with partition' \
> - 'parted -s $dev unit s print free > out 2>&1'
> + 'parted -m -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'
> + 'sed "2s/^[^:]*:/path:/" < out > k; mv k out
> + compare out exp'
>
> test_done
> --
> 1.6.3.1.268.g94d6d1
--
Joel Andres Granados
Brno, Czech Republic, Red Hat.
More information about the parted-devel
mailing list