summaryrefslogtreecommitdiffstats
path: root/tests/partmap_test.in
blob: 6ef518b0adc1e001bfc64c853ffb5c490d02330d (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
#! @BUILD_SHEBANG@
set -e

# Copyright (C) 2010  Free Software Foundation, Inc.
#
# GRUB 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.
#
# GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.

parted=parted
grubshell=@builddir@/grub-shell

. "@builddir@/grub-core/modinfo.sh"

create_disk_image () {
    name="$1"
    size=$2
    rm -f "${name}"
    dd if=/dev/zero of="${name}" bs=512 count=1 seek=$((size * 2048 - 1)) status=noxfer > /dev/null
}

create_dfly_image () {
    name="$1"
    rm -f ${name}
    
    gunzip < "@srcdir@/tests/dfly-mbr-mbexample.mbr.img.gz" | dd of=${name} bs=1 seek=440 count=72 conv=notrunc > /dev/null
    gunzip < "@srcdir@/tests/dfly-mbr-mbexample.dfly.img.gz" | dd of=${name} bs=512 seek=33 count=1 conv=notrunc > /dev/null
}

check_output () {
    outfile=$1
    shift

    for dsk in $@; do
	if ! grep "($dsk)" "${outfile}" >/dev/null
	then
	    echo "($dsk): disk/partiton not found"
	    exit 1
	fi
    done
}

list_parts () {
    mod=$1;
    shift;
    imgfile="$1"
    shift
    outfile="$1"
    shift

    echo ls | "${grubshell}" --disk="${imgfile}" \
	--modules=$mod | tr -d "\n\r" > "${outfile}"
    cat "${outfile}"
    echo
}

case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
    mips-qemu_mips | mipsel-qemu_mips | i386-qemu | i386-multiboot | i386-coreboot | mipsel-loongson)
	disk=ata0
	;;
    powerpc-ieee1275)
	disk=ieee1275//pci@80000000/mac-io@4/ata-3@20000/disk@0
	# FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
	exit 0
	;;
    sparc64-ieee1275)
	disk=ieee1275//pci@1fe\,0/pci-ata@5/ide0@500/disk@0
	# FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
	exit 0
	;;
    i386-ieee1275)
	disk=ieee1275/d
	# FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
	exit 0
	;;
    mips-arc)
	# FIXME: ARC firmware has bugs which prevent it from accessing hard disk w/o dvh disklabel.
	exit 0 ;;
    mipsel-arc)
	disk=arc/scsi0/disk0/rdisk0
	;;
    arm*-efi)
	disk=hd3
	;;
    *)
	disk=hd0
	;;
esac

if ! which parted >/dev/null 2>&1; then
   echo "parted not installed; cannot test partmap"
   exit 77
fi

imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1

#
# MSDOS partition types
#

echo "Checking MSDOS partition types..."

# 0 primary
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel msdos
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk

# 1 primary
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M 
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1

# 2 primary
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2

# 3 primary
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart primary 20M 30M
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2 $disk,msdos3

# 4 primary
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2 $disk,msdos3 $disk,msdos4

# 1 primary, 1 extended
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100%
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1

# 1 primary, 1 extended, 1 logical
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5

# 1 primary, 1 extended, 2 logical
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5 $disk,msdos6

# 1 primary, 1 extended, 3 logical
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M mkpart logical 40M 50M
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5 $disk,msdos6 $disk,msdos7

# 1 primary, 1 extended, 4 logical
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M mkpart logical 40M 50M mkpart logical 50M 60M
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5 $disk,msdos6 $disk,msdos7 $disk,msdos8


#
# GPT partition types
#

echo "Checking GPT partition types..."

# 0 parts
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel gpt
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk

# 1 parts
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M 
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,gpt1

# 2 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2

# 3 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3

# 4 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 4 20M 30M mkpart 5 30M 40M
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3 $disk,gpt4

# 5 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M mkpart 4 30M 40M mkpart 5 40M 50M
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3 $disk,gpt4 $disk,gpt5

# 6 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M mkpart 4 30M 40M mkpart 5 40M 50M mkpart 6 50M 60M
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3 $disk,gpt4 $disk,gpt5 $disk,gpt6


#
# SUN partition types
#
# It seems partition #3 is reserved for whole disk by parted.
#

echo "Checking SUN partition types..."

# 0 parts
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel sun
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk

# 1 parts
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M 
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,sun1

# 2 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,sun1 $disk,sun2

# 3 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4

# 4 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5

# 5 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5 $disk,sun6

# 6 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M mkpart 50M 60M
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5 $disk,sun6 $disk,sun7

# 7 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M mkpart 50M 60M mkpart 60M 70M
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5 $disk,sun6 $disk,sun7 $disk,sun8


#
# Apple partition types
#
# Partition table itself is part of some partition, so there is always
# a partition by default.  Furthermore free space is also a partition,
# so there is always at least 2 partitions
#

echo "Checking APPLE partition types..."

# 0 parts
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel mac
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2

# 1 parts
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple3

# 2 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple3 $disk,apple4

# 3 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5

# 4 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6

# 5 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M mkpart e 40M 50M
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6 $disk,apple7

# 6 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M mkpart e 40M 50M mkpart f 50M 60M
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6 $disk,apple7 $disk,apple8

#
# DVH partition types
#
# Partition #11 is reserved for whole disk by parted.
# Parted also aliases #9 as whole disk
#

echo "Checking DVH partition types..."

# 0 parts
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel dvh
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk

# 1 parts
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M 
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1

# 2 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2

# 3 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3

# 4 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4

# 5 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5

# 6 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6

# 7 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7

# 8 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8

# 9 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8  $disk,dvh10

# 10 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M mkpart primary 90M 100M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8 $disk,dvh10 $disk,dvh12

# 11 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M mkpart primary 90M 100M mkpart primary 100M 110M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8 $disk,dvh10 $disk,dvh12 $disk,dvh13

# 12 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M mkpart primary 90M 100M mkpart primary 100M 110M mkpart primary 110M 120M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8 $disk,dvh10 $disk,dvh12 $disk,dvh13 $disk,dvh14

# 13 parts
create_disk_image "${imgfile}" 135
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M mkpart primary 90M 100M mkpart primary 100M 110M mkpart primary 110M 120M mkpart primary 120M 130M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8 $disk,dvh10 $disk,dvh12 $disk,dvh13 $disk,dvh14 $disk,dvh15

# 14 parts
create_disk_image "${imgfile}" 145
${parted} -a none -s "${imgfile}" mklabel dvh mkpart primary 3M 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M mkpart primary 40M 50M mkpart primary 50M 60M mkpart primary 60M 70M mkpart primary 70M 80M mkpart primary 80M 90M mkpart primary 90M 100M mkpart primary 100M 110M mkpart primary 110M 120M mkpart primary 120M 130M mkpart primary 130M 140M
list_parts part_dvh "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,dvh1 $disk,dvh2 $disk,dvh3 $disk,dvh4 $disk,dvh5 $disk,dvh6 $disk,dvh7 $disk,dvh8 $disk,dvh10 $disk,dvh12 $disk,dvh13 $disk,dvh14 $disk,dvh15 $disk,dvh16

echo "Checking AMIGA partition types..."

# 0 parts
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel amiga
list_parts part_amiga "${imgfile}" "${outfile}"
check_output "${outfile}" $disk

# 1 parts
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M 
list_parts part_amiga "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,amiga1

# 2 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M
list_parts part_amiga "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2

# 3 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M mkpart x 20M 30M
list_parts part_amiga "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2 $disk,amiga3

# 4 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M mkpart x 20M 30M mkpart x 30M 40M
list_parts part_amiga "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2 $disk,amiga3 $disk,amiga4

# 5 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M mkpart x 20M 30M mkpart x 30M 40M mkpart x 40M 50M
list_parts part_amiga "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2 $disk,amiga3 $disk,amiga4 $disk,amiga5

# 6 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M mkpart x 20M 30M mkpart x 30M 40M mkpart x 40M 50M mkpart x 50M 60M
list_parts part_amiga "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2 $disk,amiga3 $disk,amiga4 $disk,amiga5 $disk,amiga6

# 7 parts
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel amiga mkpart x 0 10M mkpart x 10M 20M mkpart x 20M 30M mkpart x 30M 40M mkpart x 40M 50M mkpart x 50M 60M mkpart x 60M 70M
list_parts part_amiga "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,amiga1 $disk,amiga2 $disk,amiga3 $disk,amiga4 $disk,amiga5 $disk,amiga6 $disk,amiga7

#
# DragonFly BSD disklabel64
#

echo "Checking DragonFly BSD disklabel64..."

create_dfly_image "${imgfile}"
list_parts part_dfly "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos1,dfly1 $disk,msdos1,dfly2 $disk,msdos1,dfly3