Fix return code from check-warnings to indicate if test failed or not.

No more string matching
parent d348362d
...@@ -4,5 +4,9 @@ ...@@ -4,5 +4,9 @@
# for unexpected warnings found in the servers error log # for unexpected warnings found in the servers error log
# #
--disable_query_log --disable_query_log
call mtr.check_warnings(); call mtr.check_warnings(@result);
if (`select @result = 0`){
skip OK;
}
echo Found warnings;
--enable_query_log --enable_query_log
...@@ -19,7 +19,7 @@ BEGIN ...@@ -19,7 +19,7 @@ BEGIN
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA;
-- The test database should not contain any tables -- The test database should not contain any tables
SELECT table_name FROM INFORMATION_SCHEMA.TABLES SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema='test'; WHERE table_schema='test';
-- Show "mysql" database, tables and columns -- Show "mysql" database, tables and columns
......
...@@ -208,7 +208,7 @@ INSERT INTO global_supressions VALUES ...@@ -208,7 +208,7 @@ INSERT INTO global_supressions VALUES
-- Procedure that uses the above created tables to check -- Procedure that uses the above created tables to check
-- the servers error log for warnings -- the servers error log for warnings
-- --
CREATE DEFINER=root@localhost PROCEDURE check_warnings() CREATE DEFINER=root@localhost PROCEDURE check_warnings(OUT result INT)
BEGIN BEGIN
-- Don't write these queries to binlog -- Don't write these queries to binlog
...@@ -225,6 +225,7 @@ BEGIN ...@@ -225,6 +225,7 @@ BEGIN
FROM information_schema.global_variables FROM information_schema.global_variables
WHERE variable_name='LOG_ERROR'; WHERE variable_name='LOG_ERROR';
SET @@session.max_allowed_packet= 1024*1024*1024;
SET @text= load_file(@log_error); SET @text= load_file(@log_error);
-- select @text; -- select @text;
...@@ -269,8 +270,11 @@ BEGIN ...@@ -269,8 +270,11 @@ BEGIN
SELECT line as log_error SELECT line as log_error
FROM suspect_lines WHERE supressed=0; FROM suspect_lines WHERE supressed=0;
SELECT * FROM test_supressions; SELECT * FROM test_supressions;
-- Return 2 -> check failed
SELECT 2 INTO result;
ELSE ELSE
SELECT "OK"; -- Return 0 -> OK
SELECT 0 INTO RESULT;
END IF; END IF;
-- Cleanup for next test -- Cleanup for next test
......
...@@ -2568,8 +2568,6 @@ sub run_check_warnings ($$) { ...@@ -2568,8 +2568,6 @@ sub run_check_warnings ($$) {
if ( $res == 0 ) if ( $res == 0 )
{ {
my $report= mtr_grab_file($errfile); my $report= mtr_grab_file($errfile);
if ($report ne "OK\nOK\n")
{
# Log to var/log/warnings file # Log to var/log/warnings file
mtr_tofile("$opt_vardir/log/warnings", mtr_tofile("$opt_vardir/log/warnings",
$tname."\n", $tname."\n",
...@@ -2577,13 +2575,9 @@ sub run_check_warnings ($$) { ...@@ -2577,13 +2575,9 @@ sub run_check_warnings ($$) {
$res= 1; $res= 1;
$tinfo->{'warnings'}.= $report; $tinfo->{'warnings'}.= $report;
}
} }
elsif ( $res == 62 ) elsif ( $res == 62 ) {
{ # Test case was ok and called "skip"
# One of the features needed to run check_warnings.test was not
# available, check skipped
$res= 0; $res= 0;
} }
elsif ( $res ) elsif ( $res )
......
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