Blob Blame History Raw
From c89f2b7c9bfa0961058179bdaad17cbc05257387 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Tue, 30 Apr 2013 17:41:32 +0200
Subject: [PATCH 399/482] 	Add few more tests.

---
 ChangeLog                   |   4 ++
 Makefile.util.def           |  12 ++++
 tests/ahci_test.in          |   3 +-
 tests/cdboot_test.in        |   3 +-
 tests/core_compress_test.in |   2 +-
 tests/ehci_test.in          |   3 +-
 tests/fddboot_test.in       |   5 +-
 tests/grub_cmd_date.in      |  17 +++--
 tests/grub_cmd_set_date.in  |  35 ++++++++++
 tests/grub_cmd_sleep.in     |  20 ++++++
 tests/hddboot_test.in       |   3 +-
 tests/netboot_test.in       |   3 +-
 tests/ohci_test.in          |   3 +-
 tests/partmap_test.in       | 160 +++++++++++++++++++++++++++++++++++++++++++-
 tests/pata_test.in          |   3 +-
 tests/uhci_test.in          |   3 +-
 tests/util/grub-shell.in    |   6 +-
 17 files changed, 265 insertions(+), 20 deletions(-)
 create mode 100644 tests/grub_cmd_set_date.in
 create mode 100644 tests/grub_cmd_sleep.in

diff --git a/ChangeLog b/ChangeLog
index b924457..642858c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2013-04-30  Vladimir Serbinenko  <phcoder@gmail.com>
 
+	Add few more tests.
+
+2013-04-30  Vladimir Serbinenko  <phcoder@gmail.com>
+
 	* include/grub/arc/arc.h: Account for missing "other" peripheral on
 	ARCS. All users updated.
 
diff --git a/Makefile.util.def b/Makefile.util.def
index 3cfc592..fbd37eb 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -702,6 +702,18 @@ script = {
 
 script = {
   testcase;
+  name = grub_cmd_set_date;
+  common = tests/grub_cmd_set_date.in;
+};
+
+script = {
+  testcase;
+  name = grub_cmd_sleep;
+  common = tests/grub_cmd_sleep.in;
+};
+
+script = {
+  testcase;
   name = grub_script_expansion;
   common = tests/grub_script_expansion.in;
 };
diff --git a/tests/ahci_test.in b/tests/ahci_test.in
index fa5314c..e7d26ac 100644
--- a/tests/ahci_test.in
+++ b/tests/ahci_test.in
@@ -20,12 +20,13 @@ grubshell=@builddir@/grub-shell
 . "@builddir@/grub-core/modinfo.sh"
 
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # PLATFORM: Don't mess with real devices when OS is active
     *-emu)
 	exit 0;;
     # FIXME: qemu gets bonito DMA wrong
     mipsel-loongson)
 	exit 0;;
-    # no AHCI on ARC and qemu-mips platforms
+    # PLATFORM: no AHCI on ARC and qemu-mips platforms
     mips*-arc | mips*-qemu_mips)
 	exit 0;;
     # FIXME: No native drivers are available for those
diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in
index 097964f..1cc9019 100644
--- a/tests/cdboot_test.in
+++ b/tests/cdboot_test.in
@@ -20,9 +20,10 @@ grubshell=@builddir@/grub-shell
 . "@builddir@/grub-core/modinfo.sh"
 
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # PLATFORM: emu is different
     *-emu)
 	exit 0;;
-    # Flash targets
+    # PLATFORM: Flash targets
     i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
 	exit 0;;
     # FIXME: currently grub-shell uses only -kernel for loongson
diff --git a/tests/core_compress_test.in b/tests/core_compress_test.in
index bd57f6f..f97c024 100644
--- a/tests/core_compress_test.in
+++ b/tests/core_compress_test.in
@@ -19,8 +19,8 @@ grubshell=@builddir@/grub-shell
 
 . "@builddir@/grub-core/modinfo.sh"
 
-# FIXME: Only mips currently supports configurable core compression
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # FIXME: Only mips currently supports configurable core compression
     *-emu | i386-* | x86_64-* | sparc64-* | ia64-*)
 	exit 0
 	;;
diff --git a/tests/ehci_test.in b/tests/ehci_test.in
index d9999f8..5cfe726 100644
--- a/tests/ehci_test.in
+++ b/tests/ehci_test.in
@@ -20,12 +20,13 @@ grubshell=@builddir@/grub-shell
 . "@builddir@/grub-core/modinfo.sh"
 
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # PLATFORM: Don't mess with real devices when OS is active
     *-emu)
 	exit 0;;
     # FIXME: qemu gets bonito DMA wrong
     mipsel-loongson)
 	exit 0;;
-    # no USB on ARC and qemu-mips platforms
+    # PLATFORM: no USB on ARC and qemu-mips platforms
     mips*-arc | mips*-qemu_mips)
 	exit 0;;
     # FIXME: No native drivers are available for those
diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in
index 0866fdc..a05eb3e 100644
--- a/tests/fddboot_test.in
+++ b/tests/fddboot_test.in
@@ -20,9 +20,10 @@ grubshell=@builddir@/grub-shell
 . "@builddir@/grub-core/modinfo.sh"
 
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # PLATFORM: emu is different
     *-emu)
 	exit 0;;
-    # Flash targets
+    # PLATFORM: Flash targets
     i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
 	exit 0;;
     # FIXME: currently grub-shell uses only -kernel for loongson
@@ -40,7 +41,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     # FIXME: QEMU doesn't emulate SCSI floppies
     mipsel-arc | mips-arc)
 	exit 0;;
-    # powerpc doesn't boot from floppy except OldWorld Macs which we don't support anyway
+    # PLATFORM: powerpc doesn't boot from floppy except OldWorld Macs which we don't support anyway
     powerpc-ieee1275)
 	exit 0;;
 esac
diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in
index 0417c67..a459353 100644
--- a/tests/grub_cmd_date.in
+++ b/tests/grub_cmd_date.in
@@ -13,8 +13,17 @@ dt=`echo date | @builddir@/grub-shell`
 dtg="$(date -u -d "$dt" +%s)"
 ndt="$(date -u +%s)"
 
-if [ $pdt -le $dtg ] && [ $dtg -le $ndt ]; then
-    exit 0;
+if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then
+  echo "Date not in range: $pdt <= $dtg <= $ndt"
+  exit 1
+fi
+
+pdt="$(date -u +%s)"
+dt=`echo 'insmod datehook; echo $YEAR-$MONTH-$DAY $HOUR:$MINUTE:$SECOND' | @builddir@/grub-shell`
+dtg="$(date -u -d "$dt" +%s)"
+ndt="$(date -u +%s)"
+
+if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then
+  echo "Date not in range: $pdt <= $dtg <= $ndt"
+  exit 1
 fi
-echo "Date not in range: $pdt <= $dtg <= $ndt"
-exit 1
diff --git a/tests/grub_cmd_set_date.in b/tests/grub_cmd_set_date.in
new file mode 100644
index 0000000..c594ae3
--- /dev/null
+++ b/tests/grub_cmd_set_date.in
@@ -0,0 +1,35 @@
+#! /bin/bash
+set -e
+
+. "@builddir@/grub-core/modinfo.sh"
+
+case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # FIXME: OpenBIOS on sparc64 doesn't implement RTC
+    sparc64-ieee1275)
+	exit 0;;
+    # PLATFORM: ARC doesn't provide any way to set time
+    *-arc)
+	exit 0;;
+    # PLATFORM: EMU doesn't provide any way to set time
+    # Even if it did we'd need some kind of sandbox to avoid
+    # modifying real system time.
+    *-emu)
+	exit 0;;
+esac
+
+out=$(cat <<EOF | @builddir@/grub-shell
+insmod datehook
+date
+if [ \$YEAR = 2004 -a \$MONTH = 4 -a \$DAY = 4 -a \$HOUR = 20 -a \$MINUTE = 47 ]; then
+  hello
+  halt
+fi
+date 2004-04-04 20:47:00
+reboot
+EOF
+)
+
+if [ "$(echo "$out" | tail -n 1)" != "Hello World" ]; then
+  echo "Test failed: $out"
+  exit 1
+fi
diff --git a/tests/grub_cmd_sleep.in b/tests/grub_cmd_sleep.in
new file mode 100644
index 0000000..1c84fbf
--- /dev/null
+++ b/tests/grub_cmd_sleep.in
@@ -0,0 +1,20 @@
+#! /bin/bash
+set -e
+
+. "@builddir@/grub-core/modinfo.sh"
+
+# FIXME: OpenBIOS on sparc64 doesn't implement RTC
+if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then
+    exit 0
+fi
+
+# Compare RTC with interval timer.
+# Not 100% proper but should check that timer is running ok
+dt=`echo 'date; sleep 10; date' | @builddir@/grub-shell`
+dt1="$(date -u -d "$(echo "$dt" | head -n 1)" +%s)"
+dt2="$(date -u -d "$(echo "$dt" | tail -n 1)" +%s)"
+
+if [ $((dt2 - dt1)) -gt 11 ] || [ $((dt2 - dt1)) -lt 9 ]; then
+  echo "Interval not in range $dt2-$dt1 != 10"
+  exit 1
+fi
diff --git a/tests/hddboot_test.in b/tests/hddboot_test.in
index 34257a3..2cbbf97 100644
--- a/tests/hddboot_test.in
+++ b/tests/hddboot_test.in
@@ -20,9 +20,10 @@ grubshell=@builddir@/grub-shell
 . "@builddir@/grub-core/modinfo.sh"
 
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # PLATFORM: emu is different
     *-emu)
 	exit 0;;
-    # Flash targets
+    # PLATFORM: Flash targets
     i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
 	exit 0;;
     # FIXME: currently grub-shell uses only -kernel for loongson
diff --git a/tests/netboot_test.in b/tests/netboot_test.in
index aeb1db0..c757023 100644
--- a/tests/netboot_test.in
+++ b/tests/netboot_test.in
@@ -20,9 +20,10 @@ grubshell=@builddir@/grub-shell
 . "@builddir@/grub-core/modinfo.sh"
 
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # PLATFORM: emu is different
     *-emu)
 	exit 0;;
-    # Flash targets
+    # PLATFORM: Flash targets
     i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
 	exit 0;;
     # FIXME: currently grub-shell uses only -kernel for loongson
diff --git a/tests/ohci_test.in b/tests/ohci_test.in
index d6c1e0c..f841bd2 100644
--- a/tests/ohci_test.in
+++ b/tests/ohci_test.in
@@ -20,12 +20,13 @@ grubshell=@builddir@/grub-shell
 . "@builddir@/grub-core/modinfo.sh"
 
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # PLATFORM: Don't mess with real devices when OS is active
     *-emu)
 	exit 0;;
     # FIXME: qemu gets bonito DMA wrong
     mipsel-loongson)
 	exit 0;;
-    # no USB on ARC and qemu-mips platforms
+    # PLATFORM: no USB on ARC and qemu-mips platforms
     mips*-arc | mips*-qemu_mips)
 	exit 0;;
     # FIXME: No native drivers are available for those
diff --git a/tests/partmap_test.in b/tests/partmap_test.in
index 2d4b54e..5be7b9d 100644
--- a/tests/partmap_test.in
+++ b/tests/partmap_test.in
@@ -253,13 +253,19 @@ ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart
 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.  But I don't understand why GRUB displays
-# two partitions by default :-(
+# a partition by default.  Furthermore free space is also a partition,
+# so there is always at least 2 partitions
 #
 
 echo "Checking APPLE partition types..."
@@ -305,3 +311,153 @@ 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
+
diff --git a/tests/pata_test.in b/tests/pata_test.in
index 3671300..07d17b7 100644
--- a/tests/pata_test.in
+++ b/tests/pata_test.in
@@ -23,9 +23,10 @@ disk=hda
 indisk=ata0
 
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # PLATFORM: Don't mess with real devices when OS is active
     *-emu)
 	exit 0;;
-    # no ATA on ARC platforms (they use SCSI)
+    # PLATFORM: no ATA on ARC platforms (they use SCSI)
     *-arc)
 	exit 0;;
     # FIXME: No native drivers are available for those
diff --git a/tests/uhci_test.in b/tests/uhci_test.in
index ec6731c..3dea51c 100644
--- a/tests/uhci_test.in
+++ b/tests/uhci_test.in
@@ -20,12 +20,13 @@ grubshell=@builddir@/grub-shell
 . "@builddir@/grub-core/modinfo.sh"
 
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+    # PLATFORM: Don't mess with real devices when OS is active
     *-emu)
 	exit 0;;
     # FIXME: qemu gets bonito DMA wrong
     mipsel-loongson)
 	exit 0;;
-    # no USB on ARC and qemu-mips platforms
+    # PLATFORM: no USB on ARC and qemu-mips platforms
     mips*-arc | mips*-qemu_mips)
 	exit 0;;
     # FIXME: No native drivers are available for those
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 5b20ca3..1d7dfb8 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -103,7 +103,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	boot=cd
 	qemu=qemu-system-mips64
 	qemuopts="$qemuopts -M indy"
-	console=console
+	serial_port=arc/serial0/line0
+	console=
 	trim=1
 	;;
     mipsel-arc)
@@ -124,9 +125,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     mipsel-loongson)
 	boot=mipsel_fulong2e
 	qemu=qemu-system-mips64el
-	qemuopts="$qemuopts -no-reboot -M fulong2e"
+	qemuopts="$qemuopts -M fulong2e"
 	console=
-	halt_cmd=reboot
 	trim=1
 	;;
     i386-coreboot)
-- 
1.8.2.1