Skip to content

Commit f4661f3

Browse files
author
msvensson@shellback.(none)
committed
Fix return code from check-warnings to indicate if test failed or not.
No more string matching
1 parent d348362 commit f4661f3

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

mysql-test/include/check-warnings.test

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@
44
# for unexpected warnings found in the servers error log
55
#
66
--disable_query_log
7-
call mtr.check_warnings();
7+
call mtr.check_warnings(@result);
8+
if (`select @result = 0`){
9+
skip OK;
10+
}
11+
echo Found warnings;
812
--enable_query_log

mysql-test/include/mtr_check.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ BEGIN
1919
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA;
2020

2121
-- The test database should not contain any tables
22-
SELECT table_name FROM INFORMATION_SCHEMA.TABLES
22+
SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES
2323
WHERE table_schema='test';
2424

2525
-- Show "mysql" database, tables and columns

mysql-test/include/mtr_warnings.sql

+6-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ INSERT INTO global_supressions VALUES
208208
-- Procedure that uses the above created tables to check
209209
-- the servers error log for warnings
210210
--
211-
CREATE DEFINER=root@localhost PROCEDURE check_warnings()
211+
CREATE DEFINER=root@localhost PROCEDURE check_warnings(OUT result INT)
212212
BEGIN
213213

214214
-- Don't write these queries to binlog
@@ -225,6 +225,7 @@ BEGIN
225225
FROM information_schema.global_variables
226226
WHERE variable_name='LOG_ERROR';
227227

228+
SET @@session.max_allowed_packet= 1024*1024*1024;
228229
SET @text= load_file(@log_error);
229230
-- select @text;
230231

@@ -269,8 +270,11 @@ BEGIN
269270
SELECT line as log_error
270271
FROM suspect_lines WHERE supressed=0;
271272
SELECT * FROM test_supressions;
273+
-- Return 2 -> check failed
274+
SELECT 2 INTO result;
272275
ELSE
273-
SELECT "OK";
276+
-- Return 0 -> OK
277+
SELECT 0 INTO RESULT;
274278
END IF;
275279

276280
-- Cleanup for next test

mysql-test/mysql-test-run.pl

+6-12
Original file line numberDiff line numberDiff line change
@@ -2568,22 +2568,16 @@ ($$)
25682568
if ( $res == 0 )
25692569
{
25702570
my $report= mtr_grab_file($errfile);
2571-
if ($report ne "OK\nOK\n")
2572-
{
2573-
# Log to var/log/warnings file
2574-
mtr_tofile("$opt_vardir/log/warnings",
2571+
# Log to var/log/warnings file
2572+
mtr_tofile("$opt_vardir/log/warnings",
25752573
$tname."\n",
25762574
$report);
25772575

2578-
$res= 1;
2579-
$tinfo->{'warnings'}.= $report;
2580-
2581-
}
2576+
$res= 1;
2577+
$tinfo->{'warnings'}.= $report;
25822578
}
2583-
elsif ( $res == 62 )
2584-
{
2585-
# One of the features needed to run check_warnings.test was not
2586-
# available, check skipped
2579+
elsif ( $res == 62 ) {
2580+
# Test case was ok and called "skip"
25872581
$res= 0;
25882582
}
25892583
elsif ( $res )

0 commit comments

Comments
 (0)