Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4529371yba; Wed, 17 Apr 2019 13:30:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxN2Q6W3SV8KlGzk6x0rvjAXfkUK/13MfHZ5GNcoMw+p5NyDIn2ksfaHx7YNv5LfujNgPRY X-Received: by 2002:a63:185a:: with SMTP id 26mr58093903pgy.337.1555533055735; Wed, 17 Apr 2019 13:30:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555533055; cv=none; d=google.com; s=arc-20160816; b=jv4JfYniLROPEA6zID+8Q4oGmdqDv9NMJeNouMIx/2clvZumE2db1pz91j56nSiDsp hyRJhacvstw5s/JPY2iUH9nBkjpWeyqDwGyG2v5dxON2KMEXIz8Fq7qWvFW5G2iY+V5l 7VMd/F1J6OaOyIq8ASL6ghC8pGb+mbyzVCUgDk53WpFCvFzUATvIUP8VWLwUESoKUAas h4RMJlo9fXtYsaJlTBgVn2zB/MAKssy5+MmzNO6V/H9RwyJpkm02u6wBY2gkj8HPhXv7 uoTvRBUS2T7S5Cpbh9Oj6w9XFcDgxXN5DOGXZeRHFm0g2T+DaVHpFzspDnAjFnW4kBWW oMgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=MACZxyOjzva0ezq7Nx3KRm4dMEh2rZtA7pq1mG8sFBU=; b=r8tXYpUGzYr4Rm/qNMzuur8/NYrSXuGaEX84Gvkxj8V/VvUQFWzyZsOtwlRP30RZgF e7ulOT9WnZ6rYtlq+u5T5M3kv+KVD5tG7KS2uy5diUPoZ+yD1hqRbkRe5FeR7jknotv/ v8gEpL7mhyRrSh+tdIO3TEUdqed0EQigCj4ELioRaoL9+sXaK9pPYvnHqhIOXs7P21k3 ffB5YlzuzoNtCCob0fOXIEei8ikSqgXstR6pcegeYrm060MtJQmLZCSUwoCaMWSV4kTM yHoARIJjs8wLYHozOfjaijf1NQCCTii1tzSlrHjr76q9yjy7f4uYQFQ6lghWSxfPzu1g arug== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34si21205776plp.239.2019.04.17.13.30.39; Wed, 17 Apr 2019 13:30:55 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731215AbfDQU3p (ORCPT + 99 others); Wed, 17 Apr 2019 16:29:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:44702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727147AbfDQU3p (ORCPT ); Wed, 17 Apr 2019 16:29:45 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DEA33206BA; Wed, 17 Apr 2019 20:29:43 +0000 (UTC) Date: Wed, 17 Apr 2019 16:29:42 -0400 From: Steven Rostedt To: Masayoshi Mizuma Cc: Masayoshi Mizuma , linux-kernel@vger.kernel.org Subject: Re: [PATCH] ktest: Add workaround to avoid unexpected power cycle Message-ID: <20190417162942.375b3e3f@gandalf.local.home> In-Reply-To: <20190417201442.15030-1-msys.mizuma@gmail.com> References: <20190417201442.15030-1-msys.mizuma@gmail.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Apr 2019 16:14:42 -0400 Masayoshi Mizuma wrote: > From: Masayoshi Mizuma > > Unexpected power cycle occurs while the installation of the > kernel. > > That is because the default reboot command, "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, the reboot is considered as > successfully done if the reboot is the default command and the > return code is 255. > Ah that explains why I've been seeing this :-) Can we add a config modifying variable called: REBOOT_RETURN_CODE that is by default 255 and can be changed by the config file? You just need to add in %default: "REBOOT_RETURN_CODE" => 255, my $reboot_return_code; and in %option_map: "REBOOT_RETURN_CODE" => \$reboot_return_code, > Signed-off-by: Masayoshi Mizuma > --- > tools/testing/ktest/ktest.pl | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl > index ea07d43856b8..765c6bc83ab4 100755 > --- a/tools/testing/ktest/ktest.pl > +++ b/tools/testing/ktest/ktest.pl > @@ -1737,6 +1737,11 @@ sub run_command { > my $dord = 0; > my $dostdout = 0; > my $pid; > + my $is_default_reboot = 0; > + > + if ($command eq $default{REBOOT}) { > + $is_default_reboot = 1; > + } Do we really need to add this variable? > > $command =~ s/\$SSH_USER/$ssh_user/g; > $command =~ s/\$MACHINE/$machine/g; > @@ -1791,6 +1796,10 @@ sub run_command { > # shift 8 for real exit status > $run_command_status = $? >> 8; > > + if ($run_command_status == 255 && $is_default_reboot) { Instead can we have: if ($command eq $default{REBOOT} && $run_command_status == $reboot_return_code) { ? Thanks for these patches! -- Steve > + $run_command_status = 0; > + } > + > close(CMD); > close(LOG) if ($dolog); > close(RD) if ($dord);