grub2/0355-Add-test-to-check-that-different-boot-mediums-work.patch

656 lines
31 KiB
Diff
Raw Normal View History

2013-06-07 18:03:56 +00:00
From b8845d9e7e3df55d36d9a3440a147f293feb7e81 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Fri, 26 Apr 2013 14:33:31 +0200
Subject: [PATCH 355/482] Add test to check that different boot mediums
2013-06-07 18:03:56 +00:00
work.
---
ChangeLog | 4 ++++
Makefile.am | 38 ++++++++++++++++++-------------------
Makefile.util.def | 48 +++++++++++++++++++++++++++++++++++++++++++++++
tests/cdboot_test.in | 36 +++++++++++++++++++++++++++++++++++
tests/fddboot_test.in | 48 +++++++++++++++++++++++++++++++++++++++++++++++
tests/grub_cmd_date.in | 5 ++---
tests/gzcompress_test.in | 24 ++++++++++++++++++++++++
tests/hddboot_test.in | 37 ++++++++++++++++++++++++++++++++++++
tests/lzocompress_test.in | 24 ++++++++++++++++++++++++
tests/netboot_test.in | 42 +++++++++++++++++++++++++++++++++++++++++
tests/partmap_test.in | 8 ++++----
tests/util/grub-shell.in | 48 ++++++++++++++++++++++++++++++++++++++++-------
tests/xzcompress_test.in | 24 ++++++++++++++++++++++++
13 files changed, 353 insertions(+), 33 deletions(-)
create mode 100644 tests/cdboot_test.in
create mode 100644 tests/fddboot_test.in
create mode 100644 tests/gzcompress_test.in
create mode 100644 tests/hddboot_test.in
create mode 100644 tests/lzocompress_test.in
create mode 100644 tests/netboot_test.in
create mode 100644 tests/xzcompress_test.in
diff --git a/ChangeLog b/ChangeLog
index 6e007d5..19a1cf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2013-04-26 Vladimir Serbinenko <phcoder@gmail.com>
+ Add test to check that different boot mediums work.
+
+2013-04-26 Vladimir Serbinenko <phcoder@gmail.com>
+
* util/grub-mkrescue.in: Rename i386-ieee1275 core image due to
ofw limited ISO support.
diff --git a/Makefile.am b/Makefile.am
index 9d38405..9889023 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -261,70 +261,70 @@ kfreebsd-mfsroot.i386.gz: kfreebsd-mfsroot.i386.img
gzip < $< > $@
bootcheck-kfreebsd-i386: kfreebsd-mfsroot.i386.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.i386 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/mfsroot.gz=kfreebsd-mfsroot.i386.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.i386 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/mfsroot.gz=kfreebsd-mfsroot.i386.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.i386 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
kfreebsd-mfsroot.x86_64.gz: kfreebsd-mfsroot.x86_64.img
gzip < $< > $@
bootcheck-kfreebsd-x86_64: kfreebsd-mfsroot.x86_64.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/mfsroot.gz=kfreebsd-mfsroot.x86_64.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/mfsroot.gz=kfreebsd-mfsroot.x86_64.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
knetbsd.miniroot-image.i386.gz: knetbsd.miniroot-image.i386.img
gzip < $< > $@
bootcheck-knetbsd-i386: knetbsd.miniroot-image.i386.gz $(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/miniroot.gz=knetbsd.miniroot-image.i386.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/miniroot.gz=knetbsd.miniroot-image.i386.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-kopenbsd-i386: kopenbsd.image.i386 $(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/ramdisk=kopenbsd.image.i386 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/ramdisk=kopenbsd.image.i386 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-kopenbsd-x86_64: kopenbsd.image.x86_64 $(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/ramdisk=kopenbsd.image.x86_64 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/ramdisk=kopenbsd.image.x86_64 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
knetbsd.miniroot-image.x86_64.gz: knetbsd.miniroot-image.x86_64.img
gzip < $< > $@
bootcheck-knetbsd-x86_64: knetbsd.miniroot-image.x86_64.gz $(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/miniroot.gz=knetbsd.miniroot-image.x86_64.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/miniroot.gz=knetbsd.miniroot-image.x86_64.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-mips: linux-initramfs.mips $(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.mips --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.mips --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-ppc: linux-initramfs.ppc $(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.ppc --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux-ppc.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.ppc --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux-ppc.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-mipsel: linux-initramfs.mipsel $(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.mipsel --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.mipsel --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-loongson: linux-initramfs.loongson $(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.loongson --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.loongson --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux16-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux16-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-multiboot: multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/multiboot.elf=multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/multiboot.elf=multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-multiboot2: multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/multiboot2.elf=multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/multiboot2.elf=multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-kfreebsd-aout: kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/kfreebsd.aout=kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/kfreebsd.aout=kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-pc-chainloader: pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/pc-chainloader.bin=pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/pc-chainloader.bin=pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-ntldr: ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg grub-shell
- timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
+ ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
if COND_i386_efi
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386
diff --git a/Makefile.util.def b/Makefile.util.def
index 4fa37bc..1b71fd0 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -690,6 +690,54 @@ script = {
script = {
testcase;
+ name = hddboot_test;
+ common = tests/hddboot_test.in;
+};
+
+script = {
+ testcase;
+ name = fddboot_test;
+ common = tests/fddboot_test.in;
+};
+
+script = {
+ testcase;
+ name = cdboot_test;
+ common = tests/cdboot_test.in;
+};
+
+script = {
+ testcase;
+ name = netboot_test;
+ common = tests/netboot_test.in;
+};
+
+script = {
+ testcase;
+ name = pseries_test;
+ common = tests/pseries_test.in;
+};
+
+script = {
+ testcase;
+ name = xzcompress_test;
+ common = tests/xzcompress_test.in;
+};
+
+script = {
+ testcase;
+ name = gzcompress_test;
+ common = tests/gzcompress_test.in;
+};
+
+script = {
+ testcase;
+ name = lzocompress_test;
+ common = tests/lzocompress_test.in;
+};
+
+script = {
+ testcase;
name = grub_cmd_echo;
common = tests/grub_cmd_echo.in;
};
diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in
new file mode 100644
index 0000000..d9a5fb8
--- /dev/null
+++ b/tests/cdboot_test.in
@@ -0,0 +1,36 @@
+#! /bin/sh
+# Copyright (C) 2013 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/>.
+
+set -e
+grubshell=@builddir@/grub-shell
+
+. "@builddir@/grub-core/modinfo.sh"
+
+case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+ # Flash targets
+ i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
+ exit 0;;
+ # FIXME: currently grub-shell uses only -kernel for loongson
+ mipsel-loongson)
+ exit 0;;
+ # FIXME: OFW fails to open CD-ROM
+ i386-ieee1275)
+ exit 0;;
+esac
+
+if [ "$(echo hello | "${grubshell}" --boot=cd)" != "Hello World" ]; then
+ exit 1
+fi
diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in
new file mode 100644
index 0000000..7734025
--- /dev/null
+++ b/tests/fddboot_test.in
@@ -0,0 +1,48 @@
+#! /bin/sh
+# Copyright (C) 2013 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/>.
+
+set -e
+grubshell=@builddir@/grub-shell
+
+. "@builddir@/grub-core/modinfo.sh"
+
+case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+ # Flash targets
+ i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
+ exit 0;;
+ # FIXME: currently grub-shell uses only -kernel for loongson
+ mipsel-loongson)
+ exit 0;;
+ # FIXME: We don't support EFI floppy boot in grub-mkrescue
+ *-efi)
+ exit 0;;
+ # FIXME: no floppy support
+ i386-multiboot)
+ exit 0;;
+ # FIXME: QEMU firmware crashes when trying to boot from floppy
+ sparc64-ieee1275)
+ exit 0;;
+ # 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
+ powerpc-ieee1275)
+ exit 0;;
+esac
+
+if [ "$(echo hello | "${grubshell}" --boot=fd --mkrescue-arg="--compress=xz --fonts= --locales= --themes=")" != "Hello World" ]; then
+ exit 1
+fi
diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in
index effc82a..0417c67 100644
--- a/tests/grub_cmd_date.in
+++ b/tests/grub_cmd_date.in
@@ -3,9 +3,8 @@ set -e
. "@builddir@/grub-core/modinfo.sh"
-# OpenBIOS on sparc64 doesn't implement RTC
-# mipsel-arc QEMU emulated RTC doesn't play well with firmware
-if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mipsel-arc ]; then
+# FIXME: OpenBIOS on sparc64 doesn't implement RTC
+if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then
exit 0
fi
diff --git a/tests/gzcompress_test.in b/tests/gzcompress_test.in
new file mode 100644
index 0000000..5cc352e
--- /dev/null
+++ b/tests/gzcompress_test.in
@@ -0,0 +1,24 @@
+#! /bin/sh
+# Copyright (C) 2013 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/>.
+
+set -e
+grubshell=@builddir@/grub-shell
+
+. "@builddir@/grub-core/modinfo.sh"
+
+if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=gz)" != "Hello World" ]; then
+ exit 1
+fi
diff --git a/tests/hddboot_test.in b/tests/hddboot_test.in
new file mode 100644
index 0000000..e76f996
--- /dev/null
+++ b/tests/hddboot_test.in
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (C) 2013 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/>.
+
+set -e
+grubshell=@builddir@/grub-shell
+
+. "@builddir@/grub-core/modinfo.sh"
+
+case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+ # Flash targets
+ i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
+ exit 0;;
+ # FIXME: currently grub-shell uses only -kernel for loongson
+ mipsel-loongson)
+ exit 0;;
+ # FIXME: OVMF skips HDDs for automatic boot and has no USB support
+ *-efi)
+ exit 0;;
+esac
+
+if [ "$(echo hello | "${grubshell}" --boot=hd)" != "Hello World" ]; then
+ exit 1
+fi
+
diff --git a/tests/lzocompress_test.in b/tests/lzocompress_test.in
new file mode 100644
index 0000000..54428c3
--- /dev/null
+++ b/tests/lzocompress_test.in
@@ -0,0 +1,24 @@
+#! /bin/sh
+# Copyright (C) 2013 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/>.
+
+set -e
+grubshell=@builddir@/grub-shell
+
+. "@builddir@/grub-core/modinfo.sh"
+
+if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=lzo)" != "Hello World" ]; then
+ exit 1
+fi
diff --git a/tests/netboot_test.in b/tests/netboot_test.in
new file mode 100644
index 0000000..8e3f8c9
--- /dev/null
+++ b/tests/netboot_test.in
@@ -0,0 +1,42 @@
+#! /bin/sh
+# Copyright (C) 2013 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/>.
+
+set -e
+grubshell=@builddir@/grub-shell
+
+. "@builddir@/grub-core/modinfo.sh"
+
+case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+ # Flash targets
+ i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
+ exit 0;;
+ # FIXME: currently grub-shell uses only -kernel for loongson
+ mipsel-loongson)
+ exit 0;;
+ # FIXME: no rtl8139 support
+ i386-multiboot)
+ exit 0;;
+ # FIXME: We don't fully support netboot on ARC
+ *-arc)
+ exit 0;;
+ # FIXME: Many QEMU firmware have no netboot capability
+ *-efi | i386-ieee1275 | powerpc-ieee1275 | sparc64-ieee1275)
+ exit 0;;
+esac
+
+if [ "$(echo hello | "${grubshell}" --boot=net)" != "Hello World" ]; then
+ exit 1
+fi
diff --git a/tests/partmap_test.in b/tests/partmap_test.in
index ee23f7f..b222fa1 100644
--- a/tests/partmap_test.in
+++ b/tests/partmap_test.in
@@ -63,23 +63,23 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
powerpc-ieee1275)
disk=ieee1275//pci@80000000/mac-io@4/ata-3@20000/disk@0
qemudisk=hda
- # QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
+ # 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
qemudisk=hda
- # QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
+ # FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
exit 0
;;
i386-ieee1275)
disk=ieee1275/d
qemudisk=hdb
- # QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
+ # FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label.
exit 0
;;
mips-arc)
- # ARC firmware has bugs which prevent it from accessing hard disk w/o dvh disklabel.
+ # 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
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index ccea332..fc52e7b 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -41,11 +41,13 @@ Run GRUB script in a Qemu instance.
-h, --help print this message and exit
-v, --version print the version information and exit
- --boot=[fd|hd|cd|net] boot method for Qemu instance
+ --boot=[fd|hd|cd|net] boot method for Qemu instance
--modules=MODULES pre-load specified modules MODULES
--qemu=FILE Name of qemu binary
--qemu-opts=OPTIONS extra options to pass to Qemu instance
--files=FILES add files to the image
+ --mkrescue-arg=ARGS additional arguments to grub-mkrescue
+ --timeout=SECONDS set timeout
--trim trim firmware output
$0 runs input GRUB script or SOURCE file in a Qemu instance and prints
@@ -60,6 +62,7 @@ qemuopts="${GRUB_QEMU_OPTS}"
serial_port=com0
serial_null=
halt_cmd=halt
+pseries=n
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
powerpc-ieee1275)
boot=cd
@@ -67,6 +70,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
console=console
serial_port=escc-ch-a
serial_null="-serial null"
+ netbootext=elf
;;
sparc64-ieee1275)
@@ -139,7 +143,9 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
i386-pc)
boot=cd
qemu=qemu-system-i386
- console=console;;
+ console=console
+ netbootext=0
+ ;;
i386-efi)
qemu=qemu-system-i386
@@ -159,6 +165,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
console=console;;
esac
+timeout=60
+
# Check the arguments.
for option in "$@"; do
case "$option" in
@@ -177,11 +185,24 @@ for option in "$@"; do
--files=*)
fls=`echo "$option" | sed -e 's/--files=//' -e 's/,/ /g'`
files="$files $fls" ;;
+ --mkrescue-arg=*)
+ mkr=`echo "$option" | sed -e 's/--mkrescue-arg=//' -e 's/,/ /g'`
+ mkrescue_args="$mkrescue_args $mkr" ;;
--qemu=*)
qemu=`echo "$option" | sed -e 's/--qemu=//' -e 's/,/ /g'`;;
+ --pseries)
+ qemu=qemu-system-ppc64
+ serial_port=ieee1275/hvterm
+ serial_null=
+ qemuopts="$qemuopts -no-reboot"
+ trim=1
+ ;;
--qemu-opts=*)
qs=`echo "$option" | sed -e 's/--qemu-opts=//'`
qemuopts="$qemuopts $qs" ;;
+ --timeout=*)
+ timeout=`echo "$option" | sed -e 's/--timeout=//'`
+ ;;
--boot=*)
dev=`echo "$option" | sed -e 's/--boot=//'`
if [ "$dev" = "fd" ] ; then boot=fd;
@@ -260,12 +281,16 @@ echo "${halt_cmd}" >>${cfgfile}
isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
if [ x$boot != xnet ]; then
pkgdatadir="@builddir@" sh "@builddir@/grub-mkrescue" "--grub-mkimage=${builddir}/grub-mkimage" "--grub-render-label=${builddir}/grub-render-label" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \
- --rom-directory="${rom_directory}" \
+ --rom-directory="${rom_directory}" ${mkrescue_args} \
"/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \
${files} >/dev/null 2>&1
fi
if [ x$boot = xhd ]; then
- device=hda
+ if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mips-arc ]; then
+ device=hdb
+ else
+ device=hda
+ fi
bootdev="-boot c"
fi
if [ x$boot = xcd ]; then
@@ -305,6 +330,15 @@ if [ x$boot = xcoreboot ]; then
device=cdrom
fi
+if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mipsel-arc ]; then
+ case "$boot" in
+ hd)
+ bootdev="-global ds1225y.filename=$GRUB_QEMU_MAGNUM_NVRAM_DIR/disk" ;;
+ *)
+ bootdev="-global ds1225y.filename=$GRUB_QEMU_MAGNUM_NVRAM_DIR/cdrom";;
+ esac
+fi
+
do_trim ()
{
if [ $trim = 1 ]; then
@@ -316,12 +350,12 @@ do_trim ()
if [ x$boot = xnet ]; then
netdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
- pkgdatadir="@builddir@" sh "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--directory=${builddir}/grub-core" "--net-directory=$netdir"
+ pkgdatadir="@builddir@" sh "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--directory=${builddir}/grub-core" "--net-directory=$netdir" ${mkrescue_args} > /dev/null
cp "${cfgfile}" "$netdir/boot/grub/grub.cfg"
cp "${source}" "$netdir/boot/grub/testcase.cfg"
- "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.0" -net nic | cat | tr -d "\r" | do_trim
+ timeout -s KILL $timeout "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic | cat | tr -d "\r" | do_trim
else
- "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r" | do_trim
+ timeout -s KILL $timeout "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r" | do_trim
fi
rm -f "${isofile}" "${imgfile}"
rm -rf "${rom_directory}"
diff --git a/tests/xzcompress_test.in b/tests/xzcompress_test.in
new file mode 100644
index 0000000..63f5fd1
--- /dev/null
+++ b/tests/xzcompress_test.in
@@ -0,0 +1,24 @@
+#! /bin/sh
+# Copyright (C) 2013 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/>.
+
+set -e
+grubshell=@builddir@/grub-shell
+
+. "@builddir@/grub-core/modinfo.sh"
+
+if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=xz)" != "Hello World" ]; then
+ exit 1
+fi
--
1.8.2.1