diff options
author | Tim Tianyang Chen <tianyang.chen@oracle.com> | 2018-03-26 16:08:02 -0400 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-04-06 14:26:29 -0400 |
commit | 92db453e7eeb44efd43e977fa5ab417274834a9a (patch) | |
tree | 5ab751be7f4be6084df8a3aa102e005dd029b950 | |
parent | 2ceb2d85b6697e2a3485047d1c908a4908069411 (diff) |
Ktest: Add SigInt handling
User can cancel tests and specify handler's behavior using option
'EMAIL_WHEN_CANCELED'.
Link: http://lkml.kernel.org/r/1522094884-22718-3-git-send-email-tianyang.chen@oracle.com
Suggested-by: Dhaval Giani <dhaval.giani@oracle.com>
Signed-off-by: Tim Tianyang Chen <tianyang.chen@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index bb43f8631c95..1646af526089 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -4144,6 +4144,16 @@ sub send_email { | |||
4144 | } | 4144 | } |
4145 | } | 4145 | } |
4146 | 4146 | ||
4147 | sub cancel_test { | ||
4148 | if ($email_when_canceled) { | ||
4149 | send_email("KTEST: Your [$test_type] test was cancelled", | ||
4150 | "Your test started at $script_start_time was cancelled: sig int"); | ||
4151 | } | ||
4152 | die "\nCaught Sig Int, test interrupted: $!\n" | ||
4153 | } | ||
4154 | |||
4155 | $SIG{INT} = qw(cancel_test); | ||
4156 | |||
4147 | # First we need to do is the builds | 4157 | # First we need to do is the builds |
4148 | for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | 4158 | for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { |
4149 | 4159 | ||