ktest: Take submenu into account for grub2 menus
authorSatoru Takeuchi <satoru.takeuchi@gmail.com>
Fri, 22 Sep 2017 04:38:19 +0000 (13:38 +0900)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 10 Apr 2018 19:49:14 +0000 (15:49 -0400)
grub-reboot selects the submenu's first menuentry (title is "1>0") rather than ktest's
menuentry (title is "2") by mistake.

===
$ sudo cat /boot/grub/grub.cfg  | grep -E "^menuentry|^submenu"
...
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option '...' {
...
submenu 'Advanced options for Ubuntu' $menuentry_id_option '...' {
...
menuentry 'ktest' {
...
===

Correct it by taking submenu entries into account in get_grub2_index().

Link: http://lkml.kernel.org/r/87poaje4as.wl-satoru.takeuchi@gmail.com
Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
tools/testing/ktest/ktest.pl

index a14fc30..777388c 100755 (executable)
@@ -1872,7 +1872,7 @@ sub get_grub2_index {
            $grub_number++;
            $found = 1;
            last;
-       } elsif (/^menuentry\s/) {
+       } elsif (/^menuentry\s|^submenu\s/) {
            $grub_number++;
        }
     }