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,
	tim.tianyang.chen@alumni.upenn.edu,
	Tim Tianyang Chen <tianyang.chen@oracle.com>
Subject: [PATCH v3 2/4] ktest: add SigInt handling
Date: Fri,  6 Apr 2018 15:17:03 -0700	[thread overview]
Message-ID: <1523053025-12424-3-git-send-email-tianyang.chen@oracle.com> (raw)
In-Reply-To: <1523053025-12424-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>
---
 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

  parent reply	other threads:[~2018-04-06 22:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06 22:17 [PATCH v3 0/4] ktest: add email support Tim Tianyang Chen
2018-04-06 22:17 ` [PATCH v3 1/4] " Tim Tianyang Chen
2018-04-06 22:17 ` Tim Tianyang Chen [this message]
2018-04-06 22:17 ` [PATCH v3 3/4] ktest: use dodie for critical falures Tim Tianyang Chen
2018-04-06 22:17 ` [PATCH v3 4/4] ktest: add email options to sample.config Tim Tianyang Chen
  -- strict thread matches above, loose matches on Subject: below --
2018-03-26 20:08 [PATCH v3 0/4] Ktest: add email support Tim Tianyang Chen
2018-03-26 20:08 ` [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=1523053025-12424-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 \
    --cc=tim.tianyang.chen@alumni.upenn.edu \
    /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®