mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tim Tianyang Chen <tianyang.chen@oracle.com>
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	[thread overview]
Message-ID: <1522094884-22718-3-git-send-email-tianyang.chen@oracle.com> (raw)
In-Reply-To: <1522094884-22718-1-git-send-email-tianyang.chen@oracle.com>

User can cancel tests and specify handler's behavior using option
'EMAIL_WHEN_CANCELED'.

Suggested-by: Dhaval Giani <dhaval.giani@oracle.com>
Signed-off-by: Tim Tianyang Chen <tianyang.chen@oracle.com>
---
 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

  parent reply	other threads:[~2018-03-26 20:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-26 20:08 [PATCH v3 0/4] Ktest: add email support Tim Tianyang Chen
2018-03-26 20:08 ` [PATCH v3 1/4] " Tim Tianyang Chen
2018-04-06 18:24   ` Steven Rostedt
2018-04-06 22:19     ` Tim Tianyang Chen
2018-04-06 22:41       ` Steven Rostedt
2018-04-06 23:12         ` Tim Tianyang Chen
     [not found]         ` <d9720e54-4207-abf6-2ac2-b94ac847674e@oracle.com>
2018-04-07 22:51           ` Steven Rostedt
2018-03-26 20:08 ` Tim Tianyang Chen [this message]
2018-03-26 20:08 ` [PATCH v3 3/4] Ktest: use dodie for critical falures Tim Tianyang Chen
2018-03-26 20:08 ` [PATCH v3 4/4] Ktest: add email options to sample.config Tim Tianyang Chen
2018-04-03 19:06 ` [PATCH v3 0/4] Ktest: add email support Dhaval Giani
2018-04-03 19:52   ` Tim Tianyang Chen
2018-04-03 22:38     ` Steven Rostedt
2018-04-04 19:50       ` Steven Rostedt
2018-04-06 22:17 [PATCH v3 0/4] ktest: " Tim Tianyang Chen
2018-04-06 22:17 ` [PATCH v3 2/4] ktest: add SigInt handling Tim Tianyang Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1522094884-22718-3-git-send-email-tianyang.chen@oracle.com \
    --to=tianyang.chen@oracle.com \
    --cc=dhaval.giani@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®