ktest.pl: Fix incorrect reboot for grub2bls
authorLibo Chen <libo.chen@oracle.com>
Sat, 21 Nov 2020 02:12:43 +0000 (18:12 -0800)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Mon, 30 Nov 2020 21:29:40 +0000 (16:29 -0500)
This issue was first noticed when I was testing different kernels on
Oracle Linux 8 which as Fedora 30+ adopts BLS as default. Even though a
kernel entry was added successfully and the index of that kernel entry was
retrieved correctly, ktest still wouldn't reboot the system into
user-specified kernel.

The bug was spotted in subroutine reboot_to where the if-statement never
checks for REBOOT_TYPE "grub2bls", therefore the desired entry will not be
set for the next boot.

Add a check for "grub2bls" so that $grub_reboot $grub_number can
be run before a reboot if REBOOT_TYPE is "grub2bls" then we can boot to
the correct kernel.

Link: https://lkml.kernel.org/r/20201121021243.1532477-1-libo.chen@oracle.com
Cc: stable@vger.kernel.org
Fixes: ac2466456eaa ("ktest: introduce grub2bls REBOOT_TYPE option")
Signed-off-by: Libo Chen <libo.chen@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
tools/testing/ktest/ktest.pl

index cb16d2a..54188ee 100755 (executable)
@@ -2040,7 +2040,7 @@ sub reboot_to {
 
     if ($reboot_type eq "grub") {
        run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch)'";
-    } elsif ($reboot_type eq "grub2") {
+    } elsif (($reboot_type eq "grub2") or ($reboot_type eq "grub2bls")) {
        run_ssh "$grub_reboot $grub_number";
     } elsif ($reboot_type eq "syslinux") {
        run_ssh "$syslinux --once \\\"$syslinux_label\\\" $syslinux_path";