diff options
| -rwxr-xr-x | tools/testing/ktest/ktest.pl | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 87af8a68ab25..75f8cecdd549 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
| @@ -1437,16 +1437,27 @@ sub do_not_reboot { | |||
| 1437 | 1437 | ||
| 1438 | my $in_die = 0; | 1438 | my $in_die = 0; |
| 1439 | 1439 | ||
| 1440 | sub get_test_name() { | ||
| 1441 | my $name; | ||
| 1442 | |||
| 1443 | if (defined($test_name)) { | ||
| 1444 | $name = "$test_name:$test_type"; | ||
| 1445 | } else { | ||
| 1446 | $name = $test_type; | ||
| 1447 | } | ||
| 1448 | return $name; | ||
| 1449 | } | ||
| 1450 | |||
| 1440 | sub dodie { | 1451 | sub dodie { |
| 1441 | 1452 | ||
| 1442 | # avoid recusion | 1453 | # avoid recusion |
| 1443 | return if ($in_die); | 1454 | return if ($in_die); |
| 1444 | $in_die = 1; | 1455 | $in_die = 1; |
| 1445 | 1456 | ||
| 1446 | doprint "CRITICAL FAILURE... ", @_, "\n"; | ||
| 1447 | |||
| 1448 | my $i = $iteration; | 1457 | my $i = $iteration; |
| 1449 | 1458 | ||
| 1459 | doprint "CRITICAL FAILURE... [TEST $i] ", @_, "\n"; | ||
| 1460 | |||
| 1450 | if ($reboot_on_error && !do_not_reboot) { | 1461 | if ($reboot_on_error && !do_not_reboot) { |
| 1451 | 1462 | ||
| 1452 | doprint "REBOOTING\n"; | 1463 | doprint "REBOOTING\n"; |
| @@ -1462,7 +1473,8 @@ sub dodie { | |||
| 1462 | } | 1473 | } |
| 1463 | 1474 | ||
| 1464 | if ($email_on_error) { | 1475 | if ($email_on_error) { |
| 1465 | send_email("KTEST: critical failure for your [$test_type] test", | 1476 | my $name = get_test_name; |
| 1477 | send_email("KTEST: critical failure for test $i [$name]", | ||
| 1466 | "Your test started at $script_start_time has failed with:\n@_\n"); | 1478 | "Your test started at $script_start_time has failed with:\n@_\n"); |
| 1467 | } | 1479 | } |
| 1468 | 1480 | ||
| @@ -4193,7 +4205,8 @@ sub send_email { | |||
| 4193 | 4205 | ||
| 4194 | sub cancel_test { | 4206 | sub cancel_test { |
| 4195 | if ($email_when_canceled) { | 4207 | if ($email_when_canceled) { |
| 4196 | send_email("KTEST: Your [$test_type] test was cancelled", | 4208 | my $name = get_test_name; |
| 4209 | send_email("KTEST: Your [$name] test was cancelled", | ||
| 4197 | "Your test started at $script_start_time was cancelled: sig int"); | 4210 | "Your test started at $script_start_time was cancelled: sig int"); |
| 4198 | } | 4211 | } |
| 4199 | die "\nCaught Sig Int, test interrupted: $!\n" | 4212 | die "\nCaught Sig Int, test interrupted: $!\n" |
| @@ -4247,7 +4260,8 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 4247 | run_command $pre_ktest; | 4260 | run_command $pre_ktest; |
| 4248 | } | 4261 | } |
| 4249 | if ($email_when_started) { | 4262 | if ($email_when_started) { |
| 4250 | send_email("KTEST: Your [$test_type] test was started", | 4263 | my $name = get_test_name; |
| 4264 | send_email("KTEST: Your [$name] test was started", | ||
| 4251 | "Your test was started on $script_start_time"); | 4265 | "Your test was started on $script_start_time"); |
| 4252 | } | 4266 | } |
| 4253 | } | 4267 | } |
| @@ -4414,7 +4428,7 @@ if ($opt{"POWEROFF_ON_SUCCESS"}) { | |||
| 4414 | doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n"; | 4428 | doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n"; |
| 4415 | 4429 | ||
| 4416 | if ($email_when_finished) { | 4430 | if ($email_when_finished) { |
| 4417 | send_email("KTEST: Your [$test_type] test has finished!", | 4431 | send_email("KTEST: Your test has finished!", |
| 4418 | "$successes of $opt{NUM_TESTS} tests started at $script_start_time were successful!"); | 4432 | "$successes of $opt{NUM_TESTS} tests started at $script_start_time were successful!"); |
| 4419 | } | 4433 | } |
| 4420 | exit 0; | 4434 | exit 0; |
