Blame SOURCES/0051-Add-tests-for-btrfs-support.patch

24fce8
From e35dee09e4b7446651dfa5b231328e52ce4f8918 Mon Sep 17 00:00:00 2001
24fce8
From: Gene Czarcinski <gczarcinski@gmail.com>
24fce8
Date: Mon, 9 Jun 2014 21:11:37 -0400
24fce8
Subject: [PATCH 51/55] Add tests for btrfs support
24fce8
24fce8
The tests performed are:
24fce8
- add kernel with /boot on btrfs subvol (20)
24fce8
- update kernel/add initrd with /boot on btrfs subvol (21)
24fce8
- add kernel with rootfs on btrfs subvol and /boot a directory (22)
24fce8
- update kernel/add initrd with rootfs on btrfs subvol and
24fce8
  /boot a directory (23)
24fce8
- add kernel and initrd with /boot on btrfs subvol (24)
24fce8
- add kernel and initrd with rootfs on btrfs subvol and /boot
24fce8
  a directory (25)
24fce8
---
24fce8
 test.sh                               |  40 +++++++
24fce8
 test/grub2-support_files/g2.20-mounts |   2 +
24fce8
 test/grub2-support_files/g2.21-mounts |   1 +
24fce8
 test/grub2-support_files/g2.22-mounts |   1 +
24fce8
 test/grub2-support_files/g2.23-mounts |   1 +
24fce8
 test/grub2-support_files/g2.24-mounts |   1 +
24fce8
 test/grub2-support_files/g2.25-mounts |   1 +
24fce8
 test/grub2.20                         | 126 ++++++++++++++++++++++
24fce8
 test/grub2.21                         | 140 +++++++++++++++++++++++++
24fce8
 test/grub2.22                         | 128 +++++++++++++++++++++++
24fce8
 test/grub2.23                         | 143 +++++++++++++++++++++++++
24fce8
 test/grub2.24                         | 126 ++++++++++++++++++++++
24fce8
 test/grub2.25                         | 128 +++++++++++++++++++++++
24fce8
 test/results/add/g2-1.20              | 140 +++++++++++++++++++++++++
24fce8
 test/results/add/g2-1.21              | 141 +++++++++++++++++++++++++
24fce8
 test/results/add/g2-1.22              | 143 +++++++++++++++++++++++++
24fce8
 test/results/add/g2-1.23              | 144 ++++++++++++++++++++++++++
24fce8
 test/results/add/g2-1.24              | 141 +++++++++++++++++++++++++
24fce8
 test/results/add/g2-1.25              | 144 ++++++++++++++++++++++++++
24fce8
 19 files changed, 1691 insertions(+)
24fce8
 create mode 100644 test/grub2-support_files/g2.20-mounts
24fce8
 create mode 120000 test/grub2-support_files/g2.21-mounts
24fce8
 create mode 100644 test/grub2-support_files/g2.22-mounts
24fce8
 create mode 120000 test/grub2-support_files/g2.23-mounts
24fce8
 create mode 120000 test/grub2-support_files/g2.24-mounts
24fce8
 create mode 120000 test/grub2-support_files/g2.25-mounts
24fce8
 create mode 100644 test/grub2.20
24fce8
 create mode 100644 test/grub2.21
24fce8
 create mode 100644 test/grub2.22
24fce8
 create mode 100644 test/grub2.23
24fce8
 create mode 100644 test/grub2.24
24fce8
 create mode 100644 test/grub2.25
24fce8
 create mode 100644 test/results/add/g2-1.20
24fce8
 create mode 100644 test/results/add/g2-1.21
24fce8
 create mode 100644 test/results/add/g2-1.22
24fce8
 create mode 100644 test/results/add/g2-1.23
24fce8
 create mode 100644 test/results/add/g2-1.24
24fce8
 create mode 100644 test/results/add/g2-1.25
24fce8
24fce8
diff --git a/test.sh b/test.sh
24fce8
index a97ada94d22..b3ba31e25ca 100755
24fce8
--- a/test.sh
24fce8
+++ b/test.sh
24fce8
@@ -682,6 +682,46 @@ if [ "$testgrub2" == "y" ]; then
24fce8
             --initrd /boot/initramfs-0-rescue-5a94251776a14678911d4ae0949500f5.img \
24fce8
             --copy-default --title "Fedora 21 Rescue" --args=root=/fooooo \
24fce8
             --remove-kernel=wtf --boot-filesystem=/boot/
24fce8
+
24fce8
+        testing="GRUB2 add kernel with boot on btrfs subvol"
24fce8
+        grub2Test grub2.20 add/g2-1.20 --add-kernel=/boot/new-kernel.img \
24fce8
+            --title='title' \
24fce8
+            --boot-filesystem=/boot/ \
24fce8
+            --copy-default \
24fce8
+            --mounts='test/grub2-support_files/g2.20-mounts'
24fce8
+
24fce8
+        testing="GRUB2 add initrd with boot on btrfs subvol"
24fce8
+        grub2Test grub2.21 add/g2-1.21 --update-kernel=/boot/new-kernel.img \
24fce8
+            --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
24fce8
+            --mounts='test/grub2-support_files/g2.21-mounts'
24fce8
+
24fce8
+        testing="GRUB2 add kernel with rootfs on btrfs subvol and boot directory"
24fce8
+        grub2Test grub2.22 add/g2-1.22 --add-kernel=/boot/new-kernel.img \
24fce8
+            --title='title' \
24fce8
+            --boot-filesystem= \
24fce8
+            --copy-default \
24fce8
+            --mounts='test/grub2-support_files/g2.22-mounts'
24fce8
+
24fce8
+        testing="GRUB2 add initrd with rootfs on btrfs subvol and boot directory"
24fce8
+        grub2Test grub2.23 add/g2-1.23 --update-kernel=/boot/new-kernel.img \
24fce8
+            --initrd=/boot/new-initrd --boot-filesystem= \
24fce8
+            --mounts='test/grub2-support_files/g2.23-mounts'
24fce8
+
24fce8
+        testing="GRUB2 add kernel and initrd with boot on btrfs subvol"
24fce8
+        grub2Test grub2.24 add/g2-1.24 --add-kernel=/boot/new-kernel.img \
24fce8
+            --title='title' \
24fce8
+            --initrd=/boot/new-initrd \
24fce8
+            --boot-filesystem=/boot/ \
24fce8
+            --copy-default \
24fce8
+            --mounts='test/grub2-support_files/g2.24-mounts'
24fce8
+
24fce8
+        testing="GRUB2 add kernel and initrd with rootfs on btrfs subvol and boot directory"
24fce8
+        grub2Test grub2.25 add/g2-1.25 --add-kernel=/boot/new-kernel.img \
24fce8
+            --title='title' \
24fce8
+            --initrd=/boot/new-initrd \
24fce8
+            --boot-filesystem= \
24fce8
+            --copy-default \
24fce8
+            --mounts='test/grub2-support_files/g2.25-mounts'
24fce8
     fi
24fce8
 fi
24fce8
 
24fce8
diff --git a/test/grub2-support_files/g2.20-mounts b/test/grub2-support_files/g2.20-mounts
24fce8
new file mode 100644
24fce8
index 00000000000..00bdb48e4ab
24fce8
--- /dev/null
24fce8
+++ b/test/grub2-support_files/g2.20-mounts
24fce8
@@ -0,0 +1,2 @@
24fce8
+/dev/sda	/	btrfs	subvol=/root6,defaults	0 0
24fce8
+/dev/sda	/boot	btrfs	subvol=/boot6,defaults	0 0
24fce8
diff --git a/test/grub2-support_files/g2.21-mounts b/test/grub2-support_files/g2.21-mounts
24fce8
new file mode 120000
24fce8
index 00000000000..42ef3fd4272
24fce8
--- /dev/null
24fce8
+++ b/test/grub2-support_files/g2.21-mounts
24fce8
@@ -0,0 +1 @@
24fce8
+g2.20-mounts
24fce8
\ No newline at end of file
24fce8
diff --git a/test/grub2-support_files/g2.22-mounts b/test/grub2-support_files/g2.22-mounts
24fce8
new file mode 100644
24fce8
index 00000000000..5b664e72519
24fce8
--- /dev/null
24fce8
+++ b/test/grub2-support_files/g2.22-mounts
24fce8
@@ -0,0 +1 @@
24fce8
+/dev/sda	/	btrfs	defaults,subvol=/root4,ro	0 0
24fce8
diff --git a/test/grub2-support_files/g2.23-mounts b/test/grub2-support_files/g2.23-mounts
24fce8
new file mode 120000
24fce8
index 00000000000..74f036fc4a3
24fce8
--- /dev/null
24fce8
+++ b/test/grub2-support_files/g2.23-mounts
24fce8
@@ -0,0 +1 @@
24fce8
+g2.22-mounts
24fce8
\ No newline at end of file
24fce8
diff --git a/test/grub2-support_files/g2.24-mounts b/test/grub2-support_files/g2.24-mounts
24fce8
new file mode 120000
24fce8
index 00000000000..42ef3fd4272
24fce8
--- /dev/null
24fce8
+++ b/test/grub2-support_files/g2.24-mounts
24fce8
@@ -0,0 +1 @@
24fce8
+g2.20-mounts
24fce8
\ No newline at end of file
24fce8
diff --git a/test/grub2-support_files/g2.25-mounts b/test/grub2-support_files/g2.25-mounts
24fce8
new file mode 120000
24fce8
index 00000000000..74f036fc4a3
24fce8
--- /dev/null
24fce8
+++ b/test/grub2-support_files/g2.25-mounts
24fce8
@@ -0,0 +1 @@
24fce8
+g2.22-mounts
24fce8
\ No newline at end of file
24fce8
diff --git a/test/grub2.20 b/test/grub2.20
24fce8
new file mode 100644
24fce8
index 00000000000..23b75fa8d3c
24fce8
--- /dev/null
24fce8
+++ b/test/grub2.20
24fce8
@@ -0,0 +1,126 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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/grub2.21 b/test/grub2.21
24fce8
new file mode 100644
24fce8
index 00000000000..579c2f6744a
24fce8
--- /dev/null
24fce8
+++ b/test/grub2.21
24fce8
@@ -0,0 +1,140 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'title' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/new-kernel.img root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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/grub2.22 b/test/grub2.22
24fce8
new file mode 100644
24fce8
index 00000000000..9466bc35153
24fce8
--- /dev/null
24fce8
+++ b/test/grub2.22
24fce8
@@ -0,0 +1,128 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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
+###
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/grub2.23 b/test/grub2.23
24fce8
new file mode 100644
24fce8
index 00000000000..5cb240fc1de
24fce8
--- /dev/null
24fce8
+++ b/test/grub2.23
24fce8
@@ -0,0 +1,143 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'title' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/new-kernel.img root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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
+###
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/grub2.24 b/test/grub2.24
24fce8
new file mode 100644
24fce8
index 00000000000..23b75fa8d3c
24fce8
--- /dev/null
24fce8
+++ b/test/grub2.24
24fce8
@@ -0,0 +1,126 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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/grub2.25 b/test/grub2.25
24fce8
new file mode 100644
24fce8
index 00000000000..9466bc35153
24fce8
--- /dev/null
24fce8
+++ b/test/grub2.25
24fce8
@@ -0,0 +1,128 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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
+###
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.20 b/test/results/add/g2-1.20
24fce8
new file mode 100644
24fce8
index 00000000000..579c2f6744a
24fce8
--- /dev/null
24fce8
+++ b/test/results/add/g2-1.20
24fce8
@@ -0,0 +1,140 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'title' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/new-kernel.img root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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.21 b/test/results/add/g2-1.21
24fce8
new file mode 100644
24fce8
index 00000000000..c0dded9724c
24fce8
--- /dev/null
24fce8
+++ b/test/results/add/g2-1.21
24fce8
@@ -0,0 +1,141 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'title' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/new-kernel.img root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/new-initrd
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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.22 b/test/results/add/g2-1.22
24fce8
new file mode 100644
24fce8
index 00000000000..5cb240fc1de
24fce8
--- /dev/null
24fce8
+++ b/test/results/add/g2-1.22
24fce8
@@ -0,0 +1,143 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'title' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/new-kernel.img root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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
+###
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.23 b/test/results/add/g2-1.23
24fce8
new file mode 100644
24fce8
index 00000000000..c3e87cf7897
24fce8
--- /dev/null
24fce8
+++ b/test/results/add/g2-1.23
24fce8
@@ -0,0 +1,144 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'title' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/new-kernel.img root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/new-initrd
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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
+###
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.24 b/test/results/add/g2-1.24
24fce8
new file mode 100644
24fce8
index 00000000000..c0dded9724c
24fce8
--- /dev/null
24fce8
+++ b/test/results/add/g2-1.24
24fce8
@@ -0,0 +1,141 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'title' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/new-kernel.img root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/new-initrd
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-81378818f7a24478b496ebef90e1dd69' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 1bab15a4-93ce-4373-8d7d-b77f907fd0c6
24fce8
+	fi
24fce8
+	linux16 /boot6/vmlinuz-0-rescue-81378818f7a24478b496ebef90e1dd69 root=UUID=1bab15a4-93ce-4373-8d7d-b77f907fd0c6 ro rootflags=subvol=root6 rhgb quiet
24fce8
+	initrd16 /boot6/initramfs-0-rescue-81378818f7a24478b496ebef90e1dd69.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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.25 b/test/results/add/g2-1.25
24fce8
new file mode 100644
24fce8
index 00000000000..c3e87cf7897
24fce8
--- /dev/null
24fce8
+++ b/test/results/add/g2-1.25
24fce8
@@ -0,0 +1,144 @@
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=15
24fce8
+# Fallback normal timeout code in case the timeout_style feature is
24fce8
+# unavailable.
24fce8
+else
24fce8
+  set timeout=15
24fce8
+fi
24fce8
+### END /etc/grub.d/00_header ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/10_linux ###
24fce8
+menuentry 'title' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/new-kernel.img root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/new-initrd
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 3.15.0-0.rc7.git2.1.fc21.x86_64' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	set gfxpayload=keep
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-3.15.0-0.rc7.git2.1.fc21.x86_64 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-3.15.0-0.rc7.git2.1.fc21.x86_64.img
24fce8
+}
24fce8
+menuentry 'Fedora, with Linux 0-rescue-20e7024f4e9c4b70b1042b91acd434c6' --class gnu-linux --class gnu --class os {
24fce8
+	load_video
24fce8
+	insmod gzio
24fce8
+	insmod part_msdos
24fce8
+	insmod part_msdos
24fce8
+	insmod btrfs
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'  --hint='hd1,msdos3'  54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	else
24fce8
+	  search --no-floppy --fs-uuid --set=root 54c6abc2-b1e7-4987-aa73-c79927be69eb
24fce8
+	fi
24fce8
+	linux16 /root4/boot/vmlinuz-0-rescue-20e7024f4e9c4b70b1042b91acd434c6 root=UUID=54c6abc2-b1e7-4987-aa73-c79927be69eb ro rootflags=subvol=root4 rhgb quiet
24fce8
+	initrd16 /root4/boot/initramfs-0-rescue-20e7024f4e9c4b70b1042b91acd434c6.img
24fce8
+}
24fce8
+
24fce8
+### END /etc/grub.d/10_linux ###
24fce8
+
24fce8
+### BEGIN /etc/grub.d/20_linux_xen ###
24fce8
+
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
+###
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