OSDN Git Service

libparted: avoid unwarranted failed assertion during mklabel
[android-x86/external-parted.git] / tests / t9021-maxima.sh
1 #!/bin/sh
2 # verify that partition maxima-querying functions work
3
4 # Copyright (C) 2009-2012 Free Software Foundation, Inc.
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 . "${srcdir=.}/init.sh"; path_prepend_ ../parted
20 ss=$sector_size_
21
22 dev=dev-file
23 PATH="..:$PATH"
24 export PATH
25
26 # FIXME: add aix when/if it's supported again
27 for t in msdos gpt dvh sun mac bsd amiga loop pc98; do
28     echo $t
29     rm -f $dev
30     dd if=/dev/zero of=$dev bs=$ss count=1 seek=10000 || { fail=1; continue; }
31     parted -s $dev mklabel $t || { fail=1; continue; }
32
33     #case $t in pc98) sleep 999d;; esac
34
35     max_start=4294967295
36     max_len=4294967295
37     case $t in
38         gpt|loop) max_start=18446744073709551615; max_len=$max_start;;
39         sun) max_start=549755813760;; # 128 * (2^32-1)
40     esac
41
42     print-max $dev > out 2>&1 || fail=1
43     printf '%s\n' "max len: $max_len" \
44         "max start sector: $max_start" > exp || fail=1
45     compare exp out || fail=1
46 done
47
48 Exit $fail