Messages in this thread Patch in this message | | | From | Tim Tianyang Chen <> | Subject | [PATCH v3 2/4] Ktest: add SigInt handling | Date | Mon, 26 Mar 2018 13:08:02 -0700 |
| |
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
| |