mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-24 14:32:58 +00:00
f74b50e380
Signed-off-by: Peter Jones <pjones@redhat.com>
453 lines
12 KiB
Diff
453 lines
12 KiB
Diff
From a34197c479d81185ada7a64ee680ae4e5157215d Mon Sep 17 00:00:00 2001
|
|
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
Date: Mon, 29 Apr 2013 12:25:57 +0200
|
|
Subject: [PATCH 390/482] Add few new tests.
|
|
|
|
---
|
|
ChangeLog | 4 +++
|
|
Makefile.util.def | 42 ++++++++++++++++++++++++++++++
|
|
tests/ahci_test.in | 52 +++++++++++++++++++++++++++++++++++++
|
|
tests/ehci_test.in | 50 ++++++++++++++++++++++++++++++++++++
|
|
tests/grub_script_escape_comma.in | 18 +++++++++++++
|
|
tests/help_test.in | 16 ++++++++++++
|
|
tests/ohci_test.in | 50 ++++++++++++++++++++++++++++++++++++
|
|
tests/pata_test.in | 54 +++++++++++++++++++++++++++++++++++++++
|
|
tests/uhci_test.in | 50 ++++++++++++++++++++++++++++++++++++
|
|
tests/util/grub-shell.in | 2 +-
|
|
10 files changed, 337 insertions(+), 1 deletion(-)
|
|
create mode 100644 tests/ahci_test.in
|
|
create mode 100644 tests/ehci_test.in
|
|
create mode 100644 tests/grub_script_escape_comma.in
|
|
create mode 100644 tests/help_test.in
|
|
create mode 100644 tests/ohci_test.in
|
|
create mode 100644 tests/pata_test.in
|
|
create mode 100644 tests/uhci_test.in
|
|
|
|
diff --git a/ChangeLog b/ChangeLog
|
|
index 1dea1aa..e4a7307 100644
|
|
--- a/ChangeLog
|
|
+++ b/ChangeLog
|
|
@@ -1,5 +1,9 @@
|
|
2013-04-29 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
|
+ Add few new tests.
|
|
+
|
|
+2013-04-29 Vladimir Serbinenko <phcoder@gmail.com>
|
|
+
|
|
Enforce disabling of firmware disk drivers when native drivers kick in.
|
|
|
|
2013-04-29 Vladimir Serbinenko <phcoder@gmail.com>
|
|
diff --git a/Makefile.util.def b/Makefile.util.def
|
|
index caa6c05..3cfc592 100644
|
|
--- a/Makefile.util.def
|
|
+++ b/Makefile.util.def
|
|
@@ -546,6 +546,36 @@ script = {
|
|
|
|
script = {
|
|
testcase;
|
|
+ name = pata_test;
|
|
+ common = tests/pata_test.in;
|
|
+};
|
|
+
|
|
+script = {
|
|
+ testcase;
|
|
+ name = ahci_test;
|
|
+ common = tests/ahci_test.in;
|
|
+};
|
|
+
|
|
+script = {
|
|
+ testcase;
|
|
+ name = uhci_test;
|
|
+ common = tests/uhci_test.in;
|
|
+};
|
|
+
|
|
+script = {
|
|
+ testcase;
|
|
+ name = ohci_test;
|
|
+ common = tests/ohci_test.in;
|
|
+};
|
|
+
|
|
+script = {
|
|
+ testcase;
|
|
+ name = ehci_test;
|
|
+ common = tests/ehci_test.in;
|
|
+};
|
|
+
|
|
+script = {
|
|
+ testcase;
|
|
name = example_grub_script_test;
|
|
common = tests/example_grub_script_test.in;
|
|
};
|
|
@@ -750,12 +780,24 @@ script = {
|
|
|
|
script = {
|
|
testcase;
|
|
+ name = help_test;
|
|
+ common = tests/help_test.in;
|
|
+};
|
|
+
|
|
+script = {
|
|
+ testcase;
|
|
name = grub_script_gettext;
|
|
common = tests/grub_script_gettext.in;
|
|
};
|
|
|
|
script = {
|
|
testcase;
|
|
+ name = grub_script_escape_comma;
|
|
+ common = tests/grub_script_escape_comma.in;
|
|
+};
|
|
+
|
|
+script = {
|
|
+ testcase;
|
|
name = grub_script_strcmp;
|
|
common = tests/grub_script_strcmp.in;
|
|
};
|
|
diff --git a/tests/ahci_test.in b/tests/ahci_test.in
|
|
new file mode 100644
|
|
index 0000000..fa5314c
|
|
--- /dev/null
|
|
+++ b/tests/ahci_test.in
|
|
@@ -0,0 +1,52 @@
|
|
+#! /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
|
|
+ *-emu)
|
|
+ exit 0;;
|
|
+ # FIXME: qemu gets bonito DMA wrong
|
|
+ mipsel-loongson)
|
|
+ exit 0;;
|
|
+ # no AHCI on ARC and qemu-mips platforms
|
|
+ mips*-arc | mips*-qemu_mips)
|
|
+ exit 0;;
|
|
+ # FIXME: No native drivers are available for those
|
|
+ powerpc-ieee1275 | sparc64-ieee1275)
|
|
+ exit 0;;
|
|
+esac
|
|
+
|
|
+imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
|
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
|
+
|
|
+echo "hello" > "$outfile"
|
|
+
|
|
+tar cf "$imgfile" "$outfile"
|
|
+
|
|
+if [ "$(echo "nativedisk; source '(ahci0)/$outfile';" | "${grubshell}" --qemu-opts="-drive id=disk,file=$imgfile,if=none -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 " | tail -n 1)" != "Hello World" ]; then
|
|
+ rm "$imgfile"
|
|
+ rm "$outfile"
|
|
+ exit 1
|
|
+fi
|
|
+
|
|
+rm "$imgfile"
|
|
+rm "$outfile"
|
|
+
|
|
+
|
|
diff --git a/tests/ehci_test.in b/tests/ehci_test.in
|
|
new file mode 100644
|
|
index 0000000..d9999f8
|
|
--- /dev/null
|
|
+++ b/tests/ehci_test.in
|
|
@@ -0,0 +1,50 @@
|
|
+#! /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
|
|
+ *-emu)
|
|
+ exit 0;;
|
|
+ # FIXME: qemu gets bonito DMA wrong
|
|
+ mipsel-loongson)
|
|
+ exit 0;;
|
|
+ # no USB on ARC and qemu-mips platforms
|
|
+ mips*-arc | mips*-qemu_mips)
|
|
+ exit 0;;
|
|
+ # FIXME: No native drivers are available for those
|
|
+ powerpc-ieee1275 | sparc64-ieee1275)
|
|
+ exit 0;;
|
|
+esac
|
|
+
|
|
+imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
|
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
|
+
|
|
+echo "hello" > "$outfile"
|
|
+
|
|
+tar cf "$imgfile" "$outfile"
|
|
+
|
|
+if [ "$(echo "nativedisk; source '(usb0)/$outfile';" | "${grubshell}" --qemu-opts="-device ich9-usb-ehci1 -drive id=my_usb_disk,file=$imgfile,if=none -device usb-storage,drive=my_usb_disk" | tail -n 1)" != "Hello World" ]; then
|
|
+ rm "$imgfile"
|
|
+ rm "$outfile"
|
|
+ exit 1
|
|
+fi
|
|
+
|
|
+rm "$imgfile"
|
|
+rm "$outfile"
|
|
diff --git a/tests/grub_script_escape_comma.in b/tests/grub_script_escape_comma.in
|
|
new file mode 100644
|
|
index 0000000..eff3179
|
|
--- /dev/null
|
|
+++ b/tests/grub_script_escape_comma.in
|
|
@@ -0,0 +1,18 @@
|
|
+#! @builddir@/grub-shell-tester
|
|
+
|
|
+x=1\\,1
|
|
+echo $x
|
|
+y='$'
|
|
+echo $y
|
|
+z='\'
|
|
+echo $z
|
|
+t='\*'
|
|
+echo $t
|
|
+u='$'
|
|
+echo $u
|
|
+v='\?'
|
|
+echo $v
|
|
+
|
|
+
|
|
+echo \\
|
|
+
|
|
diff --git a/tests/help_test.in b/tests/help_test.in
|
|
new file mode 100644
|
|
index 0000000..e780924
|
|
--- /dev/null
|
|
+++ b/tests/help_test.in
|
|
@@ -0,0 +1,16 @@
|
|
+#! /bin/bash
|
|
+set -e
|
|
+
|
|
+. "@builddir@/grub-core/modinfo.sh"
|
|
+
|
|
+template="Usage: help [PATTERN ...]
|
|
+Show a help message.
|
|
+
|
|
+-h, --help Display this help and exit.
|
|
+-u, --usage Display the usage of this command and exit.
|
|
+Hello World"
|
|
+outpu="$(echo 'help help; hello' | @builddir@/grub-shell)"
|
|
+
|
|
+if [ "$template" != "$outpu" ]; then
|
|
+ exit 1
|
|
+fi
|
|
diff --git a/tests/ohci_test.in b/tests/ohci_test.in
|
|
new file mode 100644
|
|
index 0000000..d6c1e0c
|
|
--- /dev/null
|
|
+++ b/tests/ohci_test.in
|
|
@@ -0,0 +1,50 @@
|
|
+#! /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
|
|
+ *-emu)
|
|
+ exit 0;;
|
|
+ # FIXME: qemu gets bonito DMA wrong
|
|
+ mipsel-loongson)
|
|
+ exit 0;;
|
|
+ # no USB on ARC and qemu-mips platforms
|
|
+ mips*-arc | mips*-qemu_mips)
|
|
+ exit 0;;
|
|
+ # FIXME: No native drivers are available for those
|
|
+ powerpc-ieee1275 | sparc64-ieee1275)
|
|
+ exit 0;;
|
|
+esac
|
|
+
|
|
+imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
|
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
|
+
|
|
+echo "hello" > "$outfile"
|
|
+
|
|
+tar cf "$imgfile" "$outfile"
|
|
+
|
|
+if [ "$(echo "nativedisk; source '(usb0)/$outfile';" | "${grubshell}" --qemu-opts="-device pci-ohci -drive id=my_usb_disk,file=$imgfile,if=none -device usb-storage,drive=my_usb_disk" | tail -n 1)" != "Hello World" ]; then
|
|
+ rm "$imgfile"
|
|
+ rm "$outfile"
|
|
+ exit 1
|
|
+fi
|
|
+
|
|
+rm "$imgfile"
|
|
+rm "$outfile"
|
|
diff --git a/tests/pata_test.in b/tests/pata_test.in
|
|
new file mode 100644
|
|
index 0000000..3671300
|
|
--- /dev/null
|
|
+++ b/tests/pata_test.in
|
|
@@ -0,0 +1,54 @@
|
|
+#! /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"
|
|
+
|
|
+disk=hda
|
|
+indisk=ata0
|
|
+
|
|
+case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
|
+ *-emu)
|
|
+ exit 0;;
|
|
+ # no ATA on ARC platforms (they use SCSI)
|
|
+ *-arc)
|
|
+ exit 0;;
|
|
+ # FIXME: No native drivers are available for those
|
|
+ powerpc-ieee1275 | sparc64-ieee1275)
|
|
+ exit 0;;
|
|
+ i386-ieee1275)
|
|
+ disk=hdb
|
|
+ indisk=ata1
|
|
+ ;;
|
|
+esac
|
|
+
|
|
+imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
|
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
|
+
|
|
+echo "hello" > "$outfile"
|
|
+
|
|
+tar cf "$imgfile" "$outfile"
|
|
+
|
|
+if [ "$(echo "nativedisk; source '($indisk)/$outfile';" | "${grubshell}" --qemu-opts="-$disk $imgfile")" != "Hello World" ]; then
|
|
+ rm "$imgfile"
|
|
+ rm "$outfile"
|
|
+ exit 1
|
|
+fi
|
|
+
|
|
+rm "$imgfile"
|
|
+rm "$outfile"
|
|
diff --git a/tests/uhci_test.in b/tests/uhci_test.in
|
|
new file mode 100644
|
|
index 0000000..ec6731c
|
|
--- /dev/null
|
|
+++ b/tests/uhci_test.in
|
|
@@ -0,0 +1,50 @@
|
|
+#! /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
|
|
+ *-emu)
|
|
+ exit 0;;
|
|
+ # FIXME: qemu gets bonito DMA wrong
|
|
+ mipsel-loongson)
|
|
+ exit 0;;
|
|
+ # no USB on ARC and qemu-mips platforms
|
|
+ mips*-arc | mips*-qemu_mips)
|
|
+ exit 0;;
|
|
+ # FIXME: No native drivers are available for those
|
|
+ powerpc-ieee1275 | sparc64-ieee1275)
|
|
+ exit 0;;
|
|
+esac
|
|
+
|
|
+imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
|
+outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
|
+
|
|
+echo "hello" > "$outfile"
|
|
+
|
|
+tar cf "$imgfile" "$outfile"
|
|
+
|
|
+if [ "$(echo "nativedisk; source '(usb0)/$outfile';" | "${grubshell}" --qemu-opts="-usb -usbdevice disk:$imgfile" | tail -n 1)" != "Hello World" ]; then
|
|
+ rm "$imgfile"
|
|
+ rm "$outfile"
|
|
+ exit 1
|
|
+fi
|
|
+
|
|
+rm "$imgfile"
|
|
+rm "$outfile"
|
|
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
|
|
index b034e96..5b20ca3 100644
|
|
--- a/tests/util/grub-shell.in
|
|
+++ b/tests/util/grub-shell.in
|
|
@@ -322,7 +322,7 @@ do
|
|
done
|
|
|
|
cat <<EOF >>${cfgfile}
|
|
-source \$prefix/testcase.cfg
|
|
+source "\$prefix/testcase.cfg"
|
|
# Stop serial output to suppress "ACPI shutdown failed" error.
|
|
EOF
|
|
if [ x$console != x ]; then
|
|
--
|
|
1.8.2.1
|
|
|