From patchwork Fri Jan 20 09:16:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 46229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp96196wrn; Fri, 20 Jan 2023 01:17:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXsFj4IKnXSfa2kbSOam2HfIeoRUddunbb7LMD9EGGzwMolb99qoOBkRZH8/ph1DcZh96jvu X-Received: by 2002:a17:907:c019:b0:867:ef3f:dd85 with SMTP id ss25-20020a170907c01900b00867ef3fdd85mr11643625ejc.56.1674206278648; Fri, 20 Jan 2023 01:17:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674206278; cv=none; d=google.com; s=arc-20160816; b=ohUDyHuumnaYMUtkZYCoaXfxT+hOJ0Lz23vEVTwt/6GHNuoDmOyk455uGzkFcgbOJf 7jNSbiAA6Yc8jf6aA14ooaI/tm8cfcsc0pJcUgYicBAqe8eEZzMg2EQxRk0uhLAtDVIg n5/jjb/0THY91j7WRKRu8SppfZPaEElubQyrXoRJ8h4JgGwTuoAWDCTLuE9ly26LglIu +CW8tKdeCwdFARTy+CkZJpqgKsgv03GltL6gr9eEYsMjF58pPJHQHc2IDE1pbdPASn6E nO8khiXOG3USCqPP9pEESm+odglqUJyValvhLyoqGE84lzGOE9Ua3dZaKY2DMdVg7MY4 czgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:subject:cc:to:from:dkim-signature; bh=fdsv5VyI3Ulup86gFkH8mNkMv/VAuOqgLG2X5Ry2XfA=; b=toi8XTrSscW1gIrUE4dlnNuqz4I8cgMxFG+DbsX8EosAdpN+Gb7k6z0/hSVi5WEMNo n8OrN8VgPHs9Pk6soQjgJmu0XbeZlgy32NQNnm67TpW7avz+N0NEcr7HF4zfraTIU3tL mJSs0Y5Cd1k0jmIjcHkfl7LA3Cfwlb+f/QgC4OUVMcPHdlDlO6kNaRq7Sx4vCv00ADbL Kkv+rJ4p1NDNHvTbNXEWQHeyM6GXpRmzfY61ge2CWJUUscnqf+ZcYYG7oPuAvH57QnOi BA3DlZoywfuEnzeWEOYjrlzM/24fmDwl6VuWqdbqoj6qYgSQR4b6i0IyaegI8cdAov/K +qYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mCShWcPu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xf9-20020a17090731c900b0084d0b4b4fdbsi45860241ejb.555.2023.01.20.01.17.32; Fri, 20 Jan 2023 01:17:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mCShWcPu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230008AbjATJQ4 (ORCPT + 99 others); Fri, 20 Jan 2023 04:16:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230042AbjATJQx (ORCPT ); Fri, 20 Jan 2023 04:16:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68BE390863 for ; Fri, 20 Jan 2023 01:16:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 12EAB61E5D for ; Fri, 20 Jan 2023 09:16:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D5F3C433EF; Fri, 20 Jan 2023 09:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674206179; bh=KTNR9LhVdrM+/rBfaq95DAQYa8pxtNZi3bmJKjmNgrY=; h=From:To:Cc:Subject:Date:From; b=mCShWcPuse7og84SELWbj2KjDHSLC2MGOyXozLwO0asViFNLhm0n/UTXR2BNZDDRY npgEhyPnSnUIS5XoTLFBqxb8gpy2AKG0lhCU21gEVx0FcFy5Q04P7Il0AhcKqFvjLk bBMozRynucAd5L9+WWAkOI0iHH8dhYYNfwKqOoRPR+c6/Q23XwghHSTyL3wD2vOeJV mqGihdTncuZstEmbsHIIV9KnBQkH7XXA96F38e6DnhZ0NSm2C2L5QrzhY5F+vKSgIa ehJaJeh1qpFygIbM6UUbG6FMusC5fdkgcGVw2LDt4v77IKbVBNyAjoxfajZ1jGD4bQ vduBZLBJLIrzw== From: "Masami Hiramatsu (Google)" To: LKML Cc: John 'Warthog9' Hawley , Masami Hiramatsu , Steven Rostedt Subject: [PATCH] ktest: Restore stty setting at first in dodie Date: Fri, 20 Jan 2023 18:16:16 +0900 Message-Id: <167420617635.2988775.13045295332829029437.stgit@devnote3> X-Mailer: git-send-email 2.39.0.246.g2a6d74b583-goog User-Agent: StGit/0.19 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755532522564659495?= X-GMAIL-MSGID: =?utf-8?q?1755532522564659495?= From: Masami Hiramatsu (Google) The do_send_email() will call die before restoring stty if sendmail setting is not correct or sendmail is not installed. It is safer to restore it in the beginning of dodie(). Signed-off-by: Masami Hiramatsu (Google) --- tools/testing/ktest/ktest.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index ac59999ed3de..9fb3d79b084c 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -1535,6 +1535,11 @@ sub dodie { return if ($in_die); $in_die = 1; + if ($monitor_cnt) { + # restore terminal settings + system("stty $stty_orig"); + } + my $i = $iteration; doprint "CRITICAL FAILURE... [TEST $i] ", @_, "\n"; @@ -1581,11 +1586,6 @@ sub dodie { "Your test started at $script_start_time has failed with:\n@_\n", $log_file); } - if ($monitor_cnt) { - # restore terminal settings - system("stty $stty_orig"); - } - if (defined($post_test)) { run_command $post_test; }