summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/alter_table.test27
-rw-r--r--mysql-test/t/auth_rpl-master.opt2
-rw-r--r--mysql-test/t/auth_rpl-slave.opt4
-rw-r--r--mysql-test/t/auth_rpl.test66
-rw-r--r--mysql-test/t/ctype_errors.test17
-rw-r--r--mysql-test/t/ctype_utf16.test7
-rw-r--r--mysql-test/t/ctype_utf32_uca.test21
-rw-r--r--mysql-test/t/disabled.def4
-rw-r--r--mysql-test/t/error_simulation.test1
-rw-r--r--mysql-test/t/execution_constants.test10
-rw-r--r--mysql-test/t/explain.test10
-rw-r--r--mysql-test/t/flush.test33
-rw-r--r--mysql-test/t/func_math.test22
-rw-r--r--mysql-test/t/func_str.test19
-rw-r--r--mysql-test/t/func_time.test6
-rw-r--r--mysql-test/t/gis.test18
-rw-r--r--mysql-test/t/group_by.test14
-rw-r--r--mysql-test/t/heap.test2
-rw-r--r--mysql-test/t/implicit_commit.test1
-rw-r--r--mysql-test/t/information_schema.test182
-rw-r--r--mysql-test/t/merge.test27
-rw-r--r--mysql-test/t/myisampack.test44
-rw-r--r--mysql-test/t/mysql_embedded.test8
-rw-r--r--mysql-test/t/mysql_plugin-master.opt1
-rw-r--r--mysql-test/t/mysql_plugin.test318
-rw-r--r--mysql-test/t/mysqld--defaults-file.test16
-rw-r--r--mysql-test/t/mysqltest.test124
-rw-r--r--mysql-test/t/order_by.test7
-rw-r--r--mysql-test/t/partition_innodb_plugin.test2
-rw-r--r--mysql-test/t/plugin_auth.test59
-rw-r--r--mysql-test/t/secure_file_priv_win-master.opt1
-rw-r--r--mysql-test/t/secure_file_priv_win.test79
-rw-r--r--mysql-test/t/show_check.test18
-rw-r--r--mysql-test/t/sp-error.test22
-rw-r--r--mysql-test/t/sp-security.test37
-rw-r--r--mysql-test/t/sp.test103
-rw-r--r--mysql-test/t/sp_sync.test29
-rw-r--r--mysql-test/t/sp_trans.test33
-rw-r--r--mysql-test/t/subselect.test33
-rw-r--r--mysql-test/t/type_float.test23
-rw-r--r--mysql-test/t/type_newdecimal.test14
-rw-r--r--mysql-test/t/union.test41
-rw-r--r--mysql-test/t/xml.test9
43 files changed, 1448 insertions, 66 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 15b037a0294..1edee9abf1e 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1100,6 +1100,33 @@ ALTER TABLE t1 DROP COLUMN a, ADD COLUMN c TEXT FIRST;
DROP TABLE t1;
+--echo #
+--echo # Test for bug #12652385 - "61493: REORDERING COLUMNS TO POSITION
+--echo # FIRST CAN CAUSE DATA TO BE CORRUPTED".
+--echo #
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+--echo # Use MyISAM engine as the fact that InnoDB doesn't support
+--echo # in-place ALTER TABLE in cases when columns are being renamed
+--echo # hides some bugs.
+create table t1 (i int, j int) engine=myisam;
+insert into t1 value (1, 2);
+--echo # First, test for original problem described in the bug report.
+select * from t1;
+--echo # Change of column order by the below ALTER TABLE statement should
+--echo # affect both column names and column contents.
+alter table t1 modify column j int first;
+select * from t1;
+--echo # Now test for similar problem with the same root.
+--echo # The below ALTER TABLE should change not only the name but
+--echo # also the value for the last column of the table.
+alter table t1 drop column i, add column k int default 0;
+select * from t1;
+--echo # Clean-up.
+drop table t1;
+
+
--echo End of 5.1 tests
#
diff --git a/mysql-test/t/auth_rpl-master.opt b/mysql-test/t/auth_rpl-master.opt
new file mode 100644
index 00000000000..3536d102387
--- /dev/null
+++ b/mysql-test/t/auth_rpl-master.opt
@@ -0,0 +1,2 @@
+$PLUGIN_AUTH_OPT
+$PLUGIN_AUTH_LOAD
diff --git a/mysql-test/t/auth_rpl-slave.opt b/mysql-test/t/auth_rpl-slave.opt
new file mode 100644
index 00000000000..3f4af6e59bb
--- /dev/null
+++ b/mysql-test/t/auth_rpl-slave.opt
@@ -0,0 +1,4 @@
+--master-retry-count=1
+$PLUGIN_AUTH_OPT
+$PLUGIN_AUTH_LOAD
+
diff --git a/mysql-test/t/auth_rpl.test b/mysql-test/t/auth_rpl.test
new file mode 100644
index 00000000000..c413a84b53c
--- /dev/null
+++ b/mysql-test/t/auth_rpl.test
@@ -0,0 +1,66 @@
+--source include/have_plugin_auth.inc
+--source include/not_embedded.inc
+--source include/master-slave.inc
+
+#
+# Check that replication slave can connect to master using an account
+# which authenticates with an external authentication plugin (bug#12897501).
+
+#
+# First stop the slave to guarantee that nothing is replicated.
+#
+--connection slave
+--echo [connection slave]
+--source include/stop_slave.inc
+#
+# Create an replication account on the master.
+#
+--connection master
+--echo [connection master]
+CREATE USER 'plug_user' IDENTIFIED WITH 'test_plugin_server' AS 'plug_user';
+GRANT REPLICATION SLAVE ON *.* TO plug_user;
+FLUSH PRIVILEGES;
+
+#
+# Now go to slave and change the replication user.
+#
+--connection slave
+--echo [connection slave]
+--let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1)
+CHANGE MASTER TO
+ MASTER_USER= 'plug_user',
+ MASTER_PASSWORD= 'plug_user';
+
+#
+# Start slave with new replication account - this should trigger connection
+# to the master server.
+#
+--source include/start_slave.inc
+
+# Replicate all statements executed on master, in this case,
+# (creation of the plug_user account).
+#
+--connection master
+--sync_slave_with_master
+--echo # Slave in-sync with master now.
+
+SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user';
+
+#
+# Now we can stop the slave and clean up.
+#
+# Note: it is important that slave is stopped at this
+# moment - otherwise master's cleanup statements
+# would be replicated on slave!
+#
+--echo # Cleanup (on slave).
+--source include/stop_slave.inc
+eval CHANGE MASTER TO MASTER_USER='$master_user';
+DROP USER 'plug_user';
+
+--echo # Cleanup (on master).
+--connection master
+DROP USER 'plug_user';
+
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/t/ctype_errors.test b/mysql-test/t/ctype_errors.test
index 3c73fdae264..681223dae64 100644
--- a/mysql-test/t/ctype_errors.test
+++ b/mysql-test/t/ctype_errors.test
@@ -44,4 +44,19 @@ USE nonexistant;
disconnect con1;
connection default;
---echo End of 5.4 tests
+--echo #
+--echo # Bug#12736295: Buffer overflow for variable converted_err
+--echo # with non-latin1 server error message
+--echo #
+
+connect (con1,localhost,root,,test);
+--echo # Connection con1
+SET lc_messages=ru_RU;
+SET NAMES latin1;
+--error ER_PARSE_ERROR
+--query SELECT '01234567890123456789012345678901234\'
+disconnect con1;
+--echo # Connection default
+connection default;
+
+--echo End of 5.5 tests
diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test
index c748e7148bf..d47dc335d5b 100644
--- a/mysql-test/t/ctype_utf16.test
+++ b/mysql-test/t/ctype_utf16.test
@@ -757,6 +757,13 @@ INSERT INTO t1 VALUES ('a');
SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1;
DROP TABLE t1;
+--echo #
+--echo # Bug#12340997
+--echo # DATE_ADD/DATE_SUB WITH INTERVAL CRASHES IN GET_INTERVAL_VALUE()
+--echo #
+
+SELECT space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second));
+
#
## TODO: add tests for all engines
#
diff --git a/mysql-test/t/ctype_utf32_uca.test b/mysql-test/t/ctype_utf32_uca.test
index a62ffbf95c7..1d79fbe1616 100644
--- a/mysql-test/t/ctype_utf32_uca.test
+++ b/mysql-test/t/ctype_utf32_uca.test
@@ -293,6 +293,27 @@ SET collation_connection=utf32_czech_ci;
--source include/ctype_czech.inc
--source include/ctype_like_ignorable.inc
+--echo #
+--echo # Bug #12319710 : INVALID MEMORY READ AND/OR CRASH IN
+--echo # MY_UCA_CHARCMP WITH UTF32
+--echo #
+
+SET collation_connection=utf32_unicode_ci;
+CREATE TABLE t1 (a TEXT CHARACTER SET utf32 COLLATE utf32_turkish_ci NOT NULL);
+INSERT INTO t1 VALUES ('a'), ('b');
+CREATE TABLE t2 (b VARBINARY(5) NOT NULL);
+
+--echo #insert chars outside of BMP
+INSERT INTO t2 VALUEs (0x082837),(0x082837);
+
+--echo #test for read-out-of-bounds with non-BMP chars as a LIKE pattern
+SELECT * FROM t1,t2 WHERE a LIKE b;
+
+--echo #test the original statement
+SELECT 1 FROM t1 AS t1_0 NATURAL LEFT OUTER JOIN t2 AS t2_0
+RIGHT JOIN t1 AS t1_1 ON t1_0.a LIKE t2_0.b;
+
+DROP TABLE t1,t2;
--echo #
--echo # End of 5.5 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 45b785e6a80..ce9f57b130f 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -9,6 +9,7 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
+tablespace : disabled in MariaDB (no TABLESPACE table attribute)
events_time_zone : Test is not predictable as it depends on precise timing.
lowercase_table3 : Bug#11762269 2010-06-30 alik main.lowercase_table3 on Mac OSX
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
@@ -17,5 +18,4 @@ alter_table-big : Bug#11748731 2010-11-15 mattiasj was not tested
create-big : Bug#11748731 2010-11-15 mattiasj was not tested
archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
-mysql_embedded : Bug#12561297 2011-06-15 New test failing on all platforms
-tablespace : disabled in MariaDB (no TABLESPACE table attribute)
+mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836
diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test
index f6edacfaa29..a60eccad3d8 100644
--- a/mysql-test/t/error_simulation.test
+++ b/mysql-test/t/error_simulation.test
@@ -89,6 +89,7 @@ SET SESSION debug = DEFAULT;
DROP TABLE t1, t2;
+
--echo #
--echo # End of 5.1 tests
--echo #
diff --git a/mysql-test/t/execution_constants.test b/mysql-test/t/execution_constants.test
index 92b1deb9921..285197cd1f4 100644
--- a/mysql-test/t/execution_constants.test
+++ b/mysql-test/t/execution_constants.test
@@ -38,7 +38,7 @@ while ($i)
{
# If we SEGV because the min stack size is exceeded, this would return error
# 2013 .
- error 0,1436 //
+ error 0,ER_STACK_OVERRUN_NEED_MORE //
eval $query_head 0 $query_tail//
if ($mysql_errno)
@@ -48,10 +48,10 @@ while ($i)
# limit, we still have enough space reserved to report an error.
let $i = 1//
- # Check that mysql_errno is 1436
- if ($mysql_errno != 1436)
+ # Check that mysql_errname is ER_STACK_OVERRUN_NEED_MORE
+ if ($mysql_errname != ER_STACK_OVERRUN_NEED_MORE)
{
- die Wrong error triggered, expected 1436 but got $mysql_errno//
+ die Wrong error triggered, expected ER_STACK_OVERRUN_NEED_MORE but got $mysql_errname//
}
}
@@ -76,7 +76,7 @@ while ($i)
enable_result_log//
enable_query_log//
-echo Assertion: mysql_errno 1436 == $mysql_errno//
+echo Assertion: mysql_errname ER_STACK_OVERRUN_NEED_MORE == $mysql_errname//
delimiter ;//
DROP TABLE `t_bug21476`;
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index 2fb0fb8fac7..8620a43cea5 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -157,14 +157,12 @@ CREATE TABLE t1 (f1 INT);
SELECT @@session.sql_mode INTO @old_sql_mode;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
-# EXPLAIN EXTENDED (with subselect). used to crash. should give NOTICE.
-# Before moving max/min optimization to optimize phase this statement
-# generated error, but as far as original query do not contain aggregate
-# function user should not see error
-# --error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
+# EXPLAIN EXTENDED (with subselect). used to crash.
+# This is actually a valid query for this sql_mode,
+# but it was transformed in such a way that it failed, see
+# Bug#12329653 - EXPLAIN, UNION, PREPARED STATEMENT, CRASH, SQL_FULL_GROUP_BY
EXPLAIN EXTENDED SELECT 1 FROM t1
WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
-SHOW WARNINGS;
SET SESSION sql_mode=@old_sql_mode;
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index de23cf02c38..037e2fcaa73 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -668,3 +668,36 @@ ALTER TABLE t1 COMMENT 'test';
UNLOCK TABLES;
DROP TABLE t1;
+
+
+--echo #
+--echo # Test for bug #12641342 - "61401: UPDATE PERFORMANCE DEGRADES
+--echo # GRADUALLY IF A TRIGGER EXISTS".
+--echo #
+--echo # One of side-effects of this bug was that a transaction which
+--echo # involved DML statements requiring prelocking blocked concurrent
+--echo # FLUSH TABLES WITH READ LOCK for the whole its duration, while
+--echo # correct behavior in this case is to block FTWRL only for duration
+--echo # of individual DML statements.
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (id INT PRIMARY KEY, value INT);
+INSERT INTO t1 VALUES (1, 1);
+CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW SET @var = "a";
+BEGIN;
+UPDATE t1 SET value= value + 1 WHERE id = 1;
+
+--echo # Switching to connection 'con1'.
+connect(con1, localhost, root);
+--echo # The below FLUSH TABLES WITH READ LOCK should succeed and
+--echo # should not be blocked by the transaction in default connection.
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Switching to connection 'default'.
+connection default;
+COMMIT;
+DROP TABLE t1;
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 0d59f98a313..a1df990fa8e 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -536,3 +536,25 @@ SELECT 1 div null;
--echo # Bug #11792200 - DIVIDING LARGE NUMBERS CAUSES STACK CORRUPTIONS
--echo #
select (1.175494351E-37 div 1.7976931348623157E+308);
+
+--echo #
+--echo # Bug#12537160 ASSERTION FAILED:
+--echo # STOP0 <= &TO->BUF[TO->LEN] WITH LARGE NUMBER.
+--echo #
+
+let $nine_81=
+999999999999999999999999999999999999999999999999999999999999999999999999999999999;
+
+eval select $nine_81 % 0.1 as foo;
+eval select $nine_81 % 0.0 as foo;
+
+--echo #
+--echo # Bug#12711164 - 61676:
+--echo # RESULT OF DIV WITH DECIMAL AND INTEGER DOES NOT MAKE SENSE
+--echo #
+
+select 5 div 2;
+select 5.0 div 2.0;
+select 5.0 div 2;
+select 5 div 2.0;
+select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2;
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 9a9a8110a74..bb22366a98d 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1437,5 +1437,24 @@ SELECT * FROM t1;
DROP TABLE t1;
--echo #
+--echo # Bug#12985030 SIMPLE QUERY WITH DECIMAL NUMBERS LEAKS MEMORY
+--echo #
+
+SELECT (rpad(1.0,2048,1)) IS NOT FALSE;
+SELECT ((+0) IN
+((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)),
+(32767.1)));
+SELECT ((rpad(1.0,2048,1)) = ('4(') ^ (0.1));
+
+--error 1690
+SELECT
+pow((rpad(10.0,2048,1)),(b'1111111111111111111111111111111111111111111'));
+SELECT ((rpad(1.0,2048,1)) + (0) ^ ('../'));
+SELECT stddev_samp(rpad(1.0,2048,1));
+SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)));
+SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc));
+
+
+--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index cdac95523e5..e3c7cf8281f 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -919,6 +919,12 @@ SELECT DATE_FORMAT('0000-00-11', '%w');
SELECT MAKEDATE(11111111,1);
SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
+--echo #
+--echo # Bug#12584302 AFTER FIX FOR #12403504: ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0,
+--echo #
+
+DO WEEK((DATE_ADD((CAST(0 AS DATE)), INTERVAL 1 YEAR_MONTH)), 5);
+
--echo End of 5.1 tests
--echo #
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index 2a800140d1f..104afddeee5 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -820,5 +820,23 @@ CREATE TABLE t3 (
# cleanup
DROP TABLE t0, t1, t2;
+--echo #
+--echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
+--echo #
+
+CREATE TABLE g1
+(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=myisam;
+
+INSERT INTO g1 VALUES (geomfromtext('point(1 1)'));
+INSERT INTO g1 VALUES (geomfromtext('point(1 2)'));
+
+FLUSH TABLES;
+
+SELECT 1 FROM g1
+FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month)
+;
+
+DROP TABLE g1;
+
--echo End of 5.5 tests
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index f739870ca07..85147e28cf9 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1297,6 +1297,20 @@ FROM t1 GROUP BY a;
DROP TABLE t1;
+--echo #
+--echo # Bug#11765254 (58200): Assertion failed: param.sort_length when grouping
+--echo # by functions
+--echo #
+
+SET SQL_BIG_TABLES=1;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0),(0);
+SELECT 1 FROM t1 GROUP BY IF(`a`,'','');
+SELECT 1 FROM t1 GROUP BY TRIM(LEADING RAND() FROM '');
+SELECT 1 FROM t1 GROUP BY SUBSTRING('',SLEEP(0),'');
+SELECT 1 FROM t1 GROUP BY SUBSTRING(SYSDATE() FROM 'K' FOR 'jxW<');
+DROP TABLE t1;
+SET SQL_BIG_TABLES=0;
--echo # End of 5.1 tests
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index e5700eaeeb8..7d56425799a 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -459,7 +459,7 @@ drop table t1;
#
create table t1 (c char(10)) engine=memory;
create table t2 (c varchar(10)) engine=memory;
---replace_column 8 #
+--replace_column 8 # 12 #
show table status like 't_';
drop table t1, t2;
diff --git a/mysql-test/t/implicit_commit.test b/mysql-test/t/implicit_commit.test
index b10788bd891..59f8dc3a44c 100644
--- a/mysql-test/t/implicit_commit.test
+++ b/mysql-test/t/implicit_commit.test
@@ -1,5 +1,6 @@
source include/have_innodb.inc;
source include/not_embedded.inc;
+source include/have_profiling.inc;
SET GLOBAL EVENT_SCHEDULER = OFF;
SET BINLOG_FORMAT = STATEMENT;
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 4a43969a057..5b5e2137d0e 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1540,8 +1540,6 @@ DROP TABLE t1, information_schema.tables;
LOCK TABLES t1 READ, information_schema.tables READ;
DROP TABLE t1;
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
#
# Bug #43834 Assertion in Natural_join_column::db_name() on an I_S query
@@ -1606,5 +1604,185 @@ drop view v1;
--echo #
+--echo # Test for bug #12828477 - "MDL SUBSYSTEM CREATES BIG OVERHEAD FOR
+--echo # CERTAIN QUERIES TO INFORMATION_SCHEMA".
+--echo #
+--echo # Check that metadata locks which are acquired during the process
+--echo # of opening tables/.FRMs/.TRG files while filling I_S table are
+--echo # not kept to the end of statement. Keeping the locks has caused
+--echo # performance problems in cases when big number of tables (.FRMs
+--echo # or .TRG files) were scanned as cost of new lock acquisition has
+--echo # increased linearly.
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+create database mysqltest;
+use mysqltest;
+create table t0 (i int);
+create table t1 (j int);
+create table t2 (k int);
+
+--echo #
+--echo # Test that we don't keep locks in case when we to fill
+--echo # I_S table we perform full-blown table open.
+--echo #
+
+--echo # Acquire lock on 't2' so upcoming RENAME is
+--echo # blocked.
+lock tables t2 read;
+
+--echo #
+--echo # Switching to connection 'con12828477_1'.
+--echo #
+connect (con12828477_1, localhost, root,,mysqltest);
+--echo # The below RENAME should wait on 't2' while
+--echo # keeping X lock on 't1'.
+--send rename table t1 to t3, t2 to t1, t3 to t2
+
+--echo #
+--echo # Switching to connection 'con12828477_2'.
+--echo #
+connect (con12828477_2, localhost, root,,mysqltest);
+--echo # Wait while the above RENAME is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t3, t2 to t1, t3 to t2";
+--source include/wait_condition.inc
+
+--echo # Issue query to I_S which will open 't0' and get
+--echo # blocked on 't1' because of RENAME.
+--send select table_name, auto_increment from information_schema.tables where table_schema='mysqltest'
+
+--echo #
+--echo # Switching to connection 'con12828477_3'.
+--echo #
+connect (con12828477_3, localhost, root,,mysqltest);
+--echo # Wait while the above SELECT is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "select table_name, auto_increment from information_schema.tables where table_schema='mysqltest'";
+--source include/wait_condition.inc
+
+--echo #
+--echo # Check that it holds no lock on 't0' so it can be renamed.
+rename table t0 to t4;
+
+--echo #
+--echo # Switching to connection 'default'.
+--echo #
+connection default;
+--echo #
+--echo # Unblock the first RENAME.
+unlock tables;
+
+--echo #
+--echo # Switching to connection 'con12828477_1'.
+--echo #
+connection con12828477_1;
+--echo # Reap the first RENAME
+--reap
+
+--echo #
+--echo # Switching to connection 'con12828477_2'.
+--echo #
+connection con12828477_2;
+--echo # Reap SELECT to I_S.
+--reap
+
+--echo #
+--echo # Switching to connection 'default'.
+--echo #
+connection default;
+
+--echo #
+--echo # Now test that we don't keep locks in case when we to fill
+--echo # I_S table we read .FRM or .TRG file only (this was the case
+--echo # for which problem existed).
+--echo #
+
+rename table t4 to t0;
+--echo # Acquire lock on 't2' so upcoming RENAME is
+--echo # blocked.
+lock tables t2 read;
+
+--echo #
+--echo # Switching to connection 'con12828477_1'.
+--echo #
+connection con12828477_1;
+--echo # The below RENAME should wait on 't2' while
+--echo # keeping X lock on 't1'.
+--send rename table t1 to t3, t2 to t1, t3 to t2
+
+--echo #
+--echo # Switching to connection 'con12828477_2'.
+--echo #
+connection con12828477_2;
+--echo # Wait while the above RENAME is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "rename table t1 to t3, t2 to t1, t3 to t2";
+--source include/wait_condition.inc
+
+--echo # Issue query to I_S which will open 't0' and get
+--echo # blocked on 't1' because of RENAME.
+--send select event_object_table, trigger_name from information_schema.triggers where event_object_schema='mysqltest'
+
+--echo #
+--echo # Switching to connection 'con12828477_3'.
+--echo #
+connection con12828477_3;
+--echo # Wait while the above SELECT is blocked.
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "select event_object_table, trigger_name from information_schema.triggers where event_object_schema='mysqltest'";
+--source include/wait_condition.inc
+
+--echo #
+--echo # Check that it holds no lock on 't0' so it can be renamed.
+rename table t0 to t4;
+
+--echo #
+--echo # Switching to connection 'default'.
+--echo #
+connection default;
+--echo #
+--echo # Unblock the first RENAME.
+unlock tables;
+
+--echo #
+--echo # Switching to connection 'con12828477_1'.
+--echo #
+connection con12828477_1;
+--echo # Reap the first RENAME
+--reap
+
+--echo #
+--echo # Switching to connection 'con12828477_2'.
+--echo #
+connection con12828477_2;
+--echo # Reap SELECT to I_S.
+--reap
+
+--echo #
+--echo # Switching to connection 'default'.
+--echo #
+connection default;
+disconnect con12828477_1;
+disconnect con12828477_2;
+disconnect con12828477_3;
+
+--echo #
+--echo # Clean-up.
+drop database mysqltest;
+
+
+--echo #
--echo # End of 5.5 tests
--echo #
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index ca2f5ebb4d7..4066fcb264b 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -2809,7 +2809,32 @@ UNLOCK TABLES;
DROP TABLE m1, t1;
---echo End of 6.0 tests
+--echo #
+--echo # Test for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL
+--echo # PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1"
+--echo #
+--disable_warnings
+drop tables if exists t1, t2, t3, t4, m1;
+--enable_warnings
+create table t1(id int) engine=myisam;
+create view t3 as select 1 as id;
+create table t4(id int) engine=memory;
+create table m1(id int) engine=merge union=(t1,t2,t3,t4);
+--error ER_WRONG_MRG_TABLE
+select * from m1;
+--echo # The below CHECK and REPAIR TABLE statements should
+--echo # report all problems with underlying tables:
+--echo # - absence of 't2',
+--echo # - missing base table for 't3',
+--echo # - wrong engine of 't4'.
+check table m1;
+repair table m1;
+--echo # Clean-up.
+drop tables m1, t1, t4;
+drop view t3;
+
+
+--echo End of 5.5 tests
--disable_result_log
--disable_query_log
diff --git a/mysql-test/t/myisampack.test b/mysql-test/t/myisampack.test
index 190ee8d8fd2..afa417822e6 100644
--- a/mysql-test/t/myisampack.test
+++ b/mysql-test/t/myisampack.test
@@ -223,3 +223,47 @@ DROP TABLE t1,t2,t3;
DROP TABLE mysql_db1.t1;
DROP DATABASE mysql_db1;
+--echo #
+--echo # BUG#11761180 - 53646: MYISAMPACK CORRUPTS TABLES WITH FULLTEXT INDEXES
+--echo #
+CREATE TABLE t1(a CHAR(4), FULLTEXT(a));
+INSERT INTO t1 VALUES('aaaa'),('bbbb'),('cccc');
+FLUSH TABLE t1;
+--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
+--exec $MYISAMCHK -srq $MYSQLD_DATADIR/test/t1
+CHECK TABLE t1;
+SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa');
+DROP TABLE t1;
+
+--echo # Test table with key_reflength > rec_reflength
+CREATE TABLE t1(a CHAR(30), FULLTEXT(a));
+--disable_query_log
+--echo # Populating a table, so it's index file exceeds 65K
+let $1=1700;
+while ($1)
+{
+ eval INSERT INTO t1 VALUES('$1aaaaaaaaaaaaaaaaaaaaaaaaaa');
+ dec $1;
+}
+
+--echo # Populating a table, so index file has second level fulltext tree
+let $1=60;
+while ($1)
+{
+ eval INSERT INTO t1 VALUES('aaaa'),('aaaa'),('aaaa'),('aaaa'),('aaaa');
+ dec $1;
+}
+--enable_query_log
+
+FLUSH TABLE t1;
+--echo # Compressing table
+--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
+--echo # Fixing index (repair by sort)
+--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
+CHECK TABLE t1;
+FLUSH TABLE t1;
+--echo # Fixing index (repair with keycache)
+--exec $MYISAMCHK -soq $MYSQLD_DATADIR/test/t1
+CHECK TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/mysql_embedded.test b/mysql-test/t/mysql_embedded.test
index b4c8c6be05f..30959b83017 100644
--- a/mysql-test/t/mysql_embedded.test
+++ b/mysql-test/t/mysql_embedded.test
@@ -3,4 +3,10 @@
--echo #
--source include/is_embedded.inc
---exec $MYSQL_TEST_DIR/../libmysqld/examples/mysql_embedded -e 'select 1'
+
+# Test case require mysql_embedded to be present
+if(!$MYSQL_EMBEDDED)
+{
+ --skip Test requires mysql_embedded executable
+}
+--exec $MYSQL_EMBEDDED -e 'select 1'
diff --git a/mysql-test/t/mysql_plugin-master.opt b/mysql-test/t/mysql_plugin-master.opt
new file mode 100644
index 00000000000..061ca907902
--- /dev/null
+++ b/mysql-test/t/mysql_plugin-master.opt
@@ -0,0 +1 @@
+--plugin-dir=$DAEMONEXAMPLE_DIR
diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test
new file mode 100644
index 00000000000..b7fbe377e31
--- /dev/null
+++ b/mysql-test/t/mysql_plugin.test
@@ -0,0 +1,318 @@
+#
+# Test mysql_plugin tool
+#
+# This test contains test cases for testing the mysql_plugin client with
+# the daemon_example plugin. Test cases include tests for:
+#
+# - successful enable/disable
+# - incorrect paths
+# - missing paths/options
+#
+# Implementation Notes
+#
+# The mysql_plugin tool now accepts --mysqld the path to mysqld server. The
+# mysqld path is extracted from MYSQLD_BOOTSTRAP_CMD line. We also extract
+# the path of MYSQLD_BASEDIR (where mysql exists) and use it for the errmsg
+# file. The directories differ between Windows and Unix but the Perl script
+# included below will pick as per platform.
+#
+# The test is also designed to issue the --skip directive if the location of
+# the mysqld, my_print_defaults, or daemon_example.ini files cannot be found.
+#
+
+--source include/not_embedded.inc
+
+# Add the datadir, basedir, plugin_dir to the bootstrap command
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $MYSQL_BASEDIR= `select @@basedir`;
+let $MYSQL_ERRMSG_BASEDIR=`select @@lc_messages_dir`;
+let $PLUGIN_DIR=`select @@plugin_dir`;
+
+--disable_abort_on_error
+
+# Perl script to extract the location of the basedir from environment
+# variables. This is needed to ensure the test will run on the PB machines
+# designed to test release as well as debug builds. It also checks for the
+# location of the my_print_defaults and daemon_example.ini files.
+
+perl;
+use File::Basename;
+ my ($mysqld)= split " ", $ENV{MYSQLD_BOOTSTRAP_CMD};
+ my $mysqld_basedir=dirname($mysqld);
+ my $my_print_defaults= $ENV{MYSQL_MY_PRINT_DEFAULTS};
+ my $my_print_defaults_basedir=dirname($my_print_defaults);
+ my $daemonexample_ini= "$ENV{DAEMONEXAMPLE_DIR}/daemon_example.ini";
+ my $plugindir_ini= "$ENV{PLUGIN_DIR}/daemon_example.ini";
+ my $notfound= "";
+ open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mysqld.inc") or die;
+ print FILE "let \$MYSQLD_BASEDIR= $mysqld_basedir;\n";
+ print FILE "let \$MYSQL_MY_PRINT_DEFAULTS_BASEDIR= $my_print_defaults_basedir;\n";
+ if ((!-e $daemonexample_ini) || (!-r $daemonexample_ini))
+ {
+ print FILE "let \$DAEMONEXAMPLE_DIR= $not_found;\n";
+ }
+ if ((!-e $plugindir_ini) || (!-r $plugindir_ini))
+ {
+ print FILE "let \$PLUGIN_DIR= $not_found;\n";
+ }
+ close FILE;
+EOF
+
+
+source $MYSQL_TMP_DIR/mysqld.inc;
+remove_file $MYSQL_TMP_DIR/mysqld.inc;
+
+# The mysql_plugin tool expects a directory structure like in the installed
+# mysql version, so errmsg.sys will be copied to "basedir/share", we create
+# and remove this structure.
+
+--mkdir $MYSQLD_BASEDIR/share
+--mkdir $MYSQLD_BASEDIR/share/mysql
+--copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_BASEDIR/share/errmsg.sys
+--copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_BASEDIR/share/mysql/errmsg.sys
+
+# The mysql_plugin tool now accepts --my-print-defaults which points to the
+# executable my_print_defaults.exe we can get this path from the variable
+# $MYSQL_MY_PRINT_DEFAULTS.
+
+# Check for my_print_defaults location. Skip if not found.
+if ($MYSQL_MY_PRINT_DEFAULTS_BASEDIR == '')
+{
+ --skip Test requires known location of my_print_defaults executable.
+}
+
+# Check for mysqld location. Skip if not found.
+if ($MYSQLD == '')
+{
+ --skip Test requires known location of mysqld executable.
+}
+
+# Check for daemon_example.ini location. Skip if not found in either
+# the plugin_dir path or the daemon_example_dir path.
+if ($PLUGIN_DIR == '')
+{
+ if ($DAEMONEXAMPLE_DIR == '')
+ {
+ --skip Test requires known location of daemon_example.ini file.
+ }
+ let $PLUGIN_DIR = $DAEMONEXAMPLE_DIR;
+}
+
+# Build client command for reuse.
+
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+
+--echo #
+--echo # Ensure the plugin isn't loaded.
+--echo #
+SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name;
+
+--echo #
+--echo # Enable the plugin...
+--echo #
+let $expect_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
+# MTR will remove this file later, but this might be too late.
+--error 0,1
+--remove_file $expect_file
+--write_file $expect_file
+wait
+EOF
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+
+#
+# Enable the plugin
+#
+--exec $MYSQL_PLUGIN_CMD ENABLE daemon_example
+
+#
+# Ensure enabling an enabled plugin doesn't fail
+--exec $MYSQL_PLUGIN_CMD ENABLE daemon_example
+
+#
+# Restart the server
+#
+--append_file $expect_file
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--echo #
+--echo # Ensure the plugin is now loaded.
+--echo #
+--replace_regex /\.dll/.so/
+SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name;
+
+--echo #
+--echo # Disable the plugin...
+--echo #
+# MTR will remove this file later, but this might be too late.
+--error 0,1
+--remove_file $expect_file
+--write_file $expect_file
+wait
+EOF
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+
+#
+# Disable the plugin
+#
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example
+
+#
+# Restart the server
+#
+--append_file $expect_file
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--echo #
+--echo # Ensure the plugin isn't loaded.
+--echo #
+SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name;
+
+#
+# Stop the server for error conditions
+#
+let $expect_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
+# MTR will remove this file later, but this might be too late.
+--error 0,1
+--remove_file $expect_file
+--write_file $expect_file
+wait
+EOF
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+
+--echo #
+--echo # Attempt to load non-existant plugin
+--echo #
+--error 1,2,256
+--exec $MYSQL_PLUGIN_CMD DISABLE NOT_THERE_AT_ALL 2>&1
+
+--echo #
+--echo # Attempt to use non-existant plugin.ini file
+--echo #
+--error 1,2,7,256
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example --plugin-ini=/NOT/THERE/pi.ini 2>&1
+
+--echo #
+--echo # Attempt to omit the plugin
+--echo #
+--error 1,2,256
+--exec $MYSQL_PLUGIN_CMD DISABLE 2>&1
+
+--echo #
+--echo # Attempt to omit DISABLE|ENABLE
+--echo #
+--error 1,2,256
+--exec $MYSQL_PLUGIN_CMD daemon_example 2>&1
+
+--echo #
+--echo # Attempt to use bad paths - datadir
+--echo #
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=/data_not_there/ --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+--error 1,2,256
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1
+
+--echo #
+--echo # Attempt to use bad paths - basedir
+--echo #
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=/basedir_not_there/ --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+replace_result "/basedir_not_there//" "/basedir_not_there/";
+--error 1,2,256
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1
+
+--echo #
+--echo # Attempt to use bad paths - plugin_dir
+--echo #
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=/plugin_not_there/ --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+--error 1,2,256
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1
+
+--echo #
+--echo # Attempt to use bad paths - mysqld
+--echo #
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=/mysqld_not_there/ --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+--error 1,2,256
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1
+
+--echo #
+--echo # Attempt to use bad paths - my_print_defaults
+--echo #
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=/my_print_defaults_not_there/;
+--error 1,2,256
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1
+
+
+--echo #
+--echo # Missing library
+--echo #
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_soname.ini --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+--error 1,2,256
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1
+
+--echo #
+--echo # Bad format for config file
+--echo #
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_format.ini --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+--error 1,2,256
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1
+
+--echo #
+--echo # Missing base_dir option
+--echo #
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+--error 1,2,139,256
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1
+
+--echo #
+--echo # Missing data_dir option
+--echo #
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+--error 1,2,139,256
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1
+
+--echo #
+--echo # Missing plugin_dir option
+--echo #
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQL_DATADIR --basedir=$MYSQL_BASEDIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+--error 1,2,139,256
+--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1
+
+--echo #
+--echo # Show the help.
+--echo #
+replace_result $MYSQL_PLUGIN mysql_plugin;
+--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/
+--exec $MYSQL_PLUGIN --help
+
+replace_result $MYSQL_PLUGIN mysql_plugin;
+--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/
+--exec $MYSQL_PLUGIN --version
+
+#
+# Restart the server
+#
+--append_file $expect_file
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+#
+# Cleanup
+# MTR will remove this file later, but this might be too late.
+--error 0,1
+--remove_file $expect_file
+
+# Cleanup the share folder in the binary path.
+--remove_file $MYSQLD_BASEDIR/share/errmsg.sys
+--rmdir $MYSQLD_BASEDIR/share/mysql
+--rmdir $MYSQLD_BASEDIR/share
+
+--enable_abort_on_error
diff --git a/mysql-test/t/mysqld--defaults-file.test b/mysql-test/t/mysqld--defaults-file.test
index 065436c38aa..3bfe0aa891f 100644
--- a/mysql-test/t/mysqld--defaults-file.test
+++ b/mysql-test/t/mysqld--defaults-file.test
@@ -5,21 +5,6 @@
source include/not_embedded.inc;
source include/not_windows.inc;
-# We need to use a plain "mysqld" without any other options to trigger
-# the bug. In particular, it seems that passing --bootstrap does not
-# trigger the bug. To do that, we extract the "command name" from the
-# MYSQLD_BOOTSTRAP_CMD variable and store that in a file, which we
-# then load into the test case.
-
-perl;
- my ($mysqld)= split " ", $ENV{MYSQLD_BOOTSTRAP_CMD};
- open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mysqld.inc") or die;
- print FILE "let \$MYSQLD= $mysqld;\n";
- close FILE;
-EOF
-
-source $MYSQL_TMP_DIR/mysqld.inc;
-
# All these tests refer to configuration files that do not exist
--error 1
@@ -44,4 +29,3 @@ exec $MYSQLD --defaults-file=with.ext --print-defaults 2>&1;
--error 1
exec $MYSQLD --defaults-file=no_extension --print-defaults 2>&1;
-remove_file $MYSQL_TMP_DIR/mysqld.inc;
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 6f12c6d4d11..ab55fd30bf5 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -1,3 +1,14 @@
+# ----------------------------------------------------------------------------
+# $mysql_errno contains the return code of the last command
+# sent to the server.
+# ----------------------------------------------------------------------------
+# get $mysql_errno before the first statement
+# $mysql_errno should be -1
+# get $mysql_errname as well
+
+echo $mysql_errno before test;
+echo $mysql_errname before test;
+
-- source include/have_log_bin.inc
# This test should work in embedded server after mysqltest is fixed
@@ -42,15 +53,6 @@ SET GLOBAL max_connections = 1000;
# ============================================================================
# ----------------------------------------------------------------------------
-# $mysql_errno contains the return code of the last command
-# sent to the server.
-# ----------------------------------------------------------------------------
-# get $mysql_errno before the first statement
-# $mysql_errno should be -1
-eval select $mysql_errno as "before_use_test" ;
-
-
-# ----------------------------------------------------------------------------
# Positive case(statement)
# ----------------------------------------------------------------------------
@@ -142,6 +144,7 @@ select friedrich from (select 1 as otto) as t1;
# check mysql_errno = 0 after successful statement
# ----------------------------------------------------------------------------
select otto from (select 1 as otto) as t1;
+echo $mysql_errname;
eval select $mysql_errno as "after_successful_stmt_errno" ;
#----------------------------------------------------------------------------
@@ -150,6 +153,7 @@ eval select $mysql_errno as "after_successful_stmt_errno" ;
--error ER_PARSE_ERROR
garbage ;
+echo $mysql_errname;
eval select $mysql_errno as "after_wrong_syntax_errno" ;
# ----------------------------------------------------------------------------
@@ -159,6 +163,7 @@ eval select $mysql_errno as "after_wrong_syntax_errno" ;
garbage ;
let $my_var= 'abc' ;
+echo $mysql_errname;
eval select $mysql_errno as "after_let_var_equal_value" ;
# ----------------------------------------------------------------------------
@@ -168,6 +173,7 @@ eval select $mysql_errno as "after_let_var_equal_value" ;
garbage ;
set @my_var= 'abc' ;
+echo $mysql_errname;
eval select $mysql_errno as "after_set_var_equal_value" ;
# ----------------------------------------------------------------------------
@@ -178,6 +184,7 @@ eval select $mysql_errno as "after_set_var_equal_value" ;
garbage ;
--disable_warnings
+echo $mysql_errname;
eval select $mysql_errno as "after_disable_warnings_command" ;
# ----------------------------------------------------------------------------
@@ -190,6 +197,7 @@ drop table if exists t1 ;
garbage ;
drop table if exists t1 ;
+echo $mysql_errname;
eval select $mysql_errno as "after_disable_warnings" ;
--enable_warnings
@@ -202,6 +210,7 @@ garbage ;
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
+echo $mysql_errname;
eval select $mysql_errno as "after_minus_masked" ;
--error ER_PARSE_ERROR
@@ -209,6 +218,7 @@ garbage ;
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
+echo $mysql_errname;
eval select $mysql_errno as "after_!_masked" ;
# ----------------------------------------------------------------------------
@@ -230,6 +240,7 @@ garbage ;
--error ER_NO_SUCH_TABLE
prepare stmt from "select 3 from t1" ;
+echo $mysql_errname;
eval select $mysql_errno as "after_failing_prepare" ;
create table t1 ( f1 char(10));
@@ -238,6 +249,7 @@ create table t1 ( f1 char(10));
garbage ;
prepare stmt from "select 3 from t1" ;
+echo $mysql_errname;
eval select $mysql_errno as "after_successful_prepare" ;
# successful execute
@@ -245,6 +257,7 @@ eval select $mysql_errno as "after_successful_prepare" ;
garbage ;
execute stmt;
+echo $mysql_errname;
eval select $mysql_errno as "after_successful_execute" ;
# failing execute (table has been dropped)
@@ -255,6 +268,7 @@ garbage ;
--error ER_NO_SUCH_TABLE
execute stmt;
+echo $mysql_errname;
eval select $mysql_errno as "after_failing_execute" ;
# failing execute (unknown statement)
@@ -264,6 +278,7 @@ garbage ;
--error ER_UNKNOWN_STMT_HANDLER
execute __stmt_;
+echo $mysql_errname;
eval select $mysql_errno as "after_failing_execute" ;
# successful deallocate
@@ -271,6 +286,7 @@ eval select $mysql_errno as "after_failing_execute" ;
garbage ;
deallocate prepare stmt;
+echo $mysql_errname;
eval select $mysql_errno as "after_successful_deallocate" ;
# failing deallocate ( statement handle does not exist )
@@ -280,6 +296,7 @@ garbage ;
--error ER_UNKNOWN_STMT_HANDLER
deallocate prepare __stmt_;
+echo $mysql_errname;
eval select $mysql_errno as "after_failing_deallocate" ;
@@ -307,6 +324,7 @@ eval select $mysql_errno as "after_failing_deallocate" ;
garbage ;
--disable_abort_on_error
+echo $mysql_errname;
eval select $mysql_errno as "after_--disable_abort_on_error" ;
# ----------------------------------------------------------------------------
@@ -324,6 +342,7 @@ select 3 from t1 ;
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
+echo $mysql_errname;
eval select $mysql_errno as "after_!errno_masked_error" ;
# expected error <> response
# --error 1000
@@ -343,12 +362,21 @@ eval select $mysql_errno as "after_!errno_masked_error" ;
EOF
# ----------------------------------------------------------------------------
+# Check backtick and query_get_value, result should be empty
+# ----------------------------------------------------------------------------
+let $empty= `garbage`;
+echo $empty is empty;
+let $empty= query_get_value(nonsense, blabla, 1);
+echo $empty is empty;
+
+# ----------------------------------------------------------------------------
# Switch the abort on error on and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
--error ER_PARSE_ERROR
garbage ;
--enable_abort_on_error
+echo $mysql_errname;
eval select $mysql_errno as "after_--enable_abort_on_error" ;
# ----------------------------------------------------------------------------
@@ -371,6 +399,71 @@ select 3 from t1 ;
--error 1
--exec echo "disable_abort_on_error; enable_abort_on_error; error 1064; select 3 from t1; select 3 from t1;" | $MYSQL_TEST 2>&1
+# ----------------------------------------------------------------------------
+# Test --enable and --disable with ONCE
+# ----------------------------------------------------------------------------
+
+--disable_abort_on_error ONCE
+garbage;
+--disable_abort_on_error ONCE
+--remove_file DoesNotExist
+
+--disable_result_log
+select 2;
+--enable_result_log ONCE
+select 3;
+select 5;
+--enable_result_log
+
+# ----------------------------------------------------------------------------
+# Test cumulative ONCE
+# ----------------------------------------------------------------------------
+
+--disable_abort_on_error ONCE
+--disable_query_log ONCE
+select 3 from t1;
+select 7;
+
+--error 1
+--exec echo "--disable_info OCNE" | $MYSQL_TEST 2>&1
+
+--enable_connect_log ONCE
+connect (con1,localhost,root,,);
+connection default;
+disconnect con1;
+
+# ----------------------------------------------------------------------------
+# Test ONCE can be combined with --error or modifiers like lowercase
+# ----------------------------------------------------------------------------
+
+--disable_result_log ONCE
+--error ER_NO_SUCH_TABLE
+select 5 from t1;
+
+--disable_query_log ONCE
+--lowercase_result
+select "CASE" as "LOWER";
+
+--sorted_result
+--disable_query_log ONCE
+select "xyz" as name union select "abc" as name order by name desc;
+
+# ----------------------------------------------------------------------------
+# Test --error with backtick operator or query_get_value
+# ----------------------------------------------------------------------------
+
+--error 0,ER_NO_SUCH_TABLE
+let $empty= `SELECT foo from bar`;
+echo $empty is empty;
+
+--error 0,ER_BAD_FIELD_ERROR
+let $empty= query_get_value(SELECT bar as foo, baz, 1);
+echo $empty is empty;
+
+--error 0,ER_NO_SUCH_TABLE
+if (!`SELECT foo from bar`) {
+ echo "Yes it's empty";
+}
# ----------------------------------------------------------------------------
# Test comments
@@ -940,10 +1033,9 @@ while ($outer)
--source $MYSQLTEST_VARDIR/tmp/sourced.inc
--error ER_NO_SUCH_TABLE
SELECT * from nowhere;
- --disable_abort_on_error
+ --disable_abort_on_error ONCE
# Statement giving a different error, to make sure we don't mask it
SELECT * FROM nowhere else;
- --enable_abort_on_error
}
dec $outer;
inc $ifval;
@@ -1092,9 +1184,8 @@ system echo "hej" > /dev/null;
--error 1
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
---disable_abort_on_error
+--disable_abort_on_error ONCE
system NonExistsinfComamdn 2> /dev/null;
---enable_abort_on_error
# ----------------------------------------------------------------------------
@@ -2513,10 +2604,9 @@ INSERT INTO t1 SELECT f1 - 64 FROM t1;
INSERT INTO t1 SELECT f1 - 128 FROM t1;
INSERT INTO t1 SELECT f1 - 256 FROM t1;
INSERT INTO t1 SELECT f1 - 512 FROM t1;
---disable_result_log
+--disable_result_log ONCE
--sorted_result
SELECT * FROM t1;
---enable_result_log
DROP TABLE t1;
# ----------------------------------------------------------------------------
@@ -2564,11 +2654,9 @@ SELECT 0 as "WILL NOT lower case ÄËÐ";
--exec $MYSQL_TEST --help 2>&1 > /dev/null
--exec $MYSQL_TEST --version 2>&1 > /dev/null
--enable_query_log
---disable_abort_on_error
+--disable_abort_on_error ONCE
--error 1
--exec $MYSQL_TEST a b c 2>&1 > /dev/null
---enable_abort_on_error
---enable_query_log
# ----------------------------------------------------------------------------
# test for query_get_value
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index d820f1c03bd..99945a82c7f 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -1547,6 +1547,13 @@ SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
DROP TABLE t1;
+--echo #
+--echo # Bug#11765255 58201:
+--echo # VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
+--echo #
+
+select 1 order by max(1) + min(1);
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test
index e8b73687177..6ff90f37687 100644
--- a/mysql-test/t/partition_innodb_plugin.test
+++ b/mysql-test/t/partition_innodb_plugin.test
@@ -7,7 +7,6 @@ call mtr.add_suppression("nnoDB: Error: table `test`.`t1` .* Partition.* InnoDB
--echo #
--echo # Bug#55091: Server crashes on ADD PARTITION after a failed attempt
--echo #
-SET @old_innodb_file_format_max = @@global.innodb_file_format_max;
SET @old_innodb_file_format = @@global.innodb_file_format;
SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
@@ -66,7 +65,6 @@ DROP TABLE t1;
SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
SET @@global.innodb_file_format = @old_innodb_file_format;
SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
-SET @@global.innodb_file_format_max = @old_innodb_file_format_max;
#
# Bug#32430 - show engine innodb status causes errors
diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test
index 16c96fa0c21..e1de1cc8153 100644
--- a/mysql-test/t/plugin_auth.test
+++ b/mysql-test/t/plugin_auth.test
@@ -507,4 +507,63 @@ SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
ORDER BY COLUMN_NAME;
+--echo #
+--echo # Bug # 11766641: 59792: BIN/MYSQL -UUNKNOWN -PUNKNOWN
+--echo # .-> USING PASSWORD: NO
+--echo #
+
+--echo # shoud contain "using password=yes"
+--error 1
+--exec $MYSQL -uunknown -punknown 2>&1
+
+--echo # shoud contain "using password=no"
+--error 1
+--exec $MYSQL -uunknown 2>&1
+
+--echo #
+--echo # Bug #12610784: SET PASSWORD INCORRECTLY KEEP AN OLD EMPTY PASSWORD
+--echo #
+
+CREATE USER bug12610784@localhost;
+SET PASSWORD FOR bug12610784@localhost = PASSWORD('secret');
+--disable_query_log
+--error ER_ACCESS_DENIED_ERROR
+connect(b12610784,localhost,bug12610784,,test);
+--enable_query_log
+connect(b12610784,localhost,bug12610784,secret,test);
+connection default;
+disconnect b12610784;
+DROP USER bug12610784@localhost;
+
+
+--echo #
+--echo # Bug #12818542: PAM: ADDING PASSWORD FOR AN ACCOUNT DISABLES PAM
+--echo # AUTHENTICATION SETTINGS
+--echo #
+
+CREATE USER bug12818542@localhost
+ IDENTIFIED WITH 'test_plugin_server' AS 'bug12818542_dest';
+CREATE USER bug12818542_dest@localhost
+ IDENTIFIED BY 'bug12818542_dest_passwd';
+GRANT PROXY ON bug12818542_dest@localhost TO bug12818542@localhost;
+
+connect(bug12818542_con,localhost,bug12818542,bug12818542_dest);
+connection bug12818542_con;
+SELECT USER(),CURRENT_USER();
+
+SET PASSWORD = PASSWORD('bruhaha');
+
+connection default;
+disconnect bug12818542_con;
+
+connect(bug12818542_con2,localhost,bug12818542,bug12818542_dest);
+connection bug12818542_con2;
+SELECT USER(),CURRENT_USER();
+
+connection default;
+disconnect bug12818542_con2;
+
+DROP USER bug12818542@localhost;
+DROP USER bug12818542_dest@localhost;
+
--echo End of 5.5 tests
diff --git a/mysql-test/t/secure_file_priv_win-master.opt b/mysql-test/t/secure_file_priv_win-master.opt
new file mode 100644
index 00000000000..e9a43a5584d
--- /dev/null
+++ b/mysql-test/t/secure_file_priv_win-master.opt
@@ -0,0 +1 @@
+--secure_file_priv=$MYSQL_TMP_DIR
diff --git a/mysql-test/t/secure_file_priv_win.test b/mysql-test/t/secure_file_priv_win.test
new file mode 100644
index 00000000000..a12510974ce
--- /dev/null
+++ b/mysql-test/t/secure_file_priv_win.test
@@ -0,0 +1,79 @@
+#
+# Bug58747 breaks secure_file_priv+not secure yet+still accesses other folders
+#
+
+# we do the windows specific relative directory testing
+
+--source include/windows.inc
+
+CREATE TABLE t1 (c1 longtext);
+INSERT INTO t1 values ('a');
+
+LET $MYSQL_TMP_DIR_UCASE= `SELECT upper('$MYSQL_TMP_DIR')`;
+LET $MYSQL_TMP_DIR_LCASE= `SELECT lower('$MYSQL_TMP_DIR')`;
+
+#create the file
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR/B11764517.tmp';
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+show global variables like 'secure_file_priv';
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT load_file('$MYSQL_TMP_DIR\\\\B11764517.tmp') AS x;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT load_file('$MYSQL_TMP_DIR/B11764517.tmp') AS x;
+
+--replace_result $MYSQL_TMP_DIR_UCASE MYSQL_TMP_DIR_UCASE
+eval SELECT load_file('$MYSQL_TMP_DIR_UCASE/B11764517.tmp') AS x;
+
+--replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE
+eval SELECT load_file('$MYSQL_TMP_DIR_LCASE/B11764517.tmp') AS x;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT load_file('$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp') AS x;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval LOAD DATA INFILE '$MYSQL_TMP_DIR\\\\B11764517.tmp' INTO TABLE t1;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval LOAD DATA INFILE '$MYSQL_TMP_DIR/B11764517.tmp' INTO TABLE t1;
+
+--replace_result $MYSQL_TMP_DIR_UCASE MYSQL_TMP_DIR_UCASE
+eval LOAD DATA INFILE '$MYSQL_TMP_DIR_UCASE/B11764517.tmp' INTO TABLE t1;
+
+--replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE
+eval LOAD DATA INFILE '$MYSQL_TMP_DIR_LCASE/B11764517.tmp' INTO TABLE t1;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+--error ER_OPTION_PREVENTS_STATEMENT
+eval LOAD DATA INFILE "$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp" into table t1;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+--error ER_OPTION_PREVENTS_STATEMENT
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517-2.tmp';
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR\\\\B11764517-2.tmp';
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR/B11764517-3.tmp';
+
+--replace_result $MYSQL_TMP_DIR_UCASE MYSQL_TMP_DIR_UCASE
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR_UCASE/B11764517-4.tmp';
+
+--replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR_LCASE/B11764517-5.tmp';
+
+--error 0,1
+--remove_file $MYSQL_TMP_DIR/B11764517.tmp;
+--error 0,1
+--remove_file $MYSQL_TMP_DIR/B11764517-2.tmp;
+--error 0,1
+--remove_file $MYSQL_TMP_DIR/B11764517-3.tmp;
+--error 0,1
+--remove_file $MYSQL_TMP_DIR/B11764517-4.tmp;
+--error 0,1
+--remove_file $MYSQL_TMP_DIR/B11764517-5.tmp;
+DROP TABLE t1;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index bc5ac8ac63f..e78724d16da 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -295,37 +295,37 @@ CREATE TABLE t3 (
insert into t1 values (1),(2);
insert into t2 values (1),(2);
insert into t3 values (1,1),(2,2);
---replace_column 6 # 7 # 8 # 9 #
+--replace_column 6 # 7 # 8 # 9 # 12 #
show table status;
insert into t1 values (3),(4);
insert into t2 values (3),(4);
insert into t3 values (3,3),(4,4);
---replace_column 6 # 7 # 8 # 9 #
+--replace_column 6 # 7 # 8 # 9 # 12 #
show table status;
insert into t1 values (5);
insert into t2 values (5);
insert into t3 values (5,5);
---replace_column 6 # 7 # 8 # 9 #
+--replace_column 6 # 7 # 8 # 9 # 12 #
show table status;
delete from t1 where a=3;
delete from t2 where b=3;
delete from t3 where a=3;
---replace_column 6 # 7 # 8 # 9 # 10 #
+--replace_column 6 # 7 # 8 # 9 # 10 # 12 #
show table status;
truncate table t1;
truncate table t2;
truncate table t3;
---replace_column 6 # 7 # 8 # 9 #
+--replace_column 6 # 7 # 8 # 9 # 12 #
show table status;
insert into t1 values (5);
insert into t2 values (5);
insert into t3 values (5,5);
---replace_column 6 # 7 # 8 # 9 #
+--replace_column 6 # 7 # 8 # 9 # 12 #
show table status;
delete from t1 where a=5;
delete from t2 where b=5;
delete from t3 where a=5;
---replace_column 6 # 7 # 8 # 9 # 10 #
+--replace_column 6 # 7 # 8 # 9 # 10 # 12 #
show table status;
drop table t1, t2, t3;
@@ -443,7 +443,7 @@ flush tables;
# Create a junk frm file on disk
let $MYSQLD_DATADIR= `select @@datadir`;
system echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ;
---replace_column 6 # 7 # 8 # 9 #
+--replace_column 6 # 7 # 8 # 9 # 12 #
SHOW TABLE STATUS like 't1';
--error ER_NOT_FORM_FILE
show create table t1;
@@ -1073,7 +1073,7 @@ set names latin1;
SET NAMES latin1;
CREATE DATABASE `ä`;
CREATE TABLE `ä`.`ä` (a int) ENGINE=Memory;
---replace_column 6 # 7 # 8 # 9 #
+--replace_column 6 # 7 # 8 # 9 # 12 #
SHOW TABLE STATUS FROM `ä` LIKE 'ä';
DROP DATABASE `ä`;
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 6175fc53adf..063b30c01cb 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -2541,6 +2541,28 @@ DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
+--echo #
+--echo # Bug#12428824 - PARSER STACK OVERFLOW AND CRASH IN SP_ADD_USED_ROUTINE
+--echo # WITH OBSCURE QUERY
+--echo #
+
+--error ER_TOO_LONG_IDENT
+SELECT very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
+
+--error ER_TOO_LONG_IDENT
+CALL very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
+
+--error ER_WRONG_DB_NAME
+SELECT very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_func();
+
+--error ER_WRONG_DB_NAME
+CALL very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_proc();
+
+--error ER_TOO_LONG_IDENT
+SELECT db_name.very_long_fn_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
+
+--error ER_TOO_LONG_IDENT
+CALL db_name.very_long_pr_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
--echo End of 5.1 tests
--echo #
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
index d7ea829bf50..ca4e6b04f13 100644
--- a/mysql-test/t/sp-security.test
+++ b/mysql-test/t/sp-security.test
@@ -959,6 +959,43 @@ drop user bug57061_user@localhost;
drop database mysqltest_db;
+--echo #
+--echo # Bug#11882603 SELECT_ACL ON ANY COLUMN IN MYSQL.PROC ALLOWS TO SEE
+--echo # DEFINITION OF ANY ROUTINE.
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+--enable_warnings
+
+CREATE DATABASE db1;
+CREATE PROCEDURE db1.p1() SELECT 1;
+CREATE USER user2@localhost IDENTIFIED BY '';
+GRANT SELECT(db) ON mysql.proc TO user2@localhost;
+
+--echo # Connection con2 as user2
+connect (con2, localhost, user2);
+--echo # The statement below before disclosed info from body_utf8 column.
+--error ER_SP_DOES_NOT_EXIST
+SHOW CREATE PROCEDURE db1.p1;
+
+--echo # Check that SHOW works with SELECT grant on whole table
+--echo # Connection default
+connection default;
+GRANT SELECT ON mysql.proc TO user2@localhost;
+
+--echo # Connection con2
+connection con2;
+--echo # This should work
+SHOW CREATE PROCEDURE db1.p1;
+
+--echo # Connection default
+connection default;
+disconnect con2;
+DROP USER user2@localhost;
+DROP DATABASE db1;
+
+
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 2b83e9a10dc..acbf75d9f01 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -8385,6 +8385,53 @@ SET @@GLOBAL.init_connect= @old_init_connect;
DROP PROCEDURE p2;
DROP PROCEDURE p5;
+
+--echo #
+--echo # Bug#11840395 (formerly known as bug#60347):
+--echo # The string "versiondata" seems
+--echo # to be 'leaking' into the schema name space
+--echo #
+--disable_warnings
+DROP DATABASE IF EXISTS mixedCaseDbName;
+--enable_warnings
+CREATE DATABASE mixedCaseDbName;
+DELIMITER |;
+CREATE PROCEDURE mixedCaseDbName.tryMyProc() begin end|
+CREATE FUNCTION mixedCaseDbName.tryMyFunc() returns text begin return 'IT WORKS'; end
+|
+DELIMITER ;|
+call mixedCaseDbName.tryMyProc();
+select mixedCaseDbName.tryMyFunc();
+DROP DATABASE mixedCaseDbName;
+
+
+--echo #
+--echo # Bug#11766594 59736: SELECT DISTINCT.. INCORRECT RESULT WITH DETERMINISTIC FUNCTION IN WHERE C
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, KEY(b));
+CREATE TABLE t2 (c INT, d INT, KEY(c));
+INSERT INTO t1 VALUES (1,1),(1,1),(1,2);
+INSERT INTO t2 VALUES (1,1),(1,2);
+
+DELIMITER $;
+
+CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
+BEGIN
+ DECLARE a int;
+ -- SQL statement inside
+ SELECT 1 INTO a;
+ RETURN a;
+END $
+
+DELIMITER ;$
+
+SELECT COUNT(DISTINCT d) FROM t1, t2 WHERE a = c AND b = f1();
+
+DROP FUNCTION f1;
+DROP TABLE t1, t2;
+
+
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------
@@ -8787,4 +8834,60 @@ DROP TABLE t1, t2, t3;
DROP PROCEDURE p1;
--echo
+
+--echo
+--echo # --
+--echo # -- Bug#12652769 - 61470: case operator in stored routine retains old
+--echo # -- value of input parameter
+--echo # ---
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf8);
+INSERT INTO t1 VALUES ('a');
+
+delimiter |;
+
+CREATE PROCEDURE p1(dt DATETIME, i INT)
+BEGIN
+ SELECT
+ CASE
+ WHEN i = 1 THEN 2
+ ELSE dt
+ END AS x1;
+
+ SELECT
+ CASE _latin1'a'
+ WHEN _utf8'a' THEN 'A'
+ END AS x2;
+
+ SELECT
+ CASE _utf8'a'
+ WHEN _latin1'a' THEN _utf8'A'
+ END AS x3;
+
+ SELECT
+ CASE s1
+ WHEN _latin1'a' THEN _latin1'b'
+ ELSE _latin1'c'
+ END AS x4
+ FROM t1;
+END|
+
+delimiter ;|
+
+--echo
+CALL p1('2011-04-03 05:14:10', 1);
+CALL p1('2011-04-03 05:14:11', 2);
+CALL p1('2011-04-03 05:14:12', 2);
+CALL p1('2011-04-03 05:14:13', 2);
+
+--echo
+DROP TABLE t1;
+DROP PROCEDURE p1;
+--echo
+
--echo # End of 5.5 test
diff --git a/mysql-test/t/sp_sync.test b/mysql-test/t/sp_sync.test
index 368a09eac8c..589832bb570 100644
--- a/mysql-test/t/sp_sync.test
+++ b/mysql-test/t/sp_sync.test
@@ -1,7 +1,7 @@
# This test should work in embedded server after mysqltest is fixed
-- source include/not_embedded.inc
---echo Tests of syncronization of stored procedure execution.
+--echo Tests of synchronization of stored procedure execution.
--source include/have_debug_sync.inc
@@ -149,9 +149,34 @@ disconnect con2;
DROP PROCEDURE p1;
DROP FUNCTION f1;
DROP TABLES t0, t1;
-SET DEBUG_SYNC= 'RESET';
+--echo #
+--echo # test for bug#11756013
+--echo #
+--disable_warnings
+DROP SCHEMA IF EXISTS s1;
+--enable_warnings
+CREATE SCHEMA s1;
+CREATE PROCEDURE s1.p1() BEGIN END;
+
+connect (con3, localhost, root);
+SET DEBUG_SYNC='before_db_dir_check SIGNAL check_db WAIT_FOR dropped_schema';
+--send CALL s1.p1
+
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR check_db';
+DROP SCHEMA s1;
+SET DEBUG_SYNC='now SIGNAL dropped_schema';
+
+connection con3;
+--error ER_BAD_DB_ERROR
+--reap
+connection default;
+disconnect con3;
+
+SET DEBUG_SYNC = 'RESET';
+
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test
index c114d397e43..39ac086071b 100644
--- a/mysql-test/t/sp_trans.test
+++ b/mysql-test/t/sp_trans.test
@@ -598,6 +598,39 @@ select distinct f1, bug13575(f1) from t3 order by f1|
drop function bug13575|
drop table t3|
+#
+# BUG#11758414: Default storage_engine not honored when set
+# from within a stored procedure
+#
+SELECT @@GLOBAL.storage_engine INTO @old_engine|
+SET @@GLOBAL.storage_engine=InnoDB|
+SET @@SESSION.storage_engine=InnoDB|
+# show defaults at define-time
+SHOW GLOBAL VARIABLES LIKE 'storage_engine'|
+SHOW SESSION VARIABLES LIKE 'storage_engine'|
+CREATE PROCEDURE bug11758414()
+BEGIN
+ SET @@GLOBAL.storage_engine="MyISAM";
+ SET @@SESSION.storage_engine="MyISAM";
+ # show defaults at execution time / that setting them worked
+ SHOW GLOBAL VARIABLES LIKE 'storage_engine';
+ SHOW SESSION VARIABLES LIKE 'storage_engine';
+ CREATE TABLE t1 (id int);
+ CREATE TABLE t2 (id int) ENGINE=InnoDB;
+ # show we're heeding the default (at run-time, not parse-time!)
+ SHOW CREATE TABLE t1;
+ # show that we didn't break explicit override with ENGINE=...
+ SHOW CREATE TABLE t2;
+END;
+|
+CALL bug11758414|
+# show that changing defaults within SP stuck
+SHOW GLOBAL VARIABLES LIKE 'storage_engine'|
+SHOW SESSION VARIABLES LIKE 'storage_engine'|
+DROP PROCEDURE bug11758414|
+DROP TABLE t1, t2|
+SET @@GLOBAL.storage_engine=@old_engine|
+
--echo #
--echo # End of 5.1 tests
--echo #
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 7444af790e5..0b368f5be67 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3433,6 +3433,39 @@ ORDER BY outr.pk;
DROP TABLE t1,t2;
+#--echo #
+#--echo # Bug#12329653
+#--echo # EXPLAIN, UNION, PREPARED STATEMENT, CRASH, SQL_FULL_GROUP_BY
+#--echo #
+#
+#CREATE TABLE t1(a1 int);
+#INSERT INTO t1 VALUES (1),(2);
+#
+#SELECT @@session.sql_mode INTO @old_sql_mode;
+#SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
+#
+### First a simpler query, illustrating the transformation
+### '1 < some (...)' => '1 < max(...)'
+#SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
+#
+### The query which made the server crash.
+#PREPARE stmt FROM
+#'SELECT 1 UNION ALL
+#SELECT 1 FROM t1
+#ORDER BY
+#(SELECT 1 FROM t1 AS t1_0
+# WHERE 1 < SOME (SELECT a1 FROM t1)
+#)' ;
+#
+#--error ER_SUBQUERY_NO_1_ROW
+#EXECUTE stmt ;
+#--error ER_SUBQUERY_NO_1_ROW
+#EXECUTE stmt ;
+#
+#SET SESSION sql_mode=@old_sql_mode;
+#
+#DEALLOCATE PREPARE stmt;
+#DROP TABLE t1;
--echo End of 5.0 tests.
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 45cf80aab5c..b33c51566a0 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -307,4 +307,27 @@ INSERT INTO t1 VALUES(-1.79769313486231e+308);
SELECT f1 FROM t1;
DROP TABLE t1;
+--echo #
+--echo # Bug#12406055 BUFFER OVERFLOW OF VARIABLE 'BUFF' IN STRING::SET_REAL
+--echo #
+
+--echo # Ignoring output from misc. float operations
+--disable_result_log
+
+let $nine_65=
+99999999999999999999999999999999999999999999999999999999999999999;
+
+select format(-1.7976931348623157E+307,256) as foo;
+select least(-1.1111111111111111111111111,
+ - group_concat(1.7976931348623157E+308)) as foo;
+eval select concat((truncate((-1.7976931348623157E+307),(0x1e))),
+ ($nine_65)) into @a;
+--enable_result_log
+
--echo End of 5.0 tests
+
+--echo #
+--echo # Bug#12368853 FORMAT() CRASHES WITH LARGE NUMBERS AFTER TRUNCATE...
+--echo #
+
+select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo;
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index f1eeabbd924..4f4b1962cc3 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1535,3 +1535,17 @@ DROP TABLE IF EXISTS t1;
--echo End of 5.1 tests
+
+--echo #
+--echo # BUG#12911710 - VALGRIND FAILURE IN
+--echo # ROW-DEBUG:PERFSCHEMA.SOCKET_SUMMARY_BY_INSTANCE_FUNC
+--echo #
+
+CREATE TABLE t1(d1 DECIMAL(60,0) NOT NULL,
+ d2 DECIMAL(60,0) NOT NULL);
+
+INSERT INTO t1 (d1, d2) VALUES(0.0, 0.0);
+SELECT d1 * d2 FROM t1;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index db7f8397c7b..c9bc3f5e1aa 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1124,6 +1124,47 @@ insert into t1 values (10),(10),(10),(2),(3),(4),(5),(6),(7),(8),(9),(1),(10);
select a from t1 where false UNION select a from t1 limit 8;
drop table t1;
+--echo #
+--echo # Bug#11765255 58201:
+--echo # VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
+--echo #
+
+let $my_stmt=
+select 1 as foo
+union
+select 2
+union
+select 3
+union
+select 4
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+;
+
+eval $my_stmt;
+
+eval prepare stmt1 from '$my_stmt';
+execute stmt1;
+execute stmt1;
+
+let $my_stmt=
+select 1 as foo
+union
+select 2
+union
+select 3
+union
+(select 4)
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+;
+
+eval $my_stmt;
+
+eval prepare stmt1 from '$my_stmt';
+execute stmt1;
+execute stmt1;
+
+deallocate prepare stmt1;
+
--echo End of 5.1 tests
--echo #
diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test
index 89c0b8992b1..b36bd2067cc 100644
--- a/mysql-test/t/xml.test
+++ b/mysql-test/t/xml.test
@@ -665,5 +665,14 @@ SET NAMES latin1;
SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
--echo #
+--echo # Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS
+--echo #
+SELECT UPDATEXML('','(a)/a','');
+SELECT UPDATEXML('<a><a>x</a></a>','(a)/a','<b />');
+SELECT UPDATEXML('<a><c><a>x</a></c></a>','(a)/a','<b />');
+SELECT UPDATEXML('<a><c><a>x</a></c></a>','(a)//a','<b />');
+SELECT ExtractValue('<a><a>aa</a><b>bb</b></a>','(a)/a|(a)/b');
+
+--echo #
--echo # End of 5.5 tests
--echo #