Commit 53b24234 authored by unknown's avatar unknown

Reenable suite timeout detection

parent 26eae71c
...@@ -314,11 +314,15 @@ sub main { ...@@ -314,11 +314,15 @@ sub main {
} }
} }
if ( not defined @$completed ) {
mtr_error("Test suite aborted");
}
if ( @$completed != $num_tests){ if ( @$completed != $num_tests){
if ($opt_force){ if ($opt_force){
# All test should have been run, print the completed list # All test should have been run, print the completed list
foreach my $test ( @completed ){ foreach my $test ( @$completed ){
$test->print_test(); $test->print_test();
} }
} }
...@@ -330,8 +334,6 @@ sub main { ...@@ -330,8 +334,6 @@ sub main {
"To continue, re-run with '--force'"); "To continue, re-run with '--force'");
} }
mtr_verbose("Server exit\n");
mtr_print_line(); mtr_print_line();
mtr_report_stats($completed); mtr_report_stats($completed);
...@@ -356,6 +358,8 @@ sub run_test_server { ...@@ -356,6 +358,8 @@ sub run_test_server {
my %running; my %running;
my $result; my $result;
my $suite_timeout_proc= My::SafeProcess->timer($opt_suite_timeout * 60);
my $s= IO::Select->new(); my $s= IO::Select->new();
$s->add($server); $s->add($server);
while (1) { while (1) {
...@@ -375,6 +379,7 @@ sub run_test_server { ...@@ -375,6 +379,7 @@ sub run_test_server {
mtr_verbose("Child closed socket"); mtr_verbose("Child closed socket");
$s->remove($sock); $s->remove($sock);
if (--$childs == 0){ if (--$childs == 0){
$suite_timeout_proc->kill();
return $completed; return $completed;
} }
next; next;
...@@ -433,6 +438,7 @@ sub run_test_server { ...@@ -433,6 +438,7 @@ sub run_test_server {
if ( !$opt_force ) { if ( !$opt_force ) {
# Test has failed, force is off # Test has failed, force is off
$suite_timeout_proc->kill();
push(@$completed, $result); push(@$completed, $result);
return $completed; return $completed;
} }
...@@ -549,6 +555,15 @@ sub run_test_server { ...@@ -549,6 +555,15 @@ sub run_test_server {
} }
} }
} }
# ----------------------------------------------------
# Check if test suite timer expired
# ----------------------------------------------------
if ( ! $suite_timeout_proc->wait_one(0) )
{
mtr_report("Test suite timeout! Terminating...");
return undef;
}
} }
} }
...@@ -2771,7 +2786,6 @@ sub run_testcase ($) { ...@@ -2771,7 +2786,6 @@ sub run_testcase ($) {
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
if ( $opt_start or $opt_start_dirty ) if ( $opt_start or $opt_start_dirty )
{ {
# MASV $suite_timeout_proc->kill();
mtr_report("\nStarted", started(all_servers())); mtr_report("\nStarted", started(all_servers()));
mtr_report("Waiting for server(s) to exit..."); mtr_report("Waiting for server(s) to exit...");
my $proc= My::SafeProcess->wait_any(); my $proc= My::SafeProcess->wait_any();
...@@ -2930,16 +2944,6 @@ sub run_testcase ($) { ...@@ -2930,16 +2944,6 @@ sub run_testcase ($) {
return 1; return 1;
} }
# ----------------------------------------------------
# Check if test suite timer expired
# ----------------------------------------------------
# MASV
# if ( $proc eq $suite_timeout_proc )
# {
# mtr_report("Test suite timeout! Terminating...");
# exit(1);
# }
mtr_error("Unhandled process $proc exited"); mtr_error("Unhandled process $proc exited");
} }
mtr_error("Should never come here"); mtr_error("Should never come here");
......
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