diff --git a/.bzrignore b/.bzrignore index 01ef6f2ffef..fad758b54b8 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1295,6 +1295,8 @@ mysql-test/linux_sys_vars.inc mysql-test/load_sysvars.inc mysql-test/mtr mysql-test/mysql-test-run +mysql-test/mysql-test-gcov.err +mysql-test/mysql-test-gcov.msg mysql-test/mysql-test-run-shell mysql-test/mysql-test-run.log mysql-test/mysql_test_run_new diff --git a/mysql-test/lib/mtr_gcov.pl b/mysql-test/lib/mtr_gcov.pl index 5049fdd6063..f531889b08d 100644 --- a/mysql-test/lib/mtr_gcov.pl +++ b/mysql-test/lib/mtr_gcov.pl @@ -22,40 +22,46 @@ use strict; sub gcov_prepare ($) { my ($dir)= @_; + print "Purging gcov information from '$dir'...\n"; - `find $dir -name \*.gcov \ - -or -name \*.da | xargs rm`; + system("find $dir -name \*.gcov -o -name \*.da" + . " -o -name \*.gcda | grep -v 'README.gcov\$' | xargs rm"); } -my @mysqld_src_dirs= - ( - "strings", - "mysys", - "include", - "extra", - "regex", - "isam", - "merge", - "myisam", - "myisammrg", - "heap", - "sql", - ); - +# +# Collect gcov statistics. +# Arguments: +# $dir basedir, normally source directory +# $gcov gcov utility program [path] name +# $gcov_msg message file name +# $gcov_err error file name +# sub gcov_collect ($$$) { my ($dir, $gcov, $gcov_msg, $gcov_err)= @_; + # Get current directory to return to later. my $start_dir= cwd(); - print "Collecting source coverage info...\n"; - -f $gcov_msg and unlink($gcov_msg); - -f $gcov_err and unlink($gcov_err); - foreach my $d ( @mysqld_src_dirs ) - { - chdir("$dir/$d"); - foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) ) - { - `$gcov $f 2>>$gcov_err >>$gcov_msg`; + print "Collecting source coverage info using '$gcov'...\n"; + -f "$start_dir/$gcov_msg" and unlink("$start_dir/$gcov_msg"); + -f "$start_dir/$gcov_err" and unlink("$start_dir/$gcov_err"); + + my @dirs= `find "$dir" -type d -print | sort`; + #print "List of directories:\n@dirs\n"; + + foreach my $d ( @dirs ) { + my $dir_reported= 0; + chomp($d); + chdir($d) or next; + + foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) ) { + $f =~ /(.*)\.[ch]c?/; + -f "$1.gcno" or next; + if (!$dir_reported) { + print "Collecting in '$d'...\n"; + $dir_reported= 1; + } + system("$gcov $f 2>>$start_dir/$gcov_err >>$start_dir/$gcov_msg"); } chdir($start_dir); } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 50617428d0f..b0b044b67f4 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -163,8 +163,9 @@ our $opt_force; our $opt_mem= $ENV{'MTR_MEM'}; our $opt_gcov; -our $opt_gcov_err; -our $opt_gcov_msg; +our $opt_gcov_exe= "gcov"; +our $opt_gcov_err= "mysql-test-gcov.msg"; +our $opt_gcov_msg= "mysql-test-gcov.err"; our $glob_debugger= 0; our $opt_gdb; @@ -396,7 +397,7 @@ sub main { mtr_print_line(); if ( $opt_gcov ) { - gcov_collect($basedir, $opt_gcov, + gcov_collect($basedir, $opt_gcov_exe, $opt_gcov_msg, $opt_gcov_err); } @@ -5057,6 +5058,8 @@ Misc options to turn off. sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time + gcov Collect coverage information after the test. + The result is a gcov file per source and header file. HERE exit(1); diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 48f97aeb428..742d4b90807 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1691,3 +1691,15 @@ FROM t1; ERROR 21000: Subquery returns more than 1 row DROP TABLE t1; SET @@sql_mode = @old_sql_mode; +SET @old_sql_mode = @@sql_mode; +SET @@sql_mode='ONLY_FULL_GROUP_BY'; +CREATE TABLE t1(i INT); +INSERT INTO t1 VALUES (1), (10); +SELECT COUNT(i) FROM t1; +COUNT(i) +2 +SELECT COUNT(i) FROM t1 WHERE i > 1; +COUNT(i) +1 +DROP TABLE t1; +SET @@sql_mode = @old_sql_mode; diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index adda0053687..b17884c4f7a 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -2448,3 +2448,18 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,(max(`test`.`t1`.`b`) + 1) AS `max(b)+1` from `test`.`t1` where (`test`.`t1`.`a` = 0) group by `test`.`t1`.`a` drop table t1; +CREATE TABLE t1 (a int, b int, c int, d int, +KEY foo (c,d,a,b), KEY bar (c,a,b,d)); +INSERT INTO t1 VALUES (1, 1, 1, 1), (1, 1, 1, 2), (1, 1, 1, 3), (1, 1, 1, 4); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT a,b,c+1,d FROM t1; +EXPLAIN SELECT DISTINCT c FROM t1 WHERE d=4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL foo 10 NULL 9 Using where; Using index for group-by +SELECT DISTINCT c FROM t1 WHERE d=4; +c +1 +2 +DROP TABLE t1; +End of 5.0 tests diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result index 6152e403637..7ec07fb5273 100644 --- a/mysql-test/r/lock.result +++ b/mysql-test/r/lock.result @@ -166,4 +166,31 @@ ERROR HY000: View's SELECT refers to a temporary table 't2' Cleanup. drop table t2, t3; +# +# Bug#39843 DELETE requires write access to table in subquery in where clause +# +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 ( +table1_rowid SMALLINT NOT NULL +); +CREATE TABLE t2 ( +table2_rowid SMALLINT NOT NULL +); +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +LOCK TABLES t1 WRITE, t2 READ; +# Sub-select should not try to aquire a write lock. +DELETE FROM t1 +WHERE EXISTS +( +SELECT 'x' +FROM t2 +WHERE t1.table1_rowid = t2.table2_rowid +) ; +# While implementing the patch we didn't break old behavior; +# The following sub-select should still requires a write lock: +SELECT * FROM t1 WHERE 1 IN (SELECT * FROM t2 FOR UPDATE); +ERROR HY000: Table 't2' was locked with a READ lock and can't be updated +UNLOCK TABLES; +DROP TABLE t1,t2; End of 5.1 tests. diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index 6f7fcb7efde..704cd7ac3f4 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -149,7 +149,7 @@ SET NAMES DEFAULT; mysqlcheck --default-character-set="latin1" --databases test test.? Error : Table doesn't exist -error : Corrupt +status : Operation failed mysqlcheck --default-character-set="utf8" --databases test test.я OK SET NAMES utf8; diff --git a/mysql-test/r/preload.result b/mysql-test/r/preload.result index 24a6e594a14..7ed0c62f33a 100644 --- a/mysql-test/r/preload.result +++ b/mysql-test/r/preload.result @@ -144,7 +144,7 @@ Key_reads 0 load index into cache t3, t2 key (primary,b) ; Table Op Msg_type Msg_text test.t3 preload_keys Error Table 'test.t3' doesn't exist -test.t3 preload_keys error Corrupt +test.t3 preload_keys status Operation failed test.t2 preload_keys status OK show status like "key_read%"; Variable_name Value @@ -159,7 +159,7 @@ Key_reads 0 load index into cache t3 key (b), t2 key (c) ; Table Op Msg_type Msg_text test.t3 preload_keys Error Table 'test.t3' doesn't exist -test.t3 preload_keys error Corrupt +test.t3 preload_keys status Operation failed test.t2 preload_keys Error Key 'c' doesn't exist in table 't2' test.t2 preload_keys status Operation failed show status like "key_read%"; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index f263ff23088..1f8a077af40 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1396,13 +1396,13 @@ execute stmt; Table Op Msg_type Msg_text test.t1 repair status OK test.t4 repair Error Table 'test.t4' doesn't exist -test.t4 repair error Corrupt +test.t4 repair status Operation failed test.t3 repair status OK execute stmt; Table Op Msg_type Msg_text test.t1 repair status OK test.t4 repair Error Table 'test.t4' doesn't exist -test.t4 repair error Corrupt +test.t4 repair status Operation failed test.t3 repair status OK prepare stmt from "optimize table t1, t3, t4"; execute stmt; @@ -1410,23 +1410,23 @@ Table Op Msg_type Msg_text test.t1 optimize status OK test.t3 optimize status OK test.t4 optimize Error Table 'test.t4' doesn't exist -test.t4 optimize error Corrupt +test.t4 optimize status Operation failed execute stmt; Table Op Msg_type Msg_text test.t1 optimize status Table is already up to date test.t3 optimize status Table is already up to date test.t4 optimize Error Table 'test.t4' doesn't exist -test.t4 optimize error Corrupt +test.t4 optimize status Operation failed prepare stmt from "analyze table t4, t1"; execute stmt; Table Op Msg_type Msg_text test.t4 analyze Error Table 'test.t4' doesn't exist -test.t4 analyze error Corrupt +test.t4 analyze status Operation failed test.t1 analyze status Table is already up to date execute stmt; Table Op Msg_type Msg_text test.t4 analyze Error Table 'test.t4' doesn't exist -test.t4 analyze error Corrupt +test.t4 analyze status Operation failed test.t1 analyze status Table is already up to date deallocate prepare stmt; drop table t1, t2, t3; diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result index 609733b2b02..0cb2dff6f64 100644 --- a/mysql-test/r/repair.result +++ b/mysql-test/r/repair.result @@ -27,7 +27,7 @@ drop table t1; repair table t1 use_frm; Table Op Msg_type Msg_text test.t1 repair Error Table 'test.t1' doesn't exist -test.t1 repair error Corrupt +test.t1 repair status Operation failed create table t1 engine=myisam SELECT 1,"table 1"; flush tables; repair table t1; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index c8ea9d79a13..d707ebaeba5 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -1198,7 +1198,7 @@ CREATE DATABASE mysqltest1; use mysqltest1; CREATE TABLE t1(1 INT); ----> Dumping mysqltest1 to show_check.mysqltest1.sql +---> Dumping mysqltest1 to outfile1 DROP DATABASE mysqltest1; diff --git a/mysql-test/r/skip_name_resolve.result b/mysql-test/r/skip_name_resolve.result index 8ef52e75238..953cbf8a67e 100644 --- a/mysql-test/r/skip_name_resolve.result +++ b/mysql-test/r/skip_name_resolve.result @@ -9,6 +9,3 @@ select user(); user() # show processlist; -Id User Host db Command Time State Info - root test