3 # Copyright (C) 2007-2010 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 test_description="test bios_grub flag in gpt labels"
25 N=300 # number of sectors
29 end_sector=$(expr $start_sector + $part_sectors - 1)
32 "setup: reasonable params" \
33 'test $end_sector -lt $N'
36 "setup: create zeroed device" \
37 'dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null'
41 'parted -s $dev mklabel gpt > empty 2>&1'
43 test_expect_success 'ensure there was no output' \
44 'compare /dev/null empty'
47 'print the table (before adding a partition)' \
48 'parted -m -s $dev unit s print > t 2>&1 &&
49 sed 's,.*/$dev:,$dev:,' t > out'
52 'check for expected output' \
53 'printf "BYT;\n$dev:${N}s:file:$ss:$ss:gpt:;\n" > exp &&
58 'parted -s $dev u s mkpart name1 ${start_sector} ${end_sector} >out 2>&1'
61 'print the table before modification' \
63 parted -m -s $dev unit s print > t 2>&1 &&
64 sed 's,.*/$dev:,$dev:,' t >> out
68 'set the new bios_grub attribute' \
69 'parted -m -s $dev set 1 bios_grub on'
72 'print the table after modification' \
74 parted -m -s $dev unit s print > t 2>&1
75 sed 's,.*/$dev:,$dev:,' t >> out
82 $dev:${N}s:file:$ss:$ss:gpt:;
83 1:${start_sector}s:${end_sector}s:${part_sectors}s::name1:;
85 $dev:${N}s:file:$ss:$ss:gpt:;
86 1:${start_sector}s:${end_sector}s:${part_sectors}s::name1:bios_grub;
90 test_expect_success 'check for expected output' \