]> git.ozlabs.org Git - petitboot/commitdiff
test/parser: Add f18 grub config test
authorJeremy Kerr <jk@ozlabs.org>
Wed, 8 May 2013 04:45:58 +0000 (12:45 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 16 May 2013 03:55:31 +0000 (11:55 +0800)
Add a real-world config file from a f18 ppc64 machine.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
test/parser/Makefile.am
test/parser/data/grub2-f18-ppc64.conf [new file with mode: 0644]
test/parser/test-grub2-f18-ppc64.c [new file with mode: 0644]

index cd8da4a80763f84388495ac3bdcfe0bd42e71355..10406706f6a2b097bfc276d1369b6e4bc9c3abe3 100644 (file)
@@ -26,13 +26,14 @@ AM_CFLAGS = -O0 -ggdb -Wall -Wextra -Werror
 
 TESTS = test-null \
        test-grub2-single \
+       test-grub2-f18-ppc64 \
        test-kboot-single \
        test-yaboot-single \
        test-yaboot-external
 
 check_PROGRAMS = $(TESTS)
 check_LIBRARIES = $(test_libs)
-check_DATA =
+check_DATA = data/grub2-f18-ppc64.conf
 
 common_libs = $(top_builddir)/lib/libpbcore.la
 test_libs = libtest.o
diff --git a/test/parser/data/grub2-f18-ppc64.conf b/test/parser/data/grub2-f18-ppc64.conf
new file mode 100644 (file)
index 0000000..86baa3a
--- /dev/null
@@ -0,0 +1,155 @@
+#
+# DO NOT EDIT THIS FILE
+#
+# It is automatically generated by grub2-mkconfig using templates
+# from /etc/grub.d and settings from /etc/default/grub
+#
+
+### BEGIN /etc/grub.d/00_header ###
+if [ -s $prefix/grubenv ]; then
+  load_env
+fi
+set default="0"
+
+if [ x"${feature_menuentry_id}" = xy ]; then
+  menuentry_id_option="--id"
+else
+  menuentry_id_option=""
+fi
+
+export menuentry_id_option
+
+if [ "${prev_saved_entry}" ]; then
+  set saved_entry="${prev_saved_entry}"
+  save_env saved_entry
+  set prev_saved_entry=
+  save_env prev_saved_entry
+  set boot_once=true
+fi
+
+function savedefault {
+  if [ -z "${boot_once}" ]; then
+    saved_entry="${chosen}"
+    save_env saved_entry
+  fi
+}
+
+function load_video {
+  if [ x$feature_all_video_module = xy ]; then
+    insmod all_video
+  else
+    insmod efi_gop
+    insmod efi_uga
+    insmod ieee1275_fb
+    insmod vbe
+    insmod vga
+    insmod video_bochs
+    insmod video_cirrus
+  fi
+}
+
+if [ x$feature_default_font_path = xy ] ; then
+   font=unicode
+else
+insmod part_msdos
+insmod lvm
+insmod ext2
+set root='lvm/fedora_ltcfbl8eb-root'
+if [ x$feature_platform_search_hint = xy ]; then
+  search --no-floppy --fs-uuid --set=root --hint='lvm/fedora_ltcfbl8eb-root'  ae785c7f-5e63-431f-9b9a-aabbf04f183f
+else
+  search --no-floppy --fs-uuid --set=root ae785c7f-5e63-431f-9b9a-aabbf04f183f
+fi
+    font="/usr/share/grub/unicode.pf2"
+fi
+
+if loadfont $font ; then
+  set gfxmode=auto
+  load_video
+  insmod gfxterm
+  set locale_dir=$prefix/locale
+  set lang=en_US
+  insmod gettext
+fi
+terminal_output gfxterm
+insmod part_msdos
+insmod ext2
+set root='hd0,msdos2'
+if [ x$feature_platform_search_hint = xy ]; then
+  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//pci@800000020000203/pci1014\,0339@0/disk@0\,0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 --hint='hd0,msdos2'  773653a7-660e-490e-9a74-d9fdfc9bbbf6
+else
+  search --no-floppy --fs-uuid --set=root 773653a7-660e-490e-9a74-d9fdfc9bbbf6
+fi
+insmod gfxmenu
+loadfont ($root)/grub2/themes/system/DejaVuSans-10.pf2
+loadfont ($root)/grub2/themes/system/DejaVuSans-12.pf2
+loadfont ($root)/grub2/themes/system/DejaVuSans-Bold-14.pf2
+loadfont ($root)/grub2/fonts/unicode.pf2
+insmod png
+set theme=($root)/grub2/themes/system/theme.txt
+export theme
+set timeout=5
+### END /etc/grub.d/00_header ###
+
+### BEGIN /etc/grub.d/10_linux ###
+menuentry 'Fedora' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-ae785c7f-5e63-431f-9b9a-aabbf04f183f' {
+       load_video
+       insmod gzio
+       insmod part_msdos
+       insmod ext2
+       set root='hd0,msdos2'
+       if [ x$feature_platform_search_hint = xy ]; then
+         search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//pci@800000020000203/pci1014\,0339@0/disk@0\,0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 --hint='hd0,msdos2'  773653a7-660e-490e-9a74-d9fdfc9bbbf6
+       else
+         search --no-floppy --fs-uuid --set=root 773653a7-660e-490e-9a74-d9fdfc9bbbf6
+       fi
+       echo    'Loading Linux 3.6.10-4.fc18.ppc64p7 ...'
+       linux   /vmlinuz-3.6.10-4.fc18.ppc64p7 root=/dev/mapper/fedora_ltcfbl8eb-root ro rd.lvm.lv=fedora_ltcfbl8eb/swap rd.dm=0 rd.lvm.lv=fedora_ltcfbl8eb/root  rd.md=0 rd.luks=0 vconsole.keymap=us rhgb quiet
+       echo    'Loading initial ramdisk ...'
+       initrd  /initramfs-3.6.10-4.fc18.ppc64p7.img
+}
+
+submenu 'Advanced options for Fedora' $menuentry_id_option 'gnulinux-advanced-ae785c7f-5e63-431f-9b9a-aabbf04f183f' {
+       menuentry 'Fedora, with Linux 3.6.10-4.fc18.ppc64p7' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.6.10-4.fc18.ppc64p7-advanced-ae785c7f-5e63-431f-9b9a-aabbf04f183f' {
+               load_video
+               insmod gzio
+               insmod part_msdos
+               insmod ext2
+               set root='hd0,msdos2'
+               if [ x$feature_platform_search_hint = xy ]; then
+                 search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//pci@800000020000203/pci1014\,0339@0/disk@0\,0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 --hint='hd0,msdos2'  773653a7-660e-490e-9a74-d9fdfc9bbbf6
+               else
+                 search --no-floppy --fs-uuid --set=root 773653a7-660e-490e-9a74-d9fdfc9bbbf6
+               fi
+               echo    'Loading Linux 3.6.10-4.fc18.ppc64p7 ...'
+               linux   /vmlinuz-3.6.10-4.fc18.ppc64p7 root=/dev/mapper/fedora_ltcfbl8eb-root ro rd.lvm.lv=fedora_ltcfbl8eb/swap rd.dm=0 rd.lvm.lv=fedora_ltcfbl8eb/root  rd.md=0 rd.luks=0 vconsole.keymap=us rhgb quiet
+               echo    'Loading initial ramdisk ...'
+               initrd  /initramfs-3.6.10-4.fc18.ppc64p7.img
+       }
+}
+
+### END /etc/grub.d/10_linux ###
+
+### BEGIN /etc/grub.d/20_linux_xen ###
+### END /etc/grub.d/20_linux_xen ###
+
+### BEGIN /etc/grub.d/20_ppc_terminfo ###
+  terminfo -g 80x24 ofconsole
+### END /etc/grub.d/20_ppc_terminfo ###
+
+### BEGIN /etc/grub.d/30_os-prober ###
+### END /etc/grub.d/30_os-prober ###
+
+### BEGIN /etc/grub.d/40_custom ###
+# This file provides an easy way to add custom menu entries.  Simply type the
+# menu entries you want to add after this comment.  Be careful not to change
+# the 'exec tail' line above.
+### END /etc/grub.d/40_custom ###
+
+### BEGIN /etc/grub.d/41_custom ###
+if [ -f  ${config_directory}/custom.cfg ]; then
+  source ${config_directory}/custom.cfg
+elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
+  source $prefix/custom.cfg;
+fi
+### END /etc/grub.d/41_custom ###
diff --git a/test/parser/test-grub2-f18-ppc64.c b/test/parser/test-grub2-f18-ppc64.c
new file mode 100644 (file)
index 0000000..4d7c8ec
--- /dev/null
@@ -0,0 +1,34 @@
+
+#include "parser-test.h"
+
+void run_test(struct parser_test *test)
+{
+       struct discover_boot_option *opt;
+       struct discover_context *ctx;
+       int i;
+
+       test_read_conf_file(test, "grub2-f18-ppc64.conf");
+       test_run_parser(test, "grub2");
+
+       ctx = test->ctx;
+
+       check_boot_option_count(ctx, 2);
+
+       for (i = 0; i < 2; i++) {
+               opt = get_boot_option(ctx, i);
+
+               check_resolved_local_resource(opt->boot_image, ctx->device,
+                               "/vmlinuz-3.6.10-4.fc18.ppc64p7");
+               check_resolved_local_resource(opt->initrd, ctx->device,
+                               "/initramfs-3.6.10-4.fc18.ppc64p7.img");
+
+               check_args(opt, "root=/dev/mapper/fedora_ltcfbl8eb-root ro "
+                               "rd.lvm.lv=fedora_ltcfbl8eb/swap rd.dm=0 "
+                               "rd.lvm.lv=fedora_ltcfbl8eb/root  rd.md=0 "
+                               "rd.luks=0 vconsole.keymap=us rhgb quiet");
+
+               check_name(opt, i == 0 ?
+                               "Fedora" :
+                               "Fedora, with Linux 3.6.10-4.fc18.ppc64p7");
+       }
+}