blob: 499af8ac104b76f57c4cfaad03e360154ca5d1b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#!/bin/sh
# verify that partition maxima-querying functions work
# Copyright (C) 2009-2014, 2019-2023 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
ss=$sector_size_
dev=dev-file
PATH="..:$PATH"
export PATH
max_n_partitions()
{
case $1 in
# Technically, msdos partition tables have no limit on the maximum number
# of partitions, but we pretend it is 64 due to implementation details.
msdos) m=64;;
gpt) m=128;;
dvh) m=16;;
sun) m=8;;
mac) m=65536;;
bsd) m=8;;
amiga) m=128;;
atari) m=12;;
loop) m=1;;
pc98) case $ss in 512) m=16;; *) m=64;; esac;;
*) warn_ invalid partition table type: $1 1>&2; exit 1;;
esac
echo $m
}
# FIXME: add aix when/if it's supported again
for t in msdos gpt dvh sun mac bsd amiga atari loop pc98; do
echo $t
[ $t = 'atari' ] && [ $ss != 512 ] && continue
rm -f $dev
dd if=/dev/zero of=$dev bs=$ss count=1 seek=10000 || { fail=1; continue; }
parted -s $dev mklabel $t || { fail=1; continue; }
#case $t in pc98) sleep 999d;; esac
max_start=4294967295
max_len=4294967295
case $t in
atari) max_start=2147483647; max_len=$max_start;;
gpt|loop) max_start=18446744073709551615; max_len=$max_start;;
sun) max_start=549755813760;; # 128 * (2^32-1)
esac
print-max $dev > out 2>&1 || fail=1
m=$(max_n_partitions $t) || fail=1
printf '%s\n' "max len: $max_len" \
"max start sector: $max_start" \
"max number of partitions: $m" \
> exp || fail=1
compare exp out || fail=1
done
Exit $fail
|