* tests/partmap_test.in: Replace qemu-img usage with dd to decrease

dependencies.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-03-10 14:35:17 +01:00
parent 7eea167113
commit 3fd8bae5cf
2 changed files with 39 additions and 33 deletions

View file

@ -1,3 +1,8 @@
2012-03-10 Vladimir Serbinenko <phcoder@gmail.com>
* tests/partmap_test.in: Replace qemu-img usage with dd to decrease
dependencies.
2012-03-10 Richard Laager <rlaager@wiktel.com>
* util/grub.d/10_linux.in: Fix ZFS root passing.

View file

@ -20,9 +20,10 @@ parted=parted
grubshell=@builddir@/grub-shell
create_disk_image () {
name=$1
name="$1"
size=$2
qemu-img create ${name} ${size} >/dev/null
rm -f "${name}"
dd if=/dev/zero of="${name}" bs=512 count=1 seek=$((size * 2048 - 1)) status=noxfer > /dev/null
}
check_output () {
@ -62,61 +63,61 @@ outfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
echo "Checking MSDOS partition types..."
# 0 primary
create_disk_image ${imgfile} 64M
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel msdos
list_parts part_msdos ${imgfile} ${outfile}
check_output ${outfile} hd0
# 1 primary
create_disk_image ${imgfile} 64M
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} hd0 hd0,msdos1
# 2 primary
create_disk_image ${imgfile} 128M
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} hd0 hd0,msdos1 hd0,msdos2
# 3 primary
create_disk_image ${imgfile} 128M
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} hd0 hd0,msdos1 hd0,msdos2 hd0,msdos3
# 4 primary
create_disk_image ${imgfile} 128M
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} hd0 hd0,msdos1 hd0,msdos2 hd0,msdos3 hd0,msdos4
# 1 primary, 1 extended
create_disk_image ${imgfile} 128M
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} hd0 hd0,msdos1
# 1 primary, 1 extended, 1 logical
create_disk_image ${imgfile} 128M
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} hd0 hd0,msdos1 hd0,msdos5
# 1 primary, 1 extended, 2 logical
create_disk_image ${imgfile} 128M
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} hd0 hd0,msdos1 hd0,msdos5 hd0,msdos6
# 1 primary, 1 extended, 3 logical
create_disk_image ${imgfile} 128M
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} hd0 hd0,msdos1 hd0,msdos5 hd0,msdos6 hd0,msdos7
# 1 primary, 1 extended, 4 logical
create_disk_image ${imgfile} 128M
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} hd0 hd0,msdos1 hd0,msdos5 hd0,msdos6 hd0,msdos7 hd0,msdos8
@ -129,43 +130,43 @@ check_output ${outfile} hd0 hd0,msdos1 hd0,msdos5 hd0,msdos6 hd0,msdos7 hd0,msdo
echo "Checking GPT partition types..."
# 0 parts
create_disk_image ${imgfile} 64M
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel gpt
list_parts part_gpt ${imgfile} ${outfile}
check_output ${outfile} hd0
# 1 parts
create_disk_image ${imgfile} 64M
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} hd0 hd0,gpt1
# 2 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,gpt1 hd0,gpt2
# 3 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3
# 4 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 hd0,gpt4
# 5 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 hd0,gpt4 hd0,gpt5
# 6 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 hd0,gpt4 hd0,gpt5 hd0,gpt6
@ -180,43 +181,43 @@ check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 hd0,gpt4 hd0,gpt5 hd0,gpt
echo "Checking SUN partition types..."
# 0 parts
create_disk_image ${imgfile} 64M
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel sun
list_parts part_sun ${imgfile} ${outfile}
check_output ${outfile} hd0
# 1 parts
create_disk_image ${imgfile} 64M
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel sun mkpart 0 10M
list_parts part_sun ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,sun1
# 2 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,sun1 hd0,sun2
# 3 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,sun1 hd0,sun2 hd0,sun4
# 4 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,sun1 hd0,sun2 hd0,sun4 hd0,sun5
# 5 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,sun1 hd0,sun2 hd0,sun4 hd0,sun5 hd0,sun6
# 6 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,sun1 hd0,sun2 hd0,sun4 hd0,sun5 hd0,sun6 hd0,sun7
@ -233,43 +234,43 @@ check_output ${outfile} hd0 hd0,sun1 hd0,sun2 hd0,sun4 hd0,sun5 hd0,sun6 hd0,sun
echo "Checking APPLE partition types..."
# 0 parts
create_disk_image ${imgfile} 64M
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel mac
list_parts part_apple ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,apple1 hd0,apple2
# 1 parts
create_disk_image ${imgfile} 64M
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} hd0 hd0,apple1 hd0,apple2 hd0,apple3
# 2 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,apple1 hd0,apple2 hd0,apple3 hd0,apple4
# 3 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5
# 4 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5 hd0,apple6
# 5 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5 hd0,apple6 hd0,apple7
# 6 parts
create_disk_image ${imgfile} 128M
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} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5 hd0,apple6 hd0,apple7 hd0,apple8