All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Testcase for checking msdos and gpt partitions logic
@ 2010-03-16  9:56 BVK Chaitanya
  2010-03-16 17:22 ` BVK Chaitanya
  2010-04-07 11:11 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 2 replies; 4+ messages in thread
From: BVK Chaitanya @ 2010-03-16  9:56 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

Hi,


Attached patch adds a testcase for checking msdos and gpt partition
modules, part_msdos and part_gpt.  This testcase uses parted tool to
create disk images with different partitions and uses grub-shell to
check whether grub is able to recognize them or not.


-- 
bvk.chaitanya

[-- Attachment #2: partmap-test.patch.txt --]
[-- Type: text/plain, Size: 9661 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: bvk.groups@gmail.com-20100316170632-ezfxl7ar6a32v8g1
# target_branch: file:///home/bvk/work/grub2/mainline/
# testament_sha1: 310d6d70b5a1bbb1280b6f9a0a948fbc3fd03905
# timestamp: 2010-03-16 22:36:36 +0530
# base_revision_id: bvk.groups@gmail.com-20100314170717-\
#   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 17:06:32 +0000
@@ -0,0 +1,141 @@
+#! /bin/sh -e
+
+parted=/sbin/parted
+grubshell=@builddir@/grub-shell
+
+create_disk_image () {
+    name=$1
+    size=$2
+    qemu-img create ${name} ${size} >/dev/null
+}
+
+check_output () {
+    outfile=$1
+    shift
+
+    for id in $@; do
+	if ! grep "($id)" ${outfile} >/dev/null
+	then
+	    echo "disk/partiton not found: $id (in ${$outfile})"
+	    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
+#
+
+# 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
+
+

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWRhPZVIABXhfgEAwfm///16q
3wD///9+YAhrvr7cuVtkDSt697wdOkqkKAQaSE8pk00NAGIGgAAANNqGgAElCE9GmmpT2npKbKaZ
lAPRMT1BjU9T1AD1PUDjJk00wmRkDAjE0YIwg0aYABBJBJKeyKe1GTU9CfoUfqjankRkABoGhpiB
FJIyMlPUZjKnp6o/RRso8p7RQADIAABFIQEGmmgJkaNBSfqntTUeUep6TRp+qDQG1FFSAMChO2mG
MKbiOy2ppikHGXZDyodDwOdV8MyVP0xtgCVllV23fb/S6w/RQkEB3sQDFzW4nVCyRQDa0cd+gHIG
JS4M2NFNcQljy17Mlbs7cNH42xW2Z7UDgwhV0IH3/zyOn64+yBegbkD3QJCHXBA7Jyz8fzKICpAS
gOqEBBs/Ohu9qZDAPDLxFuK8IXDReM695NVMBCzq7aJSyo00pTSUnaS6q6RfJnUpdc3XFHrXZaQU
WxssJtlURIJVNJnhU0iSqqoKLglB10M2GJ4zbZ987NkbkMDQU/mdN6WbPFAXpKwCYsoNmMUwwOjh
Ape98RGlAWoBo7wT1CByQhTHPCG/od1JH9rOeP1Mcdu3LdtrrpM5QQyMavQFtkA6pzGRA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OkJeTUDzMd3
fPLPFduou2eqBmt6R4f1kalDMbxCUhNj/RhOphhVl4MRxQO6XKpYhaAxp0TJqE6zUBRSgRAhkgEa
rN+svM23mcyDs530ORJk3Hb5fdYVv6ex5Gk8+BJAkgQIQIEZcaN8XS3AVb/fUB3HQBoCP3C/FGoD
esXo8Of7IG7suS/LqJTDL21KrsQM86hgnULIwmBQrbsoz0x4OgWNPxyxVoSKO7Lzu9v4Pcj8sQAb
xDSK5i/HsUHnq/OJPkeiVxV586XtqZoOSSUNubCm2d4w2E55tLroakaJuVcphCBD4kPt2JK1RDQm
AvVA8UYC4KSwAhlYgZp+aAohLkCFRMcsUOiUoQLReMIFQhwRxCG1HSBIV1tTbMShEefA40EPsXcE
CzQXNYO4SaheFiQwQQ0Pv62lSY2CWMy+2gzgPYJNm7y71CerFA2C8hdhcBd8KeSBaYIGctSHu9Jt
wp65CFdqO7nvUD14iG/bt/MksjjyggPABfogc8+dArZxXBLyRGGZcTzbgrDk65xWmSPfVoQNIhr8
uc7XpxkgdnC44WMAeE077lCi6MNuLdy2Ct797lSlyNV4KlkAkpqEkGUJBMrWWpAicCZIECYFVIRI
QLUZenZTiKRqzdSqeeDSSyEN2hLConz+ZUoaXxjQpmSEjrqxjmIW48hHZAlYwCQB42BVUgSqWhAn
qE7IrnAhRQ7ECniVCaclq3dThE07OWIofs044bDFkjBimttEIos0yQJTCrOHMQoob+cIFYb898I3
iEALwDiBWyS1X5e095eBJXIq7IMXS1toV53EQQBvY0G5RWBA2EwhagWIElQP+LuSKcKEgMJ7KpA=

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-07 11:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-16  9:56 [PATCH] Testcase for checking msdos and gpt partitions logic BVK Chaitanya
2010-03-16 17:22 ` BVK Chaitanya
2010-04-07 11:15   ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-04-07 11:11 ` Vladimir 'φ-coder/phcoder' Serbinenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.