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

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