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

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