Received: by 10.213.65.68 with SMTP id h4csp48965imn; Fri, 6 Apr 2018 15:21:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx48i2jT6DLKpks63Kg2FmRfc33DEPoZDrLPs9s9u1BFNxxYty2VDiywdaxT8lwHaU0qql98L X-Received: by 10.101.96.200 with SMTP id r8mr18865597pgv.152.1523053299415; Fri, 06 Apr 2018 15:21:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523053299; cv=none; d=google.com; s=arc-20160816; b=h8R1l6BhDhBnKkWO9iXuxSj26X59ueeTx6XN3w7MSvPdBytixnLpJZvs8dQ5lsg4zV w1QOiXxowDm3cqgIwSurkO5icw5BGuD3qASJDVqOz/bcP9TnfKWFrMgj2pP3dE0Oq/94 ynsaGipJuxO0pp6Q68fDut3cr2libZ+JxGDj33pO6/JCmdXDmOnJk27G7rK3UNBFuQ1n G9uUZSsX+Q7bTcHA4a2GjP7RVdnjfipkHkCO9hfnTPaftyccTageqdHsFWrc+XmRdpRo Hw7hRdKoFVUNZPmz2Ja/6fZZ52YIJB0ZEw9t2oSg30TVCwjDQJsnjCBUKnvsoJpSilFW pf3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=fdZzZgAa0VAMfE8ObfPNNAwvoGxaj8O6/2JBNtqkrGU=; b=F1prrO1k6FdfLlLPF7OENopZZ2e0W++pSFKPm4QkNB6WoGvisnt4P1rlnqWBvjMSvI IAxKXbaSaAJJidZ2K5BwU0CmJd8nXWj7lg++q4IQj0zxvtdaJElaeBMASV90ffMlPZuN kl5fAZ4v1rmLt3gsKN3k9Dmffygg3sRfJp7vLphYmEsFkux6KYCEWV3D78tPjm9BEBIH VsMPiS5ZjGvf89fJI6jQeRPqHFOsppIpShQGdHUBsSuOwDEIzMzTZO/k8Vb+ZncbzKdw zWNeQCSv8QRvFIPZWpIstWUElhgWCe9DA74aquLPzYeXHc9UCRIpXI/aOSo0ldz+/ys2 8irw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=lIanC/si; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si8736167pfi.87.2018.04.06.15.21.02; Fri, 06 Apr 2018 15:21:39 -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=@oracle.com header.s=corp-2017-10-26 header.b=lIanC/si; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752680AbeDFWSF (ORCPT + 99 others); Fri, 6 Apr 2018 18:18:05 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:35766 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751807AbeDFWR3 (ORCPT ); Fri, 6 Apr 2018 18:17:29 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w36M4Q1F077881; Fri, 6 Apr 2018 22:17:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=fdZzZgAa0VAMfE8ObfPNNAwvoGxaj8O6/2JBNtqkrGU=; b=lIanC/siqqqrGCJmGo/oYvwD/oA8agwHSG+As3Y/6e1mPEV3XjPpdm38DfbO1B79LYdv LdSfiYxWAi379lxD055hRION56sd2Z+OcNneE5eN7Mt7QfCbl1zIgeWmVTrhUoDltmMo 9kuA4NxrTbcE2AsHUlpcJnPQReDpFsRNvLlZmFrxIqx8S8bPE9iTEkW2Vpr+7+XjqoVd vcodnpHW5v4GXtC0dR/WuGtKVNKxenY4QtDB7bOLl89J5Uf5Q2odCOwl5u9zjHzyqJ27 uMXhw7tvkW0HaDx3y+stAG8ezeZ4aBZ4fENTEMllvJjWh0tQE71OrNTUyon/HJ4cWuej gQ== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2h5kc6etsx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Apr 2018 22:17:26 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w36MHQo1018739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 Apr 2018 22:17:26 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w36MHPrl031272; Fri, 6 Apr 2018 22:17:25 GMT Received: from titichen-linux.us.oracle.com (/10.211.54.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 06 Apr 2018 15:17:25 -0700 From: Tim Tianyang Chen To: rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, dhaval.giani@oracle.com, tim.tianyang.chen@alumni.upenn.edu, Tim Tianyang Chen Subject: [PATCH v3 2/4] ktest: add SigInt handling Date: Fri, 6 Apr 2018 15:17:03 -0700 Message-Id: <1523053025-12424-3-git-send-email-tianyang.chen@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523053025-12424-1-git-send-email-tianyang.chen@oracle.com> References: <1523053025-12424-1-git-send-email-tianyang.chen@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8855 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=648 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804060222 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org User can cancel tests and specify handler's behavior using option 'EMAIL_WHEN_CANCELED'. Suggested-by: Dhaval Giani Signed-off-by: Tim Tianyang Chen --- tools/testing/ktest/ktest.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index a9a6318b1395..b0db4a6d3e97 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -4267,6 +4267,16 @@ sub send_email { } } +sub cancel_test { + if ($email_when_canceled) { + send_email("KTEST: Your [$test_type] test was cancelled", + "Your test started at $script_start_time was cancelled: sig int"); + } + die "\nCaught Sig Int, test interrupted: $!\n" +} + +$SIG{INT} = qw(cancel_test); + # First we need to do is the builds for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { -- 1.8.3.1