Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp626395yba; Thu, 18 Apr 2019 07:04:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwsVhO0NNtiSDdrnvkRh8rWDfdAeoPBxEJojPcaG0+vtBapsxgJ6L8EFult+QrcFWydhKM X-Received: by 2002:a17:902:70c8:: with SMTP id l8mr96702888plt.177.1555596278677; Thu, 18 Apr 2019 07:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555596278; cv=none; d=google.com; s=arc-20160816; b=iRKjlqcikWMdjidKtixTBwlUkaDDsoGA0t3xfcwTfD/6LfveHpxc2ojI2NBm0U0do2 a8VdO7ihgx8UJBoPES2PntazWmP7EAFA3S5exS6feTtY4whvhYC7pJ7O4japAIVQ+YQE 3s3FUDwtl4q5Qouan6Dn1mQUz8j6uOx2EBThUnReSWE2eR8ZPBRQlWx5nJAjEJwaYnVI /GECAEFKvtXV/o3PCLdTSt4c/DPH2HMN1hVvTWmuYXEFwd16T5M04TZvQUgmAZwoZDO5 nSHcCAszJeegXEMWjQDinck7T26nfoA804xjVq5FILuDnGGpjf3eaRDmDHMBM7sQfTum 2rIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=fU33i2t0JsbXbTrgFcHGxGxjaSIcKOBtCPoE/HmqfNs=; b=ZYEWBwl+wgWYE4iLGcjTPgIBswDETghWfMtCcYDWyq4arWHHI61cjMQbrk9HuUawt6 Q76Fuhz3fh60TaEqkadYHbjm7pav6XDkcGsVaVp2/mguv+XTElyB7NG/xBBXf8NNhoFk 6fj7bLDMb5+ngSlff1BJyN/Fy46kNNdVOYFxTzDywqn2Vo0MmbXDuvVMIn20GNb0ybAs FHuJoy5Ywsz7O0L8upKp0WY7eYfO+WWPXhXR5CtulnK8j2kKPm03LKYFWbYtrjsIo4kX ANPHXi8JAi1JR6t/57o0Vr8GcJBO/JDmD0RXCZPhFMTU9LLwoFmmpqSO1UTk/MjHL+45 KGOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Am/DuWnR"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 74si1942701pgb.203.2019.04.18.07.04.22; Thu, 18 Apr 2019 07:04:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Am/DuWnR"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389195AbfDROAj (ORCPT + 99 others); Thu, 18 Apr 2019 10:00:39 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:36323 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729331AbfDROAj (ORCPT ); Thu, 18 Apr 2019 10:00:39 -0400 Received: by mail-qk1-f195.google.com with SMTP id s83so1198801qke.3 for ; Thu, 18 Apr 2019 07:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=fU33i2t0JsbXbTrgFcHGxGxjaSIcKOBtCPoE/HmqfNs=; b=Am/DuWnRjzrUqI6+QfqM/uha/AEU1TjxWtdRleJWPQGRMUMHsPtT5ZLgIz3uSn7syp rD+2SG1qWR4iqoAxXFk0OQGGLgoHPW6r7tkRwGmS20q0037cnF1l/e7vw/iw3UBjT0n7 m1trbtrtW8k3cK/tW+0IPOnVUkxnJfycGVqKTKg3HDohMzrSZ4tXZv0PUJoF71XiE6oc ZTXlsqwFnybQzU+4k+qhVnQ95w1TKq9FWR0KEN3AzuXdxhIN/VKHjuO9f5clVSe0R3ei i6qAcaSAOxPXwj6xm9h2ogfzsNUR/FuhVQud8/sYwmD5eMFMYEAHmDtIoc1jZDOKDWl5 C40Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fU33i2t0JsbXbTrgFcHGxGxjaSIcKOBtCPoE/HmqfNs=; b=IlxsK59vDgMWBLGoTtluuBb8/yPYosy+ihHMJqwmcxo09EwaX7wYukvlihrhtOzjNV ZPjluuDhZ6+9t2lTuvbPfw/d/v5/g7+udX4NVS47DQ1lgRMljC76jcOgD3eEfaR1X4w8 +B80NTt+fQ9CzmvOaizXbAzbADWz3D7K+Vz5VV39fwpAWXn/Zp88BG2wTfX0arstzlvX Vrl0/OJAjVHh21gvLPKpv7NwqIdEo/yMnU1Xqfdr9DBSd5v6LgXAXLhuFydDJ45etN2W uJY4wbQ5NlR6MtSfvFJQe4kg7OwdvNo6ZvcoinRCFlkopioOaHCuMagCTY97qSsXV+3F DsCw== X-Gm-Message-State: APjAAAV7tdaVG5NtmiCcrnJPdjIhSEebmZQG73bpsmRXpInKa9+cnKGH U/fmUVk78MJ5glGvWOdbGA== X-Received: by 2002:a37:a02:: with SMTP id 2mr29034870qkk.258.1555596038368; Thu, 18 Apr 2019 07:00:38 -0700 (PDT) Received: from gabell.cable.rcn.com (209-6-122-159.s2973.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [209.6.122.159]) by smtp.gmail.com with ESMTPSA id b24sm980332qtr.51.2019.04.18.07.00.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 07:00:37 -0700 (PDT) From: Masayoshi Mizuma To: Steven Rostedt Cc: Masayoshi Mizuma , Masayoshi Mizuma , linux-kernel@vger.kernel.org Subject: [PATCH v2] ktest: introduce REBOOT_RETURN_CODE to confirm the result of REBOOT Date: Thu, 18 Apr 2019 09:59:43 -0400 Message-Id: <20190418135943.12640-1-msys.mizuma@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masayoshi Mizuma 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. Signed-off-by: Masayoshi Mizuma --- tools/testing/ktest/ktest.pl | 9 +++++++++ tools/testing/ktest/sample.conf | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index fc6140d45280..751e32a31ed4 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -58,6 +58,7 @@ my %default = ( "SCP_TO_TARGET" => "scp \$SRC_FILE \$SSH_USER\@\$MACHINE:\$DST_FILE", "SCP_TO_TARGET_INSTALL" => "\${SCP_TO_TARGET}", "REBOOT" => "ssh \$SSH_USER\@\$MACHINE reboot", + "REBOOT_RETURN_CODE" => 255, "STOP_AFTER_SUCCESS" => 10, "STOP_AFTER_FAILURE" => 60, "STOP_TEST_AFTER" => 600, @@ -105,6 +106,7 @@ my $reboot_type; my $reboot_script; my $power_cycle; my $reboot; +my $reboot_return_code; my $reboot_on_error; my $switch_to_good; my $switch_to_test; @@ -278,6 +280,7 @@ my %option_map = ( "POST_BUILD_DIE" => \$post_build_die, "POWER_CYCLE" => \$power_cycle, "REBOOT" => \$reboot, + "REBOOT_RETURN_CODE" => \$reboot_return_code, "BUILD_NOCLEAN" => \$noclean, "MIN_CONFIG" => \$minconfig, "OUTPUT_MIN_CONFIG" => \$output_minconfig, @@ -1737,6 +1740,7 @@ sub run_command { my $dord = 0; my $dostdout = 0; my $pid; + my $command_orig = $command; $command =~ s/\$SSH_USER/$ssh_user/g; $command =~ s/\$MACHINE/$machine/g; @@ -1791,6 +1795,11 @@ sub run_command { # shift 8 for real exit status $run_command_status = $? >> 8; + if ($command_orig eq $default{REBOOT} && + $run_command_status == $reboot_return_code) { + $run_command_status = 0; + } + close(CMD); close(LOG) if ($dolog); close(RD) if ($dord); diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf index 6ca6ca0ce695..8c893a58b68e 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf @@ -887,6 +887,10 @@ # The variables SSH_USER and MACHINE are defined. #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 # banner. If the kernel banner for the kernel we are testing is # found, and then later a kernel banner for another kernel version -- 2.20.1