3 # Copyright (C) 2007,2008 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"
26 "setup: create zeroed device" \
27 '{ dd if=/dev/zero bs=1024 count=64; } > $dev'
31 'parted -s $dev mklabel gpt >out 2>&1'
35 'parted -s $dev mkpart primary 0 1 >>out 2>&1'
38 'print the table (before manual modification)' \
39 'parted -s $dev print >>out 2>&1'
41 # Using bios_boot_magic='\x48\x61' looks nicer, but isn't portable.
42 # dash's builtin printf doesn't recognize such \xHH hexadecimal escapes.
43 bios_boot_magic='\110\141\150\41\111\144\157\156\164\116\145\145\144\105\106\111'
45 printf "$bios_boot_magic" | dd of=$dev bs=1024 seek=1 conv=notrunc
48 'print the table (after manual modification)' \
49 'parted -s $dev print >>out 2>&1'
58 Sector size (logical/physical): 512B/512B
61 Number Start End Size File system Name Flags
62 1 17.4kB 48.6kB 31.2kB primary
66 Sector size (logical/physical): 512B/512B
69 Number Start End Size File system Name Flags
70 1 17.4kB 48.6kB 31.2kB primary bios_grub
76 'prepare actual and expected output' \
78 mv out o2 && sed "s,^Disk .*/$dev:,Disk .../$dev:," o2 > out'
80 test_expect_success 'check for expected output' '$compare out exp'