Commit 37e16773 authored by Masayoshi Mizuma's avatar Masayoshi Mizuma Committed by Steven Rostedt (VMware)

ktest: introduce REBOOT_RETURN_CODE to confirm the result of REBOOT

Unexpected power cycle occurs while the installation of the
kernel.

   ssh root@Test sync ... [0 seconds] SUCCESS
   ssh root@Test reboot ... [1 second] FAILED!
   virsh destroy Test; sleep 5; virsh start Test ... [6 seconds] SUCCESS

That is because REBOOT, the default is "ssh $SSH_USER@$MACHINE
reboot", exits as 255 even if the reboot is successfully done,
like as:

   ]# ssh root@Test reboot
   Connection to Test closed by remote host.
   ]# echo $?
   255
   ]#

To avoid the unexpected power cycle, introduce a new parameter,
REBOOT_RETURN_CODE to judge whether REBOOT is successfully done
or not.

Link: http://lkml.kernel.org/r/20190418135943.12640-1-msys.mizuma@gmail.comSigned-off-by: default avatarMasayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 68911069
...@@ -58,6 +58,7 @@ my %default = ( ...@@ -58,6 +58,7 @@ my %default = (
"SCP_TO_TARGET" => "scp \$SRC_FILE \$SSH_USER\@\$MACHINE:\$DST_FILE", "SCP_TO_TARGET" => "scp \$SRC_FILE \$SSH_USER\@\$MACHINE:\$DST_FILE",
"SCP_TO_TARGET_INSTALL" => "\${SCP_TO_TARGET}", "SCP_TO_TARGET_INSTALL" => "\${SCP_TO_TARGET}",
"REBOOT" => "ssh \$SSH_USER\@\$MACHINE reboot", "REBOOT" => "ssh \$SSH_USER\@\$MACHINE reboot",
"REBOOT_RETURN_CODE" => 255,
"STOP_AFTER_SUCCESS" => 10, "STOP_AFTER_SUCCESS" => 10,
"STOP_AFTER_FAILURE" => 60, "STOP_AFTER_FAILURE" => 60,
"STOP_TEST_AFTER" => 600, "STOP_TEST_AFTER" => 600,
...@@ -105,6 +106,7 @@ my $reboot_type; ...@@ -105,6 +106,7 @@ my $reboot_type;
my $reboot_script; my $reboot_script;
my $power_cycle; my $power_cycle;
my $reboot; my $reboot;
my $reboot_return_code;
my $reboot_on_error; my $reboot_on_error;
my $switch_to_good; my $switch_to_good;
my $switch_to_test; my $switch_to_test;
...@@ -278,6 +280,7 @@ my %option_map = ( ...@@ -278,6 +280,7 @@ my %option_map = (
"POST_BUILD_DIE" => \$post_build_die, "POST_BUILD_DIE" => \$post_build_die,
"POWER_CYCLE" => \$power_cycle, "POWER_CYCLE" => \$power_cycle,
"REBOOT" => \$reboot, "REBOOT" => \$reboot,
"REBOOT_RETURN_CODE" => \$reboot_return_code,
"BUILD_NOCLEAN" => \$noclean, "BUILD_NOCLEAN" => \$noclean,
"MIN_CONFIG" => \$minconfig, "MIN_CONFIG" => \$minconfig,
"OUTPUT_MIN_CONFIG" => \$output_minconfig, "OUTPUT_MIN_CONFIG" => \$output_minconfig,
...@@ -1749,6 +1752,7 @@ sub run_command { ...@@ -1749,6 +1752,7 @@ sub run_command {
my $dord = 0; my $dord = 0;
my $dostdout = 0; my $dostdout = 0;
my $pid; my $pid;
my $command_orig = $command;
$command =~ s/\$SSH_USER/$ssh_user/g; $command =~ s/\$SSH_USER/$ssh_user/g;
$command =~ s/\$MACHINE/$machine/g; $command =~ s/\$MACHINE/$machine/g;
...@@ -1803,6 +1807,11 @@ sub run_command { ...@@ -1803,6 +1807,11 @@ sub run_command {
# shift 8 for real exit status # shift 8 for real exit status
$run_command_status = $? >> 8; $run_command_status = $? >> 8;
if ($command_orig eq $default{REBOOT} &&
$run_command_status == $reboot_return_code) {
$run_command_status = 0;
}
close(CMD); close(CMD);
close(LOG) if ($dolog); close(LOG) if ($dolog);
close(RD) if ($dord); close(RD) if ($dord);
......
...@@ -887,6 +887,10 @@ ...@@ -887,6 +887,10 @@
# The variables SSH_USER and MACHINE are defined. # The variables SSH_USER and MACHINE are defined.
#REBOOT = ssh $SSH_USER@$MACHINE reboot #REBOOT = ssh $SSH_USER@$MACHINE reboot
# The return code of REBOOT
# (default 255)
#REBOOT_RETURN_CODE = 255
# The way triple faults are detected is by testing the kernel # The way triple faults are detected is by testing the kernel
# banner. If the kernel banner for the kernel we are testing is # banner. If the kernel banner for the kernel we are testing is
# found, and then later a kernel banner for another kernel version # found, and then later a kernel banner for another kernel version
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment