summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/include/check-warnings.test15
-rw-r--r--mysql-test/include/mtr_warnings.sql102
-rw-r--r--mysql-test/r/mysql_upgrade.result4
-rw-r--r--mysql-test/r/mysqlcheck.result1
4 files changed, 58 insertions, 64 deletions
diff --git a/mysql-test/include/check-warnings.test b/mysql-test/include/check-warnings.test
index 6dff51d07d8..9fbce4acd3d 100644
--- a/mysql-test/include/check-warnings.test
+++ b/mysql-test/include/check-warnings.test
@@ -5,6 +5,9 @@
#
--disable_query_log
+# Don't write these queries to binlog
+set SQL_LOG_BIN=0;
+
# Turn off any debug crashes, allow the variable to be
# non existent in release builds
--error 0,1193
@@ -14,8 +17,9 @@ use mtr;
create temporary table error_log (
row int auto_increment primary key,
+ suspicious int default 0,
file_name varchar(255),
- line varchar(1024) null
+ line varchar(1024) default null
) engine=myisam;
# Get the name of servers error log
@@ -23,7 +27,8 @@ let $log_error= query_get_value(show variables like 'log_error', Value, 1);
# Try to load the error log into the temporary table
--error 0,1085
-eval load data infile '$log_error' into table error_log (line)
+eval load data infile '$log_error' into table error_log
+ fields terminated by 'xykls37' (line)
set file_name='$log_error';
if ($mysql_errno)
{
@@ -33,7 +38,8 @@ if ($mysql_errno)
# a new error log file that is not world readable.
# chmod the error log file and try to open it again
chmod 0644 $log_error;
- eval load data infile '$log_error' into table error_log (line)
+ eval load data infile '$log_error' into table error_log
+ fields terminated by 'xykls37' (line)
set file_name='$log_error';
# Also load the .err-old file where there might be
@@ -42,7 +48,8 @@ if ($mysql_errno)
# Disabled intil Bug#42320 has been fixed
#let $old_log_error = $log_error-old;
#chmod 0644 $old_log_error;
- #eval load data infile '$old_log_error' into table error_log (line)
+ #eval load data infile '$old_log_error' into table error_log
+ # fields terminated by 'xykls37' (line)
# set file_name='$old_log_error';
}
diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql
index d61f91d4d6f..fce7977df16 100644
--- a/mysql-test/include/mtr_warnings.sql
+++ b/mysql-test/include/mtr_warnings.sql
@@ -3,44 +3,6 @@ delimiter ||;
use mtr||
--
--- Load table with the patterns that are considered
--- as suspicious and should be examined further
---
-CREATE TABLE suspicious_patterns (
- pattern VARCHAR(255)
-) ENGINE=MyISAM||
-
-
---
--- Declare a trigger that makes sure
--- no invalid patterns can be inserted
--- into suspicious_patterns
---
-/*!50002
-CREATE DEFINER=root@localhost TRIGGER sp_insert
-BEFORE INSERT ON suspicious_patterns
-FOR EACH ROW BEGIN
- DECLARE dummy INT;
- SELECT "" REGEXP NEW.pattern INTO dummy;
-END
-*/||
-
-
---
--- Insert patterns for the lines we should check
---
-INSERT INTO suspicious_patterns VALUES
- ("^Warning:|mysqld: Warning|\\[Warning\\]"),
- ("^Error:|\\[ERROR\\]"),
- ("^==.* at 0x"),
- ("InnoDB: Warning"),
- ("^safe_mutex:|allocated at line"),
- ("missing DBUG_RETURN"),
- ("Attempting backtrace"),
- ("Assertion .* failed")||
-
-
---
-- Create table where testcases can insert patterns to
-- be suppressed
--
@@ -232,27 +194,57 @@ BEGIN
WHERE line REGEXP "^CURRENT_TEST:";
DELETE FROM error_log WHERE row < @max_row;
- CREATE TEMPORARY TABLE suspect_lines ENGINE=MyISAM AS
- SELECT DISTINCT el.file_name, el.line, 0 as "suppressed"
- FROM error_log el, suspicious_patterns ep
- WHERE el.line REGEXP ep.pattern;
+ --
+ -- Mark all lines with certain patterns as suspicious
+ --
+ UPDATE error_log SET suspicious= 1
+ WHERE suspicious=0
+ AND line REGEXP "^Warning:|mysqld: Warning|\\[Warning\\]";
+ UPDATE error_log SET suspicious= 1
+ WHERE suspicious=0
+ AND line REGEXP "^Error:|\\[ERROR\\]";
+ UPDATE error_log SET suspicious= 1
+ WHERE suspicious=0
+ AND line REGEXP "^==.* at 0x";
+ UPDATE error_log SET suspicious= 1
+ WHERE suspicious=0
+ AND line REGEXP "InnoDB: Warning";
+ UPDATE error_log SET suspicious= 1
+ WHERE suspicious=0
+ AND line REGEXP "^safe_mutex:|allocated at line";
+ UPDATE error_log SET suspicious= 1
+ WHERE suspicious=0
+ AND line REGEXP "missing DBUG_RETURN";
+ UPDATE error_log SET suspicious= 1
+ WHERE suspicious=0
+ AND line REGEXP "Attempting backtrace";
+ UPDATE error_log SET suspicious= 1
+ WHERE suspicious=0
+ AND line REGEXP "Assertion .* failed";
- -- Mark lines that are suppressed by global suppressions
- UPDATE suspect_lines sl, global_suppressions gs
- SET suppressed=1
- WHERE sl.line REGEXP gs.pattern;
+ --
+ -- Remove mark from lines that are suppressed by global suppressions
+ --
+ UPDATE error_log el, global_suppressions gs
+ SET suspicious=0
+ WHERE el.suspicious=1 AND el.line REGEXP gs.pattern;
- -- Mark lines that are suppressed by test specific suppressions
- UPDATE suspect_lines sl, test_suppressions ts
- SET suppressed=2
- WHERE sl.line REGEXP ts.pattern;
+ --
+ -- Remove mark from lines that are suppressed by test specific suppressions
+ --
+ UPDATE error_log el, test_suppressions ts
+ SET suspicious=0
+ WHERE el.suspicious=1 AND el.line REGEXP ts.pattern;
- SELECT COUNT(*) INTO @num_warnings FROM suspect_lines
- WHERE suppressed=0;
+ --
+ -- Get the number of marked lines and return result
+ --
+ SELECT COUNT(*) INTO @num_warnings FROM error_log
+ WHERE suspicious=1;
IF @num_warnings > 0 THEN
- SELECT file_name, line as log_error
- FROM suspect_lines WHERE suppressed=0;
+ SELECT file_name, line
+ FROM error_log WHERE suspicious=1;
--SELECT * FROM test_suppressions;
-- Return 2 -> check failed
SELECT 2 INTO result;
@@ -263,7 +255,7 @@ BEGIN
-- Cleanup for next test
TRUNCATE test_suppressions;
- DROP TABLE error_log, suspect_lines;
+ DROP TABLE error_log;
END||
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index be14e282f2a..384442f8c31 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -1,6 +1,5 @@
Run mysql_upgrade once
mtr.global_suppressions OK
-mtr.suspicious_patterns OK
mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
@@ -33,7 +32,6 @@ Run it again - should say already completed
This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
Force should run it regardless of wether it's been run before
mtr.global_suppressions OK
-mtr.suspicious_patterns OK
mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
@@ -66,7 +64,6 @@ CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
GRANT ALL ON *.* TO mysqltest1@'%';
Run mysql_upgrade with password protected account
mtr.global_suppressions OK
-mtr.suspicious_patterns OK
mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
@@ -101,7 +98,6 @@ mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errn
FATAL ERROR: Upgrade failed
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
mtr.global_suppressions OK
-mtr.suspicious_patterns OK
mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index b98a800fb36..c25275cb75a 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -2,7 +2,6 @@ DROP TABLE IF EXISTS t1, `t``1`, `t 1`;
drop view if exists v1;
drop database if exists client_test_db;
mtr.global_suppressions OK
-mtr.suspicious_patterns OK
mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK