Add test to check that different boot mediums work.
This commit is contained in:
parent
c4b456d347
commit
f93e89ef90
13 changed files with 353 additions and 33 deletions
36
tests/cdboot_test.in
Normal file
36
tests/cdboot_test.in
Normal file
|
@ -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
|
48
tests/fddboot_test.in
Normal file
48
tests/fddboot_test.in
Normal file
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
24
tests/gzcompress_test.in
Normal file
24
tests/gzcompress_test.in
Normal file
|
@ -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
|
37
tests/hddboot_test.in
Normal file
37
tests/hddboot_test.in
Normal file
|
@ -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
|
||||
|
24
tests/lzocompress_test.in
Normal file
24
tests/lzocompress_test.in
Normal file
|
@ -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
|
42
tests/netboot_test.in
Normal file
42
tests/netboot_test.in
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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}"
|
||||
|
|
24
tests/xzcompress_test.in
Normal file
24
tests/xzcompress_test.in
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue