Blame SOURCES/0022-Add-a-test-case-for-a-failure-rmarshall-saw-in-set-i.patch

24fce8
From a23da4b29281ca07b06aab0bb772fedfe1f8ce35 Mon Sep 17 00:00:00 2001
24fce8
From: Peter Jones <pjones@redhat.com>
24fce8
Date: Fri, 24 Jun 2016 16:13:41 -0400
24fce8
Subject: [PATCH 22/55] Add a test case for a failure rmarshall saw in
24fce8
 --set-index=
24fce8
24fce8
Related: rhbz#1285601
24fce8
24fce8
Signed-off-by: Peter Jones <pjones@redhat.com>
24fce8
---
24fce8
 test.sh                            |   9 ++
24fce8
 test/grub2-support_files/grubenv.3 |   3 +
24fce8
 test/grub2.18                      | 154 ++++++++++++++++++++++++++
24fce8
 test/results/add/g2-1.18           | 168 +++++++++++++++++++++++++++++
24fce8
 4 files changed, 334 insertions(+)
24fce8
 create mode 100644 test/grub2-support_files/grubenv.3
24fce8
 create mode 100644 test/grub2.18
24fce8
 create mode 100644 test/results/add/g2-1.18
24fce8
24fce8
diff --git a/test.sh b/test.sh
24fce8
index 7d1794c83df..fb7cd2381d5 100755
24fce8
--- a/test.sh
24fce8
+++ b/test.sh
24fce8
@@ -565,6 +565,15 @@ if [ "$testgrub2" == "y" ]; then
24fce8
         --copy-default --title 'Red Hat Enterprise Linux Server' \
24fce8
         --args=root=/dev/mapper/foo--
24fce8
 
24fce8
+    # copy a stanza and add arguments as well, while using --set-index=
24fce8
+    testing="GRUB2 add stanza and new args with --set-index="
24fce8
+    grub2Test grub2.18 add/g2-1.18  --env grubenv.3 \
24fce8
+        --add-kernel=/boot/vmlinuz-3.10.0-327.22.2.el7.x86_64.debug \
24fce8
+        --boot-filesystem=/boot --copy-default \
24fce8
+        --title "Red Hat Enterprise Linux Server (3.10.0-327.22.2.el7.x86_64.debug) 7.2 (Maipo) with debugging" \
24fce8
+        --args="root=/dev/mapper/rhel_team--area--222-root systemd.log_level=debug systemd.log_target=kmsg" \
24fce8
+        --set-index=1
24fce8
+
24fce8
     testing="GRUB2 add initrd"
24fce8
     grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \
24fce8
         --initrd=/boot/new-initrd --boot-filesystem=/boot/
24fce8
diff --git a/test/grub2-support_files/grubenv.3 b/test/grub2-support_files/grubenv.3
24fce8
new file mode 100644
24fce8
index 00000000000..b9a8c798328
24fce8
--- /dev/null
24fce8
+++ b/test/grub2-support_files/grubenv.3
24fce8
@@ -0,0 +1,3 @@
24fce8
+# GRUB Environment Block
24fce8
+saved_entry=Red Hat Enterprise Linux Server (3.10.0-327.22.2.el7.x86_64.debug) 7.2 (Maipo) with debugging
24fce8
+#############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
24fce8
\ No newline at end of file
24fce8
diff --git a/test/grub2.18 b/test/grub2.18
24fce8
new file mode 100644
24fce8
index 00000000000..529608da773
24fce8
--- /dev/null
24fce8
+++ b/test/grub2.18
24fce8
@@ -0,0 +1,154 @@
24fce8
+#
24fce8
+# DO NOT EDIT THIS FILE
24fce8
+#
24fce8
+# It is automatically generated by grub2-mkconfig using templates
24fce8
+# from /etc/grub.d and settings from /etc/default/grub
24fce8
+#
24fce8
+
24fce8
+### BEGIN /etc/grub.d/00_header ###
24fce8
+set pager=1
24fce8
+
24fce8
+if [ -s $prefix/grubenv ]; then
24fce8
+  load_env
24fce8
+fi
24fce8
+if [ "${next_entry}" ] ; then
24fce8
+   set default="${next_entry}"
24fce8
+   set next_entry=
24fce8
+   save_env next_entry
24fce8
+   set boot_once=true
24fce8
+else
24fce8
+   set default="${saved_entry}"
24fce8
+fi
24fce8
+
24fce8
+if [ x"${feature_menuentry_id}" = xy ]; then
24fce8
+  menuentry_id_option="--id"
24fce8
+else
24fce8
+  menuentry_id_option=""
24fce8
+fi
24fce8
+
24fce8
+export menuentry_id_option
24fce8
+
24fce8
+if [ "${prev_saved_entry}" ]; then
24fce8
+  set saved_entry="${prev_saved_entry}"
24fce8
+  save_env saved_entry
24fce8
+  set prev_saved_entry=
24fce8
+  save_env prev_saved_entry
24fce8
+  set boot_once=true
24fce8
+fi
24fce8
+
24fce8
+function savedefault {
24fce8
+  if [ -z "${boot_once}" ]; then
24fce8
+    saved_entry="${chosen}"
24fce8
+    save_env saved_entry
24fce8
+  fi
24fce8
+}
24fce8
+
24fce8
+function load_video {
24fce8
+  if [ x$feature_all_video_module = xy ]; then
24fce8
+    insmod all_video
24fce8
+  else
24fce8
+    insmod efi_gop
24fce8
+    insmod efi_uga
24fce8
+    insmod ieee1275_fb
24fce8
+    insmod vbe
24fce8
+    insmod vga
24fce8
+    insmod video_bochs
24fce8
+    insmod video_cirrus
24fce8
+  fi
24fce8
+}
24fce8
+
24fce8
+terminal_output console
24fce8
+if [ x$feature_timeout_style = xy ] ; then
24fce8
+  set timeout_style=menu
24fce8
+  set timeout=5
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=5
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/00_tuned ###
24fce8
+set tuned_params=""
24fce8
+### END /etc/grub.d/00_tuned ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/01_users ###
24fce8
+if [ -f ${prefix}/user.cfg ]; then
24fce8
+  source ${prefix}/user.cfg
24fce8
+  if [ -n ${GRUB2_PASSWORD} ]; then
24fce8
+    set superusers="root"
24fce8
+    export superusers
24fce8
+    password_pbkdf2 root ${GRUB2_PASSWORD}
24fce8
+  fi
24fce8
+fi
24fce8
+### END /etc/grub.d/01_users ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'Red Hat Enterprise Linux Server (3.10.0-327.22.2.el7.x86_64.debug) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-91b16928-66bf-4801-8aed-fab3f1a6876c' {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod xfs
24fce8
+	set root='hd0,msdos1'
24fce8
+	if [ x$feature_platform_search_hint = xy ]; then
24fce8
+	  search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1'  7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	fi
24fce8
+	linux16 /vmlinuz-3.10.0-327.22.2.el7.x86_64.debug root=/dev/mapper/rhel_team--area--222-root ro crashkernel=auto rd.lvm.lv=rhel_team-area-222/root rd.lvm.lv=rhel_team-area-222/swap rhgb quiet LANG=en_US.UTF-8
24fce8
+}
24fce8
+menuentry 'Red Hat Enterprise Linux Server (3.10.0-327.el7.x86_64) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-91b16928-66bf-4801-8aed-fab3f1a6876c' {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod xfs
24fce8
+	set root='hd0,msdos1'
24fce8
+	if [ x$feature_platform_search_hint = xy ]; then
24fce8
+	  search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1'  7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	fi
24fce8
+	linux16 /vmlinuz-3.10.0-327.el7.x86_64 root=/dev/mapper/rhel_team--area--222-root ro crashkernel=auto rd.lvm.lv=rhel_team-area-222/root rd.lvm.lv=rhel_team-area-222/swap rhgb quiet LANG=en_US.UTF-8
24fce8
+	initrd16 /initramfs-3.10.0-327.el7.x86_64.img
24fce8
+}
24fce8
+menuentry 'Red Hat Enterprise Linux Server (0-rescue-925cd320373b6a4a9a66a26371afccd2) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-925cd320373b6a4a9a66a26371afccd2-advanced-91b16928-66bf-4801-8aed-fab3f1a6876c' {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod xfs
24fce8
+	set root='hd0,msdos1'
24fce8
+	if [ x$feature_platform_search_hint = xy ]; then
24fce8
+	  search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1'  7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	fi
24fce8
+	linux16 /vmlinuz-0-rescue-925cd320373b6a4a9a66a26371afccd2 root=/dev/mapper/rhel_team--area--222-root ro crashkernel=auto rd.lvm.lv=rhel_team-area-222/root rd.lvm.lv=rhel_team-area-222/swap rhgb quiet
24fce8
+	initrd16 /initramfs-0-rescue-925cd320373b6a4a9a66a26371afccd2.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+### END /etc/grub.d/20_linux_xen ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_ppc_terminfo ###
24fce8
+### END /etc/grub.d/20_ppc_terminfo ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/30_os-prober ###
24fce8
+### END /etc/grub.d/30_os-prober ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/40_custom ###
24fce8
+# This file provides an easy way to add custom menu entries.  Simply type the
24fce8
+# menu entries you want to add after this comment.  Be careful not to change
24fce8
+# the 'exec tail' line above.
24fce8
+### END /etc/grub.d/40_custom ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/41_custom ###
24fce8
+if [ -f  ${config_directory}/custom.cfg ]; then
24fce8
+  source ${config_directory}/custom.cfg
24fce8
+elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
24fce8
+  source $prefix/custom.cfg;
24fce8
+fi
24fce8
+### END /etc/grub.d/41_custom ###
24fce8
diff --git a/test/results/add/g2-1.18 b/test/results/add/g2-1.18
24fce8
new file mode 100644
24fce8
index 00000000000..ca5fe2393d5
24fce8
--- /dev/null
24fce8
+++ b/test/results/add/g2-1.18
24fce8
@@ -0,0 +1,168 @@
24fce8
+#
24fce8
+# DO NOT EDIT THIS FILE
24fce8
+#
24fce8
+# It is automatically generated by grub2-mkconfig using templates
24fce8
+# from /etc/grub.d and settings from /etc/default/grub
24fce8
+#
24fce8
+
24fce8
+### BEGIN /etc/grub.d/00_header ###
24fce8
+set pager=1
24fce8
+
24fce8
+if [ -s $prefix/grubenv ]; then
24fce8
+  load_env
24fce8
+fi
24fce8
+if [ "${next_entry}" ] ; then
24fce8
+   set default="${next_entry}"
24fce8
+   set next_entry=
24fce8
+   save_env next_entry
24fce8
+   set boot_once=true
24fce8
+else
24fce8
+   set default="${saved_entry}"
24fce8
+fi
24fce8
+
24fce8
+if [ x"${feature_menuentry_id}" = xy ]; then
24fce8
+  menuentry_id_option="--id"
24fce8
+else
24fce8
+  menuentry_id_option=""
24fce8
+fi
24fce8
+
24fce8
+export menuentry_id_option
24fce8
+
24fce8
+if [ "${prev_saved_entry}" ]; then
24fce8
+  set saved_entry="${prev_saved_entry}"
24fce8
+  save_env saved_entry
24fce8
+  set prev_saved_entry=
24fce8
+  save_env prev_saved_entry
24fce8
+  set boot_once=true
24fce8
+fi
24fce8
+
24fce8
+function savedefault {
24fce8
+  if [ -z "${boot_once}" ]; then
24fce8
+    saved_entry="${chosen}"
24fce8
+    save_env saved_entry
24fce8
+  fi
24fce8
+}
24fce8
+
24fce8
+function load_video {
24fce8
+  if [ x$feature_all_video_module = xy ]; then
24fce8
+    insmod all_video
24fce8
+  else
24fce8
+    insmod efi_gop
24fce8
+    insmod efi_uga
24fce8
+    insmod ieee1275_fb
24fce8
+    insmod vbe
24fce8
+    insmod vga
24fce8
+    insmod video_bochs
24fce8
+    insmod video_cirrus
24fce8
+  fi
24fce8
+}
24fce8
+
24fce8
+terminal_output console
24fce8
+if [ x$feature_timeout_style = xy ] ; then
24fce8
+  set timeout_style=menu
24fce8
+  set timeout=5
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=5
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/00_tuned ###
24fce8
+set tuned_params=""
24fce8
+### END /etc/grub.d/00_tuned ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/01_users ###
24fce8
+if [ -f ${prefix}/user.cfg ]; then
24fce8
+  source ${prefix}/user.cfg
24fce8
+  if [ -n ${GRUB2_PASSWORD} ]; then
24fce8
+    set superusers="root"
24fce8
+    export superusers
24fce8
+    password_pbkdf2 root ${GRUB2_PASSWORD}
24fce8
+  fi
24fce8
+fi
24fce8
+### END /etc/grub.d/01_users ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'Red Hat Enterprise Linux Server (3.10.0-327.22.2.el7.x86_64.debug) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-91b16928-66bf-4801-8aed-fab3f1a6876c' {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod xfs
24fce8
+	set root='hd0,msdos1'
24fce8
+	if [ x$feature_platform_search_hint = xy ]; then
24fce8
+	  search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1'  7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	fi
24fce8
+	linux16 /vmlinuz-3.10.0-327.22.2.el7.x86_64.debug root=/dev/mapper/rhel_team--area--222-root ro crashkernel=auto rd.lvm.lv=rhel_team-area-222/root rd.lvm.lv=rhel_team-area-222/swap rhgb quiet LANG=en_US.UTF-8
24fce8
+}
24fce8
+menuentry 'Red Hat Enterprise Linux Server (3.10.0-327.22.2.el7.x86_64.debug) 7.2 (Maipo) with debugging' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-91b16928-66bf-4801-8aed-fab3f1a6876c' {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod xfs
24fce8
+	set root='hd0,msdos1'
24fce8
+	if [ x$feature_platform_search_hint = xy ]; then
24fce8
+	  search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1'  7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	fi
24fce8
+	linux16 /vmlinuz-3.10.0-327.22.2.el7.x86_64.debug root=/dev/mapper/rhel_team--area--222-root ro crashkernel=auto rd.lvm.lv=rhel_team-area-222/root rd.lvm.lv=rhel_team-area-222/swap rhgb quiet LANG=en_US.UTF-8 systemd.log_level=debug systemd.log_target=kmsg
24fce8
+}
24fce8
+menuentry 'Red Hat Enterprise Linux Server (3.10.0-327.el7.x86_64) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-91b16928-66bf-4801-8aed-fab3f1a6876c' {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod xfs
24fce8
+	set root='hd0,msdos1'
24fce8
+	if [ x$feature_platform_search_hint = xy ]; then
24fce8
+	  search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1'  7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	fi
24fce8
+	linux16 /vmlinuz-3.10.0-327.el7.x86_64 root=/dev/mapper/rhel_team--area--222-root ro crashkernel=auto rd.lvm.lv=rhel_team-area-222/root rd.lvm.lv=rhel_team-area-222/swap rhgb quiet LANG=en_US.UTF-8
24fce8
+	initrd16 /initramfs-3.10.0-327.el7.x86_64.img
24fce8
+}
24fce8
+menuentry 'Red Hat Enterprise Linux Server (0-rescue-925cd320373b6a4a9a66a26371afccd2) 7.2 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-925cd320373b6a4a9a66a26371afccd2-advanced-91b16928-66bf-4801-8aed-fab3f1a6876c' {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod xfs
24fce8
+	set root='hd0,msdos1'
24fce8
+	if [ x$feature_platform_search_hint = xy ]; then
24fce8
+	  search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1'  7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 7e972fc0-6cf8-4a58-ace6-1b381e52733d
24fce8
+	fi
24fce8
+	linux16 /vmlinuz-0-rescue-925cd320373b6a4a9a66a26371afccd2 root=/dev/mapper/rhel_team--area--222-root ro crashkernel=auto rd.lvm.lv=rhel_team-area-222/root rd.lvm.lv=rhel_team-area-222/swap rhgb quiet
24fce8
+	initrd16 /initramfs-0-rescue-925cd320373b6a4a9a66a26371afccd2.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+### END /etc/grub.d/20_linux_xen ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_ppc_terminfo ###
24fce8
+### END /etc/grub.d/20_ppc_terminfo ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/30_os-prober ###
24fce8
+### END /etc/grub.d/30_os-prober ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/40_custom ###
24fce8
+# This file provides an easy way to add custom menu entries.  Simply type the
24fce8
+# menu entries you want to add after this comment.  Be careful not to change
24fce8
+# the 'exec tail' line above.
24fce8
+### END /etc/grub.d/40_custom ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/41_custom ###
24fce8
+if [ -f  ${config_directory}/custom.cfg ]; then
24fce8
+  source ${config_directory}/custom.cfg
24fce8
+elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
24fce8
+  source $prefix/custom.cfg;
24fce8
+fi
24fce8
+### END /etc/grub.d/41_custom ###
24fce8
-- 
24fce8
2.17.1
24fce8