Received: by 10.213.65.68 with SMTP id h4csp1720149imn; Mon, 26 Mar 2018 13:18:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELsQ3NduedTMGniTwo8x+2T3JEJ2S0oZGwpbh4txukK/ueTpTIYlh9mDkZ+WoXtZdtC/pZTQ X-Received: by 2002:a17:902:28e4:: with SMTP id f91-v6mr34069561plb.336.1522095529741; Mon, 26 Mar 2018 13:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522095529; cv=none; d=google.com; s=arc-20160816; b=1FNf69xizRhLdh4jsWpqg3m+BCGj/LYR8ejJnBqLcfNC59UAANoV0sYzt4Cld/PKuE o7etJkeZVAwMuj6ZYLs12YQxsAoErQlcRIbGa879HmYxk3Umj3wgTOoOH3RczGxlGa6o XO8vcy53DQAcIqpJWd0kzQOmv9cWqqCwakUOZCrievCh9NWfKRtbTx1sLodOd04YBT9E pWMZbe0OM0hOg2hYGLFW+AEELuEL6/X/7aAVfpdI+4B5GD4K6J+9hj3bvskSNEQ5mske NoNtogZKnUVLbv/dteNDnUaHS0Ffwycew9rCMKaM/U1jhWFr/pRt4G2ccdG7ywOL9CcE P9sw== 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=twlp+78KJUMUg+R4mOnbHfxb3Q4l7xdBmAa2m7Fln4I=; b=VoTdUCsY8+QJVpedtLcLxqjHUXz5oLazyQPQcKJXcJw3k2i+Mevmt5aaw/qW+2qR71 G8sVlbYvPJgdxx5LU0GRMr1RDm4UHFvmLMZyJch3aRGkEC/aMRNcyGMl372QA086vWp0 LKFNQe2Rx1S4cenpd0vfCUNn2oymb8FWu6WhGdtSfDvXjqKVum4cz7PzEq3q0tpyCCT/ rwA2VVuoJFLkB4etv7obmac+w1xFkTwFBbUK92u+8tl0v8NnxUkAgmKoCtE3lHjFZn1G BCJ3Ycwu5nKqr4MokEpk46VoWJIbFZ2DDuReVmaji353S3Sg/pI8e2mtTZ9mWJQMmFsu CQJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=cL7/Ir5T; 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 g1-v6si15721683plp.327.2018.03.26.13.18.35; Mon, 26 Mar 2018 13:18:49 -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=cL7/Ir5T; 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 S1751714AbeCZUR1 (ORCPT + 99 others); Mon, 26 Mar 2018 16:17:27 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50894 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750983AbeCZUR0 (ORCPT ); Mon, 26 Mar 2018 16:17:26 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2QK3rAB022223; Mon, 26 Mar 2018 20:17:23 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=twlp+78KJUMUg+R4mOnbHfxb3Q4l7xdBmAa2m7Fln4I=; b=cL7/Ir5TyP7cr27gsBhDjB4qm1XL26zxxG0vX64RmcfT6UZEHaf2wa6cF0k3REw7vx4G 8PLfeFSqHykxzvw/IaB4dZf7ILc1CwRePhws1BEdo6ZVyOsMfZk7WTVXuYiTLBbM2/A7 p+qNaPVOss3WNqT1+2pm3MiL7U7RJ8exyDayRckFSVSMz7xlg4eLg51NiIUesIHd1T/t MNYqqwK3t6iEq3XcJYlUgBkmWL526wenzVuluDkG7Kd0pX9QrRyPl08NcMYOrYCU0jmn ImCHNJh+tlfukpLI+Q+D+Fa5uK3vmpGdVnqmjgk4gNm7EOZSLUAe1O+M3wmMx2+LqXrS Fw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2gy7jn05s2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Mar 2018 20:17:09 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2QK8nK1022303 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Mar 2018 20:08:50 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2QK8ngt030754; Mon, 26 Mar 2018 20:08:49 GMT Received: from titichen-linux.us.oracle.com (/10.211.54.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Mar 2018 13:08:48 -0700 From: Tim Tianyang Chen To: rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, dhaval.giani@oracle.com Subject: [PATCH v3 2/4] Ktest: add SigInt handling Date: Mon, 26 Mar 2018 13:08:02 -0700 Message-Id: <1522094884-22718-3-git-send-email-tianyang.chen@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522094884-22718-1-git-send-email-tianyang.chen@oracle.com> References: <1522094884-22718-1-git-send-email-tianyang.chen@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8844 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=504 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803260203 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 --- ktest.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ktest.pl b/ktest.pl index 9469783bc6c1..8be12ee27d34 100755 --- a/ktest.pl +++ b/ktest.pl @@ -4269,6 +4269,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++) { -- 2.15.1