# Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: address@hidden # target_branch: file:///home/bvk/work/grub2/mainline/ # testament_sha1: 12ce4233169a3be0392e18848dd0babe4ecba40f # timestamp: 2010-03-17 03:07:22 +0530 # base_revision_id: address@hidden # q8ppihzgyjyifcke # # Begin patch === modified file 'conf/tests.rmk' --- conf/tests.rmk 2010-01-22 13:37:27 +0000 +++ conf/tests.rmk 2010-03-16 17:06:32 +0000 @@ -50,6 +50,9 @@ check_SCRIPTS += grub_script_vars1 grub_script_vars1_SOURCES = tests/grub_script_vars1.in +check_SCRIPTS += partmap_test +partmap_test_SOURCES = tests/partmap_test.in + # List of tests to execute on "make check" # SCRIPTED_TESTS = example_scripted_test # SCRIPTED_TESTS += example_grub_script_test @@ -59,6 +62,7 @@ SCRIPTED_TESTS = grub_script_echo1 SCRIPTED_TESTS += grub_script_echo_keywords SCRIPTED_TESTS += grub_script_vars1 +SCRIPTED_TESTS += partmap_test # dependencies between tests and testing-tools $(SCRIPTED_TESTS): grub-shell grub-shell-tester === added file 'tests/partmap_test.in' --- tests/partmap_test.in 1970-01-01 00:00:00 +0000 +++ tests/partmap_test.in 2010-03-16 21:04:27 +0000 @@ -0,0 +1,245 @@ +#! /bin/sh -e + +parted=/sbin/parted address@hidden@/grub-shell + +create_disk_image () { + name=$1 + size=$2 + qemu-img create ${name} ${size} >/dev/null +} + +check_output () { + outfile=$1 + shift + + for disk in $@; do + if ! grep "($disk)" ${outfile} >/dev/null + then + echo "($disk): disk/partiton not found" + exit 1 + fi + done +} + +imgfile=`mktemp` +outfile=`mktemp` + +# +# MSDOS partition types +# + +echo "Checking MSDOS partition types..." + +# 0 primary +create_disk_image ${imgfile} 64M +${parted} -s ${imgfile} mklabel msdos +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_msdos | tee ${outfile} +check_output ${outfile} hd0 + +# 1 primary +create_disk_image ${imgfile} 64M +${parted} -s ${imgfile} mklabel msdos mkpart primary 0 10M >/dev/null +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_msdos | tee ${outfile} +check_output ${outfile} hd0 hd0,1 + +# 2 primary +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_msdos | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 + +# 3 primary +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart primary 20M 30M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_msdos | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,3 + +# 4 primary +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_msdos | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,3 hd0,4 + +# 1 primary, 1 extended +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_msdos | tee ${outfile} +check_output ${outfile} hd0 hd0,1 + +# 1 primary, 1 extended, 1 logical +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_msdos | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,5 + +# 1 primary, 1 extended, 2 logical +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_msdos | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,5 hd0,6 + +# 1 primary, 1 extended, 3 logical +create_disk_image ${imgfile} 128M +${parted} -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 +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_msdos | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,5 hd0,6 hd0,7 + +# 1 primary, 1 extended, 4 logical +create_disk_image ${imgfile} 128M +${parted} -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 +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_msdos | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,5 hd0,6 hd0,7 hd0,8 + + +# +# GPT partition types +# + +echo "Checking GPT partition types..." + +# 0 parts +create_disk_image ${imgfile} 64M +${parted} -s ${imgfile} mklabel gpt +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_gpt | tee ${outfile} +check_output ${outfile} hd0 + +# 1 parts +create_disk_image ${imgfile} 64M +${parted} -s ${imgfile} mklabel gpt mkpart 1 0 10M >/dev/null +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_gpt | tee ${outfile} +check_output ${outfile} hd0 hd0,1 + +# 2 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_gpt | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 + +# 3 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_gpt | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,3 + +# 4 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 4 20M 30M mkpart 5 30M 40M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_gpt | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,3 hd0,4 + +# 5 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M mkpart 4 30M 40M mkpart 5 40M 50M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_gpt | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,3 hd0,4 hd0,5 + +# 6 parts +create_disk_image ${imgfile} 128M +${parted} -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 +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_gpt | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,3 hd0,4 hd0,5 hd0,6 + + +# +# 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} 64M +${parted} -s ${imgfile} mklabel sun +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_sun | tee ${outfile} +check_output ${outfile} hd0 + +# 1 parts +create_disk_image ${imgfile} 64M +${parted} -s ${imgfile} mklabel sun mkpart 0 10M >/dev/null +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_sun | tee ${outfile} +check_output ${outfile} hd0 hd0,1 + +# 2 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_sun | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 + +# 3 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_sun | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,4 + +# 4 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_sun | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,4 hd0,5 + +# 5 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_sun | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,4 hd0,5 hd0,6 + +# 6 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M mkpart 50M 60M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_sun | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,4 hd0,5 hd0,6 hd0,7 + + +# +# Apple partition types +# +# Partition table itself is part of some partition, so there is always +# a partition by default. But I don't understand why GRUB displays +# two partitions by default :-( +# + +echo "Checking APPLE partition types..." + +# 0 parts +create_disk_image ${imgfile} 64M +${parted} -s ${imgfile} mklabel mac +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_apple | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 + +# 1 parts +create_disk_image ${imgfile} 64M +${parted} -s ${imgfile} mklabel mac mkpart a 1M 10M >/dev/null +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_apple | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,3 + +# 2 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel mac mkpart a 1M 10M mkpart b 10M 20M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_apple | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,3 hd0,4 + +# 3 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_apple | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,4 hd0,5 + +# 4 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_apple | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,4 hd0,5 hd0,6 + +# 5 parts +create_disk_image ${imgfile} 128M +${parted} -s ${imgfile} mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M mkpart e 40M 50M +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_apple | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,4 hd0,5 hd0,6 hd0,7 + +# 6 parts +create_disk_image ${imgfile} 128M +${parted} -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 +echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" --modules=part_apple | tee ${outfile} +check_output ${outfile} hd0 hd0,1 hd0,2 hd0,4 hd0,5 hd0,6 hd0,7 hd0,8 # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWelae8MACbLfgEAwfu///36v 3wD////+YAwrwfDo92pRoAAGEVQiFUolRIopSGppqTaQAABkAAAAADQAAFNJHqBoe1TI0aDQaMgA aaDQAAGhhoqb9SRMBMmGg1M0jCMRk0yMJgCYAHGTJoxDTQwE0MTRpkxAyMJo00wgyYRRITTUxoiN PaRoEYRtEmjT0j0mjGkaeo2iaCKQgCDRo0hoR5BRqPaJpT9RiExNMIyabRJoQCAEJtSeAbcCVLmM MdVxmfrIlSyDL5p69Nogpcga5mA6RDmlMRGSin3QMMhv51UFVAAUKKBiqJbuQyfxDSCCwDNhJXIA ZmyCqIn1qsJmrs5Iqojqzqs2ifb48ASUQggqEtg+OnKmqZSzzUouEymfSZc+symUnROKlVOG0k4o vtMmrcUkIFK+RhdPcd/FEJ4nZH3VdpV0qvyVZADlM6rrpOGHvK1WxVqVfnRVo+jhMCC3iuGUkClU MQnIGflxQvpJay09hsQ+Hklv9Ouq9JBMJrVejCQB8DCUslS6eqDz0GhimzYGAcE3ddnW0Jmypo1W KGrVjc44hWmPpdfY4lRMrRo22hNO26uslOdAMaVNbQPd6WVUCw4zsaBTMDhlslTfOVNUrszncXgF 0eVNgScZyYMgSQhM5kpCyAk+xgLkhQkeaWnKNyhJhICLHHVjgVHctPI3qugLeCcwOZEQQQkuYRDE RHch3p0OGzEy8cJX4Tw2ifYq5LtVewaD3ivUYBPYIHRCFLMoQ7/VuLqptjivPbGtMprO0wiRNyCZ Mo0XCXxJJJdnqqq222T5AIFTPuJTo14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