My previous fix for not ignoring warnings during server shutdown would
terminate the test suite completely in case of extra warnings,
omitting the error summary at the end.

This patch provides a much nicer summary report which includes all
test sequences that had warnings during shutdown.

Also add a $fail flag to make 100% sure mysql-test-run.pl will return
failure for any kind of problem occured during the test suite.

Also revert wrong "internal error" message from earlier patch.

---
 mysql-test/lib/mtr_report.pm |   21 ++++++++++++++++++++-
 mysql-test/mysql-test-run.pl |   27 ++++++++++++++-------------
 2 files changed, 34 insertions(+), 14 deletions(-)

Index: work-5.1-buildbot/mysql-test/lib/mtr_report.pm
===================================================================
--- work-5.1-buildbot.orig/mysql-test/lib/mtr_report.pm 2009-04-07 
13:40:41.000000000 +0200
+++ work-5.1-buildbot/mysql-test/lib/mtr_report.pm      2009-04-07 
13:40:56.000000000 +0200
@@ -187,8 +187,10 @@ sub mtr_report_test ($) {
 }
 
 
-sub mtr_report_stats ($) {
+sub mtr_report_stats ($$$) {
+  my $fail= shift;
   my $tests= shift;
+  my $extra_warnings= shift;
 
   # ----------------------------------------------------------------------
   # Find out how we where doing
@@ -325,10 +327,27 @@ sub mtr_report_stats ($) {
     print "All $tot_tests tests were successful.\n\n";
   }
 
+  if (@$extra_warnings)
+  {
+    print <<MSG;
+Errors/warnings were found in logfiles during server shutdown after running the
+following sequence(s) of tests:
+MSG
+    print "    $_\n" for @$extra_warnings;
+  }
+
   if ( $tot_failed != 0 || $found_problems)
   {
     mtr_error("there were failing test cases");
   }
+  elsif (@$extra_warnings)
+  {
+    mtr_error("There were errors/warnings in server logs after running test 
cases.");
+  }
+  elsif ($fail)
+  {
+    mtr_error("Test suite failure, see messages above for possible cause(s).");
+  }
 }
 
 
Index: work-5.1-buildbot/mysql-test/mysql-test-run.pl
===================================================================
--- work-5.1-buildbot.orig/mysql-test/mysql-test-run.pl 2009-04-07 
13:40:41.000000000 +0200
+++ work-5.1-buildbot/mysql-test/mysql-test-run.pl      2009-04-07 
13:41:53.000000000 +0200
@@ -357,7 +357,8 @@ sub main {
   mtr_print_thick_line();
   mtr_print_header();
 
-  my ($completed, $fail)= run_test_server($server, $tests, $opt_parallel);
+  my ($fail, $completed, $extra_warnings)=
+    run_test_server($server, $tests, $opt_parallel);
 
   # Send Ctrl-C to any children still running
   kill("INT", keys(%children));
@@ -393,10 +394,6 @@ sub main {
     mtr_error("Not all tests completed");
   }
 
-  if ($fail) {
-    mtr_error("Test suite failure.");
-  }
-
   mtr_print_line();
 
   if ( $opt_gcov ) {
@@ -404,7 +401,7 @@ sub main {
                 $opt_gcov_msg, $opt_gcov_err);
   }
 
-  mtr_report_stats($completed);
+  mtr_report_stats($fail, $completed, $extra_warnings);
 
   exit(0);
 }
@@ -416,7 +413,8 @@ sub run_test_server ($$$) {
   my $num_saved_cores= 0;  # Number of core files saved in vardir/log/ so far.
   my $num_saved_datadir= 0;  # Number of datadirs saved in vardir/log/ so far.
   my $num_failed_test= 0; # Number of tests failed so far
-  my $test_failure= 0;
+  my $test_failure= 0;    # Set true if test suite failed
+  my $extra_warnings= []; # Warnings found during server shutdowns
 
   # Scheduler variables
   my $max_ndb= $childs / 2;
@@ -450,7 +448,7 @@ sub run_test_server ($$$) {
          $s->remove($sock);
          if (--$childs == 0){
            $suite_timeout_proc->kill();
-           return ($completed, $test_failure);
+           return ($test_failure, $completed, $extra_warnings);
          }
          next;
        }
@@ -519,14 +517,14 @@ sub run_test_server ($$$) {
              # Test has failed, force is off
              $suite_timeout_proc->kill();
              push(@$completed, $result);
-             return ($completed, 1);
+             return (1, $completed, $extra_warnings);
            }
            elsif ($opt_max_test_fail > 0 and
                   $num_failed_test >= $opt_max_test_fail) {
              $suite_timeout_proc->kill();
              mtr_report("Too many tests($num_failed_test) failed!",
                         "Terminating...");
-             return (undef, 1);
+             return (1, $completed, $extra_warnings);
            }
            $num_failed_test++;
          }
@@ -580,13 +578,14 @@ sub run_test_server ($$$) {
        elsif ($line eq 'WARNINGS'){
           my $fake_test= My::Test::read_test($sock);
           my $test_list= join (" ", @{$fake_test->{testnames}});
+          push @$extra_warnings, $test_list;
           mtr_report("***Warnings generated in error logs during shutdown ".
                      "after running tests: $test_list");
           $test_failure= 1;
           if ( !$opt_force ) {
             # Test failure due to warnings, force is off
             $suite_timeout_proc->kill();
-            return ($completed, 1);
+            return (1, $completed, $extra_warnings);
           }
         } else {
          mtr_error("Unknown response: '$line' from client");
@@ -666,7 +665,7 @@ sub run_test_server ($$$) {
     if ( ! $suite_timeout_proc->wait_one(0) )
     {
       mtr_report("Test suite timeout! Terminating...");
-      return (undef, 1);
+      return (1, $completed, $extra_warnings);
     }
   }
 }
@@ -758,7 +757,9 @@ sub run_worker ($) {
     }
   }
 
-  die "Internal error: should not reach this place.";
+  stop_all_servers();
+
+  exit(1);
 }
 
 

-- 

_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to