[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1523053025-12424-3-git-send-email-tianyang.chen@oracle.com>
Date: Fri, 6 Apr 2018 15:17:03 -0700
From: Tim Tianyang Chen <tianyang.chen@...cle.com>
To: rostedt@...dmis.org
Cc: linux-kernel@...r.kernel.org, dhaval.giani@...cle.com,
tim.tianyang.chen@...mni.upenn.edu,
Tim Tianyang Chen <tianyang.chen@...cle.com>
Subject: [PATCH v3 2/4] ktest: add SigInt handling
User can cancel tests and specify handler's behavior using option
'EMAIL_WHEN_CANCELED'.
Suggested-by: Dhaval Giani <dhaval.giani@...cle.com>
Signed-off-by: Tim Tianyang Chen <tianyang.chen@...cle.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
Powered by blists - more mailing lists