Commit 92db453e authored by Tim Tianyang Chen's avatar Tim Tianyang Chen Committed by Steven Rostedt (VMware)

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.comSuggested-by: default avatarDhaval Giani <dhaval.giani@oracle.com>
Signed-off-by: default avatarTim Tianyang Chen <tianyang.chen@oracle.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 2ceb2d85
......@@ -4144,6 +4144,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++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment