diff options
Diffstat (limited to 'mysql-test/lib')
-rw-r--r-- | mysql-test/lib/mtr_cases.pm | 4 | ||||
-rw-r--r-- | mysql-test/lib/mtr_match.pm (renamed from mysql-test/lib/mtr_match.pl) | 21 | ||||
-rw-r--r-- | mysql-test/lib/mtr_report.pm | 248 |
3 files changed, 35 insertions, 238 deletions
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index a8b1fc6bc59..52eb84118b7 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -25,6 +25,7 @@ use base qw(Exporter); our @EXPORT= qw(collect_option collect_test_cases); use mtr_report; +use mtr_match; # Options used for the collect phase our $start_from; @@ -55,7 +56,6 @@ use IO::File(); use My::Config; use My::Platform; -require "mtr_match.pl"; require "mtr_misc.pl"; # Precompiled regex's for tests to do or skip @@ -425,7 +425,7 @@ sub collect_one_suite($) if (@combinations) { - print " - adding combinations\n"; + print " - adding combinations for $suite\n"; #print_testcases(@cases); my @new_cases; diff --git a/mysql-test/lib/mtr_match.pl b/mysql-test/lib/mtr_match.pm index 96aa43f4fa2..40afd4e0336 100644 --- a/mysql-test/lib/mtr_match.pl +++ b/mysql-test/lib/mtr_match.pm @@ -18,20 +18,17 @@ # and is part of the translation of the Bourne shell script with the # same name. +package mtr_match; use strict; -sub mtr_match_prefix ($$); -sub mtr_match_extension ($$); -sub mtr_match_any_exact ($$); +use base qw(Exporter); +our @EXPORT= qw(mtr_match_prefix + mtr_match_extension + mtr_match_substring); -############################################################################## # -# -# -############################################################################## - # Match a prefix and return what is after the prefix - +# sub mtr_match_prefix ($$) { my $string= shift; my $prefix= shift; @@ -47,8 +44,9 @@ sub mtr_match_prefix ($$) { } +# # Match extension and return the name without extension - +# sub mtr_match_extension ($$) { my $file= shift; my $ext= shift; @@ -64,8 +62,9 @@ sub mtr_match_extension ($$) { } +# # Match a substring anywere in a string - +# sub mtr_match_substring ($$) { my $string= shift; my $substring= shift; diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 8b40177c5e0..a3c0f26c8fd 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -29,6 +29,7 @@ our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line mtr_report_test_failed mtr_report_test_skipped mtr_report_stats); +use mtr_match; require "mtr_io.pl"; my $tot_real_time= 0; @@ -115,7 +116,13 @@ sub mtr_report_test_failed ($$) { $tinfo->{'result'}= 'MTR_RES_FAILED'; my $test_failures= $tinfo->{'failures'} || 0; $tinfo->{'failures'}= $test_failures + 1; - if ( defined $tinfo->{'timeout'} ) + if ( defined $tinfo->{'warnings'} ) + { + mtr_report("[ fail ] Found warnings in server log file!"); + mtr_report($tinfo->{'warnings'}); + return; + } + elsif ( defined $tinfo->{'timeout'} ) { mtr_report("[ fail ] timeout"); return; @@ -161,7 +168,7 @@ sub mtr_report_stats ($) { my $tot_failed= 0; my $tot_tests= 0; my $tot_restarts= 0; - my $found_problems= 0; # Some warnings in the logfiles are errors... + my $found_problems= 0; foreach my $tinfo (@$tests) { @@ -183,6 +190,16 @@ sub mtr_report_stats ($) { { $tot_restarts++; } + + # Look for warnings produced by mysqltest + my $base_file= mtr_match_extension($tinfo->{'result_file'}, + "result"); # Trim extension + my $warning_file= "$base_file.warnings"; + if ( -f $warning_file ) + { + $found_problems= 1; + mtr_warning("Check myqltest warnings in '$warning_file'"); + } } # ---------------------------------------------------------------------- @@ -198,231 +215,12 @@ sub mtr_report_stats ($) { time - $BASETIME, "seconds executing testcases"); } - # ---------------------------------------------------------------------- - # If a debug run, there might be interesting information inside - # the "var/log/*.err" files. We save this info in "var/log/warnings" - # ---------------------------------------------------------------------- - if ( $::opt_warnings ) + my $warnlog= "$::opt_vardir/log/warnings"; + if ( -f $warnlog ) { - # Save and report if there was any fatal warnings/errors in err logs - - my $warnlog= "$::opt_vardir/log/warnings"; - - unless ( open(WARN, ">$warnlog") ) - { - mtr_warning("can't write to the file \"$warnlog\": $!"); - } - else - { - # We report different types of problems in order - foreach my $pattern ( "^Warning:", - "\\[Warning\\]", - "\\[ERROR\\]", - "^Error:", "^==.* at 0x", - "InnoDB: Warning", - "InnoDB: Error", - "^safe_mutex:", - "missing DBUG_RETURN", - "mysqld: Warning", - "allocated at line", - "Attempting backtrace", "Assertion .* failed" ) - { - foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") ) - { - my $testname= ""; - unless ( open(ERR, $errlog) ) - { - mtr_warning("can't read $errlog"); - next; - } - my $leak_reports_expected= undef; - while ( <ERR> ) - { - # There is a test case that purposely provokes a - # SAFEMALLOC leak report, even though there is no actual - # leak. We need to detect this, and ignore the warning in - # that case. - if (/Begin safemalloc memory dump:/) { - $leak_reports_expected= 1; - } elsif (/End safemalloc memory dump./) { - $leak_reports_expected= undef; - } - - # Skip some non fatal warnings from the log files - if ( - /\"SELECT UNIX_TIMESTAMP\(\)\" failed on master/ or - /Aborted connection/ or - /Client requested master to start replication from impossible position/ or - /Could not find first log file name in binary log/ or - /Enabling keys got errno/ or - /Error reading master configuration/ or - /Error reading packet/ or - /Event Scheduler/ or - /Failed to open log/ or - /Failed to open the existing master info file/ or - /Forcing shutdown of [0-9]* plugins/ or - /Can't open shared library .*\bha_example\b/ or - /Couldn't load plugin .*\bha_example\b/ or - - # Due to timing issues, it might be that this warning - # is printed when the server shuts down and the - # computer is loaded. - /Forcing close of thread \d+ user: '.*?'/ or - - /Got error [0-9]* when reading table/ or - /Incorrect definition of table/ or - /Incorrect information in file/ or - /InnoDB: Warning: we did not need to do crash recovery/ or - /Invalid \(old\?\) table or database name/ or - /Lock wait timeout exceeded/ or - /Log entry on master is longer than max_allowed_packet/ or - /unknown option '--loose-/ or - /unknown variable 'loose-/ or - /You have forced lower_case_table_names to 0 through a command-line option/ or - /Setting lower_case_table_names=2/ or - /NDB Binlog:/ or - /NDB: failed to setup table/ or - /NDB: only row based binary logging/ or - /Neither --relay-log nor --relay-log-index were used/ or - /Query partially completed/ or - /Slave I.O thread aborted while waiting for relay log/ or - /Slave SQL thread is stopped because UNTIL condition/ or - /Slave SQL thread retried transaction/ or - /Slave \(additional info\)/ or - /Slave: .*Duplicate column name/ or - /Slave: .*master may suffer from/ or - /Slave: According to the master's version/ or - /Slave: Column [0-9]* type mismatch/ or - /Slave: Error .* doesn't exist/ or - /Slave: Error .*Deadlock found/ or - /Slave: Error .*Unknown table/ or - /Slave: Error in Write_rows event: / or - /Slave: Field .* of table .* has no default value/ or - /Slave: Field .* doesn't have a default value/ or - /Slave: Query caused different errors on master and slave/ or - /Slave: Table .* doesn't exist/ or - /Slave: Table width mismatch/ or - /Slave: The incident LOST_EVENTS occured on the master/ or - /Slave: Unknown error.* 1105/ or - /Slave: Can't drop database.* database doesn't exist/ or - /Slave SQL:.*(?:Error_code: \d+|Query:.*)/ or - /Sort aborted/ or - /Time-out in NDB/ or - /One can only use the --user.*root/ or - /Setting lower_case_table_names=2/ or - /Table:.* on (delete|rename)/ or - /You have an error in your SQL syntax/ or - /deprecated/ or - /description of time zone/ or - /equal MySQL server ids/ or - /error .*connecting to master/ or - /error reading log entry/ or - /lower_case_table_names is set/ or - /skip-name-resolve mode/ or - /slave SQL thread aborted/ or - /Slave: .*Duplicate entry/ or - # Special case for Bug #26402 in show_check.test - # Question marks are not valid file name parts - # on Windows platforms. Ignore this error message. - /\QCan't find file: '.\test\????????.frm'\E/ or - # Special case, made as specific as possible, for: - # Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes - # server coredump - /\QError in Log_event::read_log_event(): 'Sanity check failed', data_len: 258, event_type: 49\E/ or - /Statement is not safe to log in statement format/ or - - # test case for Bug#bug29807 copies a stray frm into database - /InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal/ or - /Cannot find or open table test\/bug29807 from/ or - - # innodb foreign key tests that fail in ALTER or RENAME produce this - /InnoDB: Error: in ALTER TABLE `test`.`t[12]`/ or - /InnoDB: Error: in RENAME TABLE table `test`.`t1`/ or - /InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal/ or - - # Test case for Bug#14233 produces the following warnings: - /Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc/ or - /Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc/ or - /Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc/ or - - # BUG#29839 - lowercase_table3.test: Cannot find table test/T1 - # from the internal data dictiona - /Cannot find table test\/BUG29839 from the internal data dictionary/ or - # BUG#32080 - Excessive warnings on Solaris: setrlimit could not - # change the size of core files - /setrlimit could not change the size of core files to 'infinity'/ or - - # rpl_extrColmaster_*.test, the slave thread produces warnings - # when it get updates to a table that has more columns on the - # master - /Slave: Unknown column 'c7' in 't15' Error_code: 1054/ or - /Slave: Can't DROP 'c7'.* 1091/ or - /Slave: Key column 'c6'.* 1072/ or - - # rpl_idempotency.test produces warnings for the slave. - ($testname eq 'rpl.rpl_idempotency' and - (/Slave: Can\'t find record in \'t1\' Error_code: 1032/ or - /Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452/ - )) or - - # These tests does "kill" on queries, causing sporadic errors when writing to logs - (($testname eq 'rpl.rpl_skip_error' or - $testname eq 'rpl.rpl_err_ignoredtable' or - $testname eq 'binlog.binlog_killed_simulate' or - $testname eq 'binlog.binlog_killed') and - (/Failed to write to mysql\.\w+_log/ - )) or - - # rpl_bug33931 has deliberate failures - ($testname eq 'rpl.rpl_bug33931' and - (/Failed during slave.*thread initialization/ - )) or - - # rpl_temporary has an error on slave that can be ignored - ($testname eq 'rpl.rpl_temporary' and - (/Slave: Can\'t find record in \'user\' Error_code: 1032/ - )) or - - # Test case for Bug#31590 produces the following error: - /Out of sort memory; increase server sort buffer size/ - ) - { - next; # Skip these lines - } - if ( /CURRENT_TEST: (.*)/ ) - { - $testname= $1; - } - if ( /$pattern/ ) - { - if ($leak_reports_expected) { - next; - } - $found_problems= 1; - print WARN basename($errlog) . ": $testname: $_"; - } - } - } - } - - if ( $::opt_check_testcases ) - { - # Look for warnings produced by mysqltest in testname.warnings - foreach my $test_warning_file - ( glob("$::glob_mysql_test_dir/r/*.warnings") ) - { - $found_problems= 1; - print WARN "Check myqltest warnings in $test_warning_file\n"; - } - } - - if ( $found_problems ) - { - mtr_warning("Got errors/warnings while running tests, please examine", - "\"$warnlog\" for details."); - } - } + mtr_warning("Got errors/warnings while running tests, please examine", + "'$warnlog' for details."); } print "\n"; |