From aa635c20efb65b41dac406404ad36a355fcb47b1 Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Mon, 28 Apr 2008 08:38:07 +0200 Subject: [PATCH] Reenable suite timeout detection --- mysql-test/mysql-test-run.pl | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 543789a3f5b..be14b235249 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -314,11 +314,15 @@ sub main { } } + if ( not defined @$completed ) { + mtr_error("Test suite aborted"); + } + if ( @$completed != $num_tests){ if ($opt_force){ # All test should have been run, print the completed list - foreach my $test ( @completed ){ + foreach my $test ( @$completed ){ $test->print_test(); } } @@ -330,8 +334,6 @@ sub main { "To continue, re-run with '--force'"); } - mtr_verbose("Server exit\n"); - mtr_print_line(); mtr_report_stats($completed); @@ -356,6 +358,8 @@ sub run_test_server { my %running; my $result; + my $suite_timeout_proc= My::SafeProcess->timer($opt_suite_timeout * 60); + my $s= IO::Select->new(); $s->add($server); while (1) { @@ -375,6 +379,7 @@ sub run_test_server { mtr_verbose("Child closed socket"); $s->remove($sock); if (--$childs == 0){ + $suite_timeout_proc->kill(); return $completed; } next; @@ -433,6 +438,7 @@ sub run_test_server { if ( !$opt_force ) { # Test has failed, force is off + $suite_timeout_proc->kill(); push(@$completed, $result); return $completed; } @@ -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 ($) { # ---------------------------------------------------------------------- if ( $opt_start or $opt_start_dirty ) { -# MASV $suite_timeout_proc->kill(); mtr_report("\nStarted", started(all_servers())); mtr_report("Waiting for server(s) to exit..."); my $proc= My::SafeProcess->wait_any(); @@ -2930,16 +2944,6 @@ sub run_testcase ($) { 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("Should never come here");