aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-12-11 17:37:41 -0500
committerSteven Rostedt <rostedt@goodmis.org>2012-12-11 18:18:46 -0500
commit7786954c95dbeba26ef39d2b6899bf06fbf2b629 (patch)
tree07b916a88e539aff2bf00836511251e58cfdab8d /tools/testing
parenta496872212e50a7e543a027faf35b0909459ec9e (diff)
ktest: Add native support for syslinux boot loader
I installed Fedora 17 which no longer supports grub v1. I worked with grub2 for a while, but there's so many issues with it and automated rebooting, that I decided to switch to syslinux. Instead of using the REBOOT_SCRIPT and add customized changes to get syslinux booted, I thought it better to make ktest aware of syslinux and add options to simplify the use of syslinux on a target test box. Acked-by: H. Peter Anvin <hpa@zytor.com> Cc: John 'Warthog9' Hawley <warthog9@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/ktest/ktest.pl28
-rw-r--r--tools/testing/ktest/sample.conf22
2 files changed, 48 insertions, 2 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index f4b8f96a9430..067337bbce7b 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -54,6 +54,8 @@ my %default = (
54 "STOP_TEST_AFTER" => 600, 54 "STOP_TEST_AFTER" => 600,
55 "MAX_MONITOR_WAIT" => 1800, 55 "MAX_MONITOR_WAIT" => 1800,
56 "GRUB_REBOOT" => "grub2-reboot", 56 "GRUB_REBOOT" => "grub2-reboot",
57 "SYSLINUX" => "extlinux",
58 "SYSLINUX_PATH" => "/boot/extlinux",
57 59
58# required, and we will ask users if they don't have them but we keep the default 60# required, and we will ask users if they don't have them but we keep the default
59# value something that is common. 61# value something that is common.
@@ -109,6 +111,9 @@ my $grub_menu;
109my $grub_file; 111my $grub_file;
110my $grub_number; 112my $grub_number;
111my $grub_reboot; 113my $grub_reboot;
114my $syslinux;
115my $syslinux_path;
116my $syslinux_label;
112my $target; 117my $target;
113my $make; 118my $make;
114my $pre_install; 119my $pre_install;
@@ -237,6 +242,9 @@ my %option_map = (
237 "GRUB_MENU" => \$grub_menu, 242 "GRUB_MENU" => \$grub_menu,
238 "GRUB_FILE" => \$grub_file, 243 "GRUB_FILE" => \$grub_file,
239 "GRUB_REBOOT" => \$grub_reboot, 244 "GRUB_REBOOT" => \$grub_reboot,
245 "SYSLINUX" => \$syslinux,
246 "SYSLINUX_PATH" => \$syslinux_path,
247 "SYSLINUX_LABEL" => \$syslinux_label,
240 "PRE_INSTALL" => \$pre_install, 248 "PRE_INSTALL" => \$pre_install,
241 "POST_INSTALL" => \$post_install, 249 "POST_INSTALL" => \$post_install,
242 "NO_INSTALL" => \$no_install, 250 "NO_INSTALL" => \$no_install,
@@ -373,7 +381,7 @@ EOF
373 ; 381 ;
374$config_help{"REBOOT_TYPE"} = << "EOF" 382$config_help{"REBOOT_TYPE"} = << "EOF"
375 Way to reboot the box to the test kernel. 383 Way to reboot the box to the test kernel.
376 Only valid options so far are "grub", "grub2", and "script". 384 Only valid options so far are "grub", "grub2", "syslinux", and "script".
377 385
378 If you specify grub, it will assume grub version 1 386 If you specify grub, it will assume grub version 1
379 and will search in /boot/grub/menu.lst for the title \$GRUB_MENU 387 and will search in /boot/grub/menu.lst for the title \$GRUB_MENU
@@ -386,6 +394,11 @@ $config_help{"REBOOT_TYPE"} = << "EOF"
386 394
387 If you specify grub2, then you also need to specify both \$GRUB_MENU 395 If you specify grub2, then you also need to specify both \$GRUB_MENU
388 and \$GRUB_FILE. 396 and \$GRUB_FILE.
397
398 If you specify syslinux, then you may use SYSLINUX to define the syslinux
399 command (defaults to extlinux), and SYSLINUX_PATH to specify the path to
400 the syslinux install (defaults to /boot/extlinux). But you have to specify
401 SYSLINUX_LABEL to define the label to boot to for the test kernel.
389EOF 402EOF
390 ; 403 ;
391$config_help{"GRUB_MENU"} = << "EOF" 404$config_help{"GRUB_MENU"} = << "EOF"
@@ -414,6 +427,11 @@ $config_help{"GRUB_FILE"} = << "EOF"
414 here. Use something like /boot/grub2/grub.cfg to search. 427 here. Use something like /boot/grub2/grub.cfg to search.
415EOF 428EOF
416 ; 429 ;
430$config_help{"SYSLINUX_LABEL"} = << "EOF"
431 If syslinux is used, the label that boots the target kernel must
432 be specified with SYSLINUX_LABEL.
433EOF
434 ;
417$config_help{"REBOOT_SCRIPT"} = << "EOF" 435$config_help{"REBOOT_SCRIPT"} = << "EOF"
418 A script to reboot the target into the test kernel 436 A script to reboot the target into the test kernel
419 (Only mandatory if REBOOT_TYPE = script) 437 (Only mandatory if REBOOT_TYPE = script)
@@ -545,6 +563,10 @@ sub get_ktest_configs {
545 get_ktest_config("GRUB_MENU"); 563 get_ktest_config("GRUB_MENU");
546 get_ktest_config("GRUB_FILE"); 564 get_ktest_config("GRUB_FILE");
547 } 565 }
566
567 if ($rtype eq "syslinux") {
568 get_ktest_config("SYSLINUX_LABEL");
569 }
548} 570}
549 571
550sub process_variables { 572sub process_variables {
@@ -1589,6 +1611,8 @@ sub reboot_to {
1589 run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch)'"; 1611 run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch)'";
1590 } elsif ($reboot_type eq "grub2") { 1612 } elsif ($reboot_type eq "grub2") {
1591 run_ssh "$grub_reboot $grub_number"; 1613 run_ssh "$grub_reboot $grub_number";
1614 } elsif ($reboot_type eq "syslinux") {
1615 run_ssh "$syslinux --once \\\"$syslinux_label\\\" $syslinux_path";
1592 } elsif (defined $reboot_script) { 1616 } elsif (defined $reboot_script) {
1593 run_command "$reboot_script"; 1617 run_command "$reboot_script";
1594 } 1618 }
@@ -3768,6 +3792,8 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
3768 } elsif ($reboot_type eq "grub2") { 3792 } elsif ($reboot_type eq "grub2") {
3769 dodie "GRUB_MENU not defined" if (!defined($grub_menu)); 3793 dodie "GRUB_MENU not defined" if (!defined($grub_menu));
3770 dodie "GRUB_FILE not defined" if (!defined($grub_file)); 3794 dodie "GRUB_FILE not defined" if (!defined($grub_file));
3795 } elsif ($reboot_type eq "syslinux") {
3796 dodie "SYSLINUX_LABEL not defined" if (!defined($syslinux_label));
3771 } 3797 }
3772 } 3798 }
3773 3799
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index 57617ec88c3b..4012e9330344 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -364,6 +364,22 @@
364# 364#
365#GRUB_MENU = Test Kernel 365#GRUB_MENU = Test Kernel
366 366
367# For REBOOT_TYPE = syslinux, the name of the syslinux executable
368# (on the target) to use to set up the next reboot to boot the
369# test kernel.
370# (default extlinux)
371#SYSLINUX = syslinux
372
373# For REBOOT_TYPE = syslinux, the path that is passed to to the
374# syslinux command where syslinux is installed.
375# (default /boot/extlinux)
376#SYSLINUX_PATH = /boot/syslinux
377
378# For REBOOT_TYPE = syslinux, the syslinux label that references the
379# test kernel in the syslinux config file.
380# (default undefined)
381#SYSLINUX_LABEL = "test-kernel"
382
367# A script to reboot the target into the test kernel 383# A script to reboot the target into the test kernel
368# This and SWITCH_TO_TEST are about the same, except 384# This and SWITCH_TO_TEST are about the same, except
369# SWITCH_TO_TEST is run even for REBOOT_TYPE = grub. 385# SWITCH_TO_TEST is run even for REBOOT_TYPE = grub.
@@ -516,7 +532,7 @@
516#POST_BUILD_DIE = 1 532#POST_BUILD_DIE = 1
517 533
518# Way to reboot the box to the test kernel. 534# Way to reboot the box to the test kernel.
519# Only valid options so far are "grub", "grub2" and "script" 535# Only valid options so far are "grub", "grub2", "syslinux" and "script"
520# (default grub) 536# (default grub)
521# If you specify grub, it will assume grub version 1 537# If you specify grub, it will assume grub version 1
522# and will search in /boot/grub/menu.lst for the title $GRUB_MENU 538# and will search in /boot/grub/menu.lst for the title $GRUB_MENU
@@ -527,6 +543,10 @@
527# For REBOOT_TYPE = grub2, you must define both GRUB_MENU and 543# For REBOOT_TYPE = grub2, you must define both GRUB_MENU and
528# GRUB_FILE. 544# GRUB_FILE.
529# 545#
546# For REBOOT_TYPE = syslinux, you must define SYSLINUX_LABEL, and
547# perhaps modify SYSLINUX (default extlinux) and SYSLINUX_PATH
548# (default /boot/extlinux)
549#
530# The entry in /boot/grub/menu.lst must be entered in manually. 550# The entry in /boot/grub/menu.lst must be entered in manually.
531# The test will not modify that file. 551# The test will not modify that file.
532#REBOOT_TYPE = grub 552#REBOOT_TYPE = grub