mariadb/mysql-test/suite/percona/percona_log_warnings_suppress.test
Sergei Golubchik 4e46d8e5bf merge with xtradb-5.5.15
fix test cases
2011-07-18 23:04:24 +02:00

47 lines
1.5 KiB
Text

-- source include/have_log_bin.inc
-- source include/have_binlog_format_statement.inc
SET @old_log_warnings = @@log_warnings;
SET @old_log_warnings_suppress = @@log_warnings_suppress;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
SET GLOBAL log_warnings_suppress='';
SET GLOBAL LOG_WARNINGS=0;
SHOW GLOBAL VARIABLES LIKE 'log_warnings_suppress';
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
SET GLOBAL LOG_WARNINGS=1;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
SET GLOBAL log_warnings_suppress='1592';
SET GLOBAL LOG_WARNINGS=0;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
SET GLOBAL LOG_WARNINGS=1;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
DROP TABLE t1;
SET GLOBAL log_warnings = @old_log_warnings;
SET GLOBAL log_warnings_suppress = @old_log_warnings_suppress;
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!`select LENGTH('$log_error_')`)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
}
# Assign env variable LOG_ERROR
let LOG_ERROR=$log_error_;
--echo # Count the number of times the "Unsafe" message was printed
--echo # to the error log.
perl;
use strict;
my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set";
open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
my $count = () = grep(/suppress_1592/g,<FILE>);
print "Occurrences: $count\n";
close(FILE);
EOF