2
# the most basic 'print' test
3
# Copyright (C) 2007, 2009-2012 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
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
28
Sector size (logical/physical): ${ss}B/${ss}B
29
Partition Table: msdos
32
Number Start End Size Type File system Flags
35
} > exp || framework_failure
37
# Using msdos_magic='\x55\xaa' looks nicer, but isn't portable.
38
# dash's builtin printf doesn't recognize such \xHH hexadecimal escapes.
39
msdos_magic='\125\252'
41
# The extra 3KB+ zero bytes at the end are to avoid triggering a failure
42
# on linux-2.6.8 that's probably related to opening with O_DIRECT.
43
# Note that the minimum number of appended zero bytes required to avoid
44
# the failure was 3465. Here, we append a little more to make the resulting
45
# file have a total size of exactly 8 sectors.
46
# setup: create the most basic partition table, manually
47
{ dd if=/dev/zero bs=510 count=1; printf "$msdos_magic"
48
dd if=/dev/zero bs=$(expr 8 '*' $ss - 510) count=1; } > $dev || fail=1
50
# print the empty table
51
parted -s $dev unit s print >out 2>&1 || fail=1
53
# prepare actual and expected output
54
sed 's/ $//' out > k && mv k out || fail=1 # Remove trailing blank.
55
mv out o2 && sed "s,^Disk .*/$dev:,Disk .../$dev:," o2 > out || fail=1
57
# check for expected output
58
compare exp out || fail=1