summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-10-06 13:18:52 +0200
committerunknown <msvensson@neptunus.(none)>2006-10-06 13:18:52 +0200
commit8114c0d8d672736912e903169fdcd50cb48cb98c (patch)
tree511a24734257edce70052f6235cfd7d9437fd7b7 /mysql-test/t
parent61b12d8fa1f164211386ace852e69c44089c26e1 (diff)
parent3f4ff833ca11475fabdd6442483fa828134702d5 (diff)
downloadmariadb-git-8114c0d8d672736912e903169fdcd50cb48cb98c.tar.gz
Merge neptunus.(none):/home/msvensson/mysql/same_tools/my41-same_tools
into neptunus.(none):/home/msvensson/mysql/mysql-4.1-maint mysql-test/r/subselect.result: Auto merged mysql-test/t/ps.test: Auto merged mysql-test/t/subselect.test: Auto merged
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/connect.test83
-rw-r--r--mysql-test/t/init_file.test5
-rw-r--r--mysql-test/t/mysql_client_test.test6
-rw-r--r--mysql-test/t/mysqltest.test807
-rw-r--r--mysql-test/t/ps.test6
-rw-r--r--mysql-test/t/ps_1general.test2
-rw-r--r--mysql-test/t/ps_grant.test2
-rw-r--r--mysql-test/t/rpl000018.test29
-rw-r--r--mysql-test/t/rpl_chain_temp_table.test101
-rw-r--r--mysql-test/t/rpl_charset.test2
-rw-r--r--mysql-test/t/rpl_failsafe.test24
-rw-r--r--mysql-test/t/rpl_flush_tables.test2
-rw-r--r--mysql-test/t/rpl_heap.test51
-rw-r--r--mysql-test/t/rpl_loaddatalocal.test8
-rw-r--r--mysql-test/t/rpl_trunc_temp.test3
-rw-r--r--mysql-test/t/subselect.test2
-rw-r--r--mysql-test/t/type_blob.test2
17 files changed, 823 insertions, 312 deletions
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
index ff15d74e5ac..89e34f0c8e0 100644
--- a/mysql-test/t/connect.test
+++ b/mysql-test/t/connect.test
@@ -1,7 +1,6 @@
# This test is to check various cases of connections
-# with right and wrong password, with and without database
-# Unfortunately the check is incomplete as we can't handle errors on connect
-# Also we can't connect without database
+# with right and wrong password, with and without database
+# Unfortunately the check is incomplete as we can't connect without database
# This test makes no sense with the embedded server
--source include/not_embedded.inc
@@ -10,69 +9,73 @@
drop table if exists t1,t2;
--enable_warnings
+
#connect (con1,localhost,root,,"");
#show tables;
connect (con1,localhost,root,,mysql);
show tables;
-connect (con1,localhost,root,,test);
+connect (con2,localhost,root,,test);
show tables;
-# Re enable this one day if error handling on connect will take place
-
-#connect (con1,localhost,root,z,test2);
-#--error 1045
-#connect (con1,localhost,root,z,);
-#--error 1045
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error 1045
+connect (fail_con,localhost,root,z,test2);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error 1045
+connect (fail_con,localhost,root,z,);
grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling";
# Now check this user with different databases
-
#connect (con1,localhost,test,gambling,"");
#show tables;
-connect (con1,localhost,test,gambling,mysql);
+connect (con3,localhost,test,gambling,mysql);
show tables;
-connect (con1,localhost,test,gambling,test);
+connect (con4,localhost,test,gambling,test);
show tables;
-# Re enable this one day if error handling on connect will take place
-
-#connect (con1,localhost,test,,test2);
-#--error 1045
-#connect (con1,localhost,test,,"");
-#--error 1045
-#connect (con1,localhost,test,zorro,test2);
-#--error 1045
-#connect (con1,localhost,test,zorro,);
-#--error 1045
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error 1045
+connect (fail_con,localhost,test,,test2);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error 1045
+connect (fail_con,localhost,test,,"");
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error 1045
+connect (fail_con,localhost,test,zorro,test2);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error 1045
+connect (fail_con,localhost,test,zorro,);
# check if old password version also works
update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
-#connect (con1,localhost,test,gambling2,"");
-#show tables;
-connect (con1,localhost,test,gambling2,mysql);
+connect (con10,localhost,test,gambling2,);
+connect (con5,localhost,test,gambling2,mysql);
+connection con5;
set password="";
--error 1105
set password='gambling3';
set password=old_password('gambling3');
show tables;
-connect (con1,localhost,test,gambling3,test);
+connect (con6,localhost,test,gambling3,test);
show tables;
-# Re enable this one day if error handling on connect will take place
-
-#connect (con1,localhost,test,,test2);
-#--error 1045
-#connect (con1,localhost,test,,);
-#--error 1045
-#connect (con1,localhost,test,zorro,test2);
-#--error 1045
-#connect (con1,localhost,test,zorro,);
-#--error 1045
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error 1045
+connect (fail_con,localhost,test,,test2);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error 1045
+connect (fail_con,localhost,test,,);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error 1045
+connect (fail_con,localhost,test,zorro,test2);
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error 1045
+connect (fail_con,localhost,test,zorro,);
# remove user 'test' so that other tests which may use 'test'
@@ -84,13 +87,13 @@ flush privileges;
#
# Bug#12517: Clear user variables and replication events before
# closing temp tables in thread cleanup.
-connect (con2,localhost,root,,test);
-connection con2;
+connect (con7,localhost,root,,test);
+connection con7;
create table t1 (id integer not null auto_increment primary key);
create temporary table t2(id integer not null auto_increment primary key);
set @id := 1;
delete from t1 where id like @id;
-disconnect con2;
+disconnect con7;
--sleep 5
connection default;
drop table t1;
diff --git a/mysql-test/t/init_file.test b/mysql-test/t/init_file.test
index de6aca455bd..bbe0c4ff884 100644
--- a/mysql-test/t/init_file.test
+++ b/mysql-test/t/init_file.test
@@ -4,6 +4,7 @@
#
# See mysql-test/std_data/init_file.dat and
# mysql-test/t/init_file-master.opt for the actual test
-#
+#
-# End of 4.1 tests
+--echo ok
+--echo End of 4.1 tests
diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test
index 1225bf73009..2677e470289 100644
--- a/mysql-test/t/mysql_client_test.test
+++ b/mysql-test/t/mysql_client_test.test
@@ -8,8 +8,8 @@
# server or run mysql-test-run --debug mysql_client_test and check
# var/log/mysql_client_test.trace
---disable_result_log
---exec echo $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
---exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
+--exec echo "$MYSQL_CLIENT_TEST --getopt-ll-test=25600M" > $MYSQLTEST_VARDIR/log/mysql_client_test.log 2>&1
+--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.log 2>&1
# End of 4.1 tests
+echo ok;
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index a15a143e9f4..d98375ca746 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -1,3 +1,4 @@
+# This test should work in embedded server after mysqltest is fixed
-- source include/not_embedded.inc
# ============================================================================
@@ -26,7 +27,7 @@
# ----------------------------------------------------------------------------
# $mysql_errno contains the return code of the last command
-# send to the server.
+# sent to the server.
# ----------------------------------------------------------------------------
# get $mysql_errno before the first statement
# $mysql_errno should be -1
@@ -49,7 +50,7 @@ select otto from (select 1 as otto) as t1;
# ----------------------------------------------------------------------------
# Negative case(statement):
-# The dervied table t1 does not contain a column named 'friedrich' .
+# The derived table t1 does not contain a column named 'friedrich' .
# --> ERROR 42S22: Unknown column 'friedrich' in 'field list and
# --> 1054: Unknown column 'friedrich' in 'field list'
# ----------------------------------------------------------------------------
@@ -67,7 +68,7 @@ select friedrich from (select 1 as otto) as t1;
# The following unmasked unsuccessful statement must give
# 1. mysqltest gives a 'failed'
# 2. does not produce a r/<test case>.reject file !!!
-# PLEASE uncomment it and check it's effect
+# PLEASE uncomment it and check its effect
#select friedrich from (select 1 as otto) as t1;
@@ -113,7 +114,7 @@ select friedrich from (select 1 as otto) as t1;
# test cases for $mysql_errno
#
# $mysql_errno is a builtin variable of mysqltest and contains the return code
-# of the last command send to the server.
+# of the last command sent to the server.
#
# The following test cases often initialize $mysql_errno to 1064 by
# a command with wrong syntax.
@@ -216,7 +217,7 @@ garbage ;
execute stmt;
eval select $mysql_errno as "after_successful_execute" ;
-# failing execute (table dropped)
+# failing execute (table has been dropped)
drop table t1;
--error 1064
garbage ;
@@ -248,8 +249,8 @@ eval select $mysql_errno as "after_failing_deallocate" ;
# ----------------------------------------------------------------------------
# test cases for "--disable_abort_on_error"
#
-# "--disable_abort_on_error" switches the abort of mysqltest
-# after "unmasked" failing statements off.
+# "--disable_abort_on_error" switches off the abort of mysqltest
+# after "unmasked" failing statements.
#
# The default is "--enable_abort_on_error".
#
@@ -257,13 +258,13 @@ eval select $mysql_errno as "after_failing_deallocate" ;
# --error <error number> and --error <error number>
# in the line before the failing statement.
#
-# There are some additional test case for $mysql_errno
+# There are some additional test cases for $mysql_errno
# because "--disable_abort_on_error" enables a new situation.
# Example: "unmasked" statement fails + analysis of $mysql_errno
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
-# Switch the abort on error off and check the effect on $mysql_errno
+# Switch off the abort on error and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
garbage ;
@@ -316,7 +317,6 @@ select 3 from t1 ;
#
#select 3 from t1 ;
-# End of 4.1 tests
--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
@@ -344,7 +344,7 @@ select 3 from t1 ;
# ----------------------------------------------------------------------------
# Test detect end of line "junk"
-# Most likely causes by a missing delimiter
+# Most likely caused by a missing delimiter
# ----------------------------------------------------------------------------
# Too many parameters to function
@@ -359,23 +359,157 @@ select 3 from t1 ;
# Missing delimiter
# The comment will be "sucked into" the sleep command since
# delimiter is missing until after "show status"
---system echo "sleep 4" > var/log/mysqltest.sql
---system echo "# A comment" >> var/log/mysqltest.sql
---system echo "show status;" >> var/log/mysqltest.sql
+--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+sleep 4
+# A comment
+show status;
+EOF
--error 1
---exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+
+#
+# Missing delimiter until eof
+# The comment will be "sucked into" the sleep command since
+# delimiter is missing
+--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+sleep 7
+# Another comment
+EOF
+--error 1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+
+#
+# Missing delimiter until "disable_query_log"
+#
+--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+disconnect default
+
+#
+# comment
+# comment 3
+disable_query_log;
+EOF
+--error 1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+
+#
+# Missing delimiter until "disable_query_log"
+#
+--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+disconnect default
+
+#
+# comment
+
+# comment 3
+disable_query_log;
+EOF
+--error 1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+
+#
+# Missing delimiter until eof
+#
+--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+disconnect default
+
+#
+# comment
+# comment2
+
+# comment 3
+--disable_query_log
+EOF
+--error 1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+
+#
+# Missing delimiter until eof
+#
+--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+disconnect default # comment
+# comment part2
+
+# comment 3
+--disable_query_log
+EOF
+--error 1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
#
# Extra delimiter
#
--error 1
--exec echo "--sleep 4;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--disable_query_log;" | $MYSQL_TEST 2>&1
# Allow trailing # comment
--sleep 1 # Wait for insert delayed to be executed.
--sleep 1 # Wait for insert delayed to be executed.
+# ----------------------------------------------------------------------------
+# Test error
+# ----------------------------------------------------------------------------
+
+# Missing argument
+--error 1
+--exec echo "error;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--error" | $MYSQL_TEST 2>&1
+
+# First char must be uppercase 'S' or 'E' or [0-9]
+--error 1
+--exec echo "--error s99999" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--error e99999" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--error 9eeeee" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--error 1sssss" | $MYSQL_TEST 2>&1
+
+# First char 'S' but too long
+--error 1
+--exec echo "--error S999999" | $MYSQL_TEST 2>&1
+
+# First char 'S' but lowercase char found
+--error 1
+--exec echo "--error S99a99" | $MYSQL_TEST 2>&1
+
+# First char 'S' but too short
+--error 1
+--exec echo "--error S9999" | $MYSQL_TEST 2>&1
+
+# First char 'E' but not found in error array
+--error 1
+--exec echo "--error E9999" | $MYSQL_TEST 2>&1
+
+# First char [0-9] but contains chars
+--error 1
+--exec echo "--error 999e9" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--error 9b" | $MYSQL_TEST 2>&1
+
+# Multiple errorcodes separated by ','
+--error 1,1,1,1
+#--error 9,ER_PARSE_ERROR
+#--error ER_PARSE_ERROR
+#--error 9,ER_PARSE_ERROR,9,ER_PARSE_ERROR
+#--error 9, ER_PARSE_ERROR, 9, ER_PARSE_ERROR
+#--error 9,S00000,9,ER_PARSE_ERROR
+#--error 9,S00000,9,ER_PARSE_ERROR,ER_PARSE_ERROR,ER_PARSE_ERROR,9,10,11,12
+--error 9,S00000,9
+--error 9,S00000,9,9,10,11,12
+--error 9 ,10
+--error 9 , 10
+--error 9 , 10
+--error 9 , 10
+
+# Too many errorcodes specified
+--error 1
+--exec echo "--error 1,2,3,4,5,6,7,8,9,10,11" | $MYSQL_TEST 2>&1
+
# ----------------------------------------------------------------------------
# Test echo command
@@ -399,8 +533,8 @@ echo - MySQL: The world''s
- source database;
echo - MySQL: The world''s
--- most popular open
--- source database;
+-- most popular
+-- open source database;
echo # MySQL: The
--world''s
@@ -419,7 +553,7 @@ echo ;
# Illegal use of echo
--error 1
---exec echo "echo $;" | $MYSQL_TEST 2>&1
+--exec echo "echo \$;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
@@ -457,8 +591,8 @@ echo $message;
let $message= -- MySQL: The
-- world''s most
--- popular open
--- source database;
+-- popular
+-- open source database;
echo $message;
let $message= # MySQL: The
@@ -495,9 +629,21 @@ echo $where2;
let $where3=a long $where variable content;
echo $where3;
+let $where3=a long \\\$where variable content;
+echo $where3;
+
let $novar1= $novar2;
echo $novar1;
+let $cat=na;
+let $cat=ba$cat$cat;
+echo banana = $cat;
+
+# ba\$cat\$cat should have been sufficient.
+# ba\\\$cat\\\$cat -> ba\$cat\$cat -> ba$cat$cat -> banana
+# Magnus' upcoming patch will fix the missing second interpretation.
+let $cat=ba\\\$cat\\\$cat;
+echo Not a banana: $cat;
# Test illegal uses of let
@@ -506,22 +652,19 @@ echo $novar1;
--exec echo "let ;" | $MYSQL_TEST 2>&1
--error 1
---exec echo "let $=hi;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "let hi=hi;" | $MYSQL_TEST 2>&1
+--exec echo "let \$=hi;" | $MYSQL_TEST 2>&1
--error 1
---exec echo "let $1 hi;" | $MYSQL_TEST 2>&1
+--exec echo "let \$1 hi;" | $MYSQL_TEST 2>&1
--error 1
---exec echo "let $m hi;" | $MYSQL_TEST 2>&1
+--exec echo "let \$m hi;" | $MYSQL_TEST 2>&1
--error 1
---exec echo "let $hi;" | $MYSQL_TEST 2>&1
+--exec echo "let \$hi;" | $MYSQL_TEST 2>&1
--error 1
---exec echo "let $ hi;" | $MYSQL_TEST 2>&1
+--exec echo "let \$ hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let =hi;" | $MYSQL_TEST 2>&1
@@ -529,6 +672,55 @@ echo $novar1;
--error 1
--exec echo "let hi;" | $MYSQL_TEST 2>&1
+# More advanced test for bug#17280
+let $success= 1;
+--echo # Execute: --echo # <whatever> success: \$success
+--echo # <whatever> success: $success
+--echo # Execute: echo # <whatever> success: \$success ;
+echo # <whatever> success: $success ;
+
+--echo # The next two variants work fine and expand the content of \$success
+--echo # Execute: --echo \$success
+--echo $success
+--echo # Execute: echo \$success ;
+echo $success ;
+
+# ----------------------------------------------------------------------------
+# Test to assign let from query
+# let $<var_name>=`<query>`;
+# ----------------------------------------------------------------------------
+--disable_parsing
+echo var1;
+let $var1= `select "hi" as "Col", 1 as "Column1", "hi there" as Col3`;
+echo $var1;
+echo $var1_Col;
+echo $var1_Column1;
+echo $var1_Col3;
+
+echo var2;
+let $var2= `select 2 as "Column num 2"`;
+echo $var2;
+echo $var2_Column num 2;
+echo $var2_Column;
+
+echo var2 again;
+let $var2= `select 2 as "Column num 2"`;
+echo $var2;
+echo $var2_Column num 2;
+echo $var2_Column_num_2;
+echo $var2_Column;
+
+echo var3 two columns with same name;
+let $var3= `select 1 as "Col", 2 as "Col", 3 as "var3"`;
+echo $var3;
+echo $var3_Col;
+echo $var3_Col;
+echo $var3_var3;
+
+#echo failing query in let;
+#--error 1
+#--exec echo "let $var2= `failing query;`" | $MYSQL_TEST 2>&1
+--enable_parsing
# ----------------------------------------------------------------------------
# Test source command
# ----------------------------------------------------------------------------
@@ -538,29 +730,36 @@ echo $novar1;
--error 1
--exec echo "source ;" | $MYSQL_TEST 2>&1
+# Fix win paths
+--replace_result \\ /
+# Source a nonexisting file
--error 1
--exec echo "source non_existingFile;" | $MYSQL_TEST 2>&1
# Too many source
---exec echo "source var/tmp/recursive.sql;" > var/tmp/recursive.sql
+--exec echo "source $MYSQLTEST_VARDIR/tmp/recursive.sql;" > $MYSQLTEST_VARDIR/tmp/recursive.sql
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1
---exec echo "source var/tmp/recursive.sql;" | $MYSQL_TEST 2>&1
+--exec echo "source $MYSQLTEST_VARDIR/tmp/recursive.sql;" | $MYSQL_TEST 2>&1
# Source a file with error
---exec echo "garbage ;" > var/tmp/error.sql
+--exec echo "garbage ;" > $MYSQLTEST_VARDIR/tmp/error.sql
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1
---exec echo "source var/tmp/error.sql;" | $MYSQL_TEST 2>&1
+--exec echo "source $MYSQLTEST_VARDIR/tmp/error.sql;" | $MYSQL_TEST 2>&1
# Test execution of source in a while loop
---exec echo "echo here is the sourced script;" > var/tmp/sourced.sql
+--write_file $MYSQLTEST_VARDIR/tmp/sourced.inc
+echo here is the sourced script;
+EOF
--disable_query_log
let $outer= 2; # Number of outer loops
while ($outer)
{
eval SELECT '$outer = outer loop variable after while' AS "";
- --source var/tmp/sourced.sql
+ --source $MYSQLTEST_VARDIR/tmp/sourced.inc
eval SELECT '$outer = outer loop variable before dec' AS "";
dec $outer;
@@ -581,7 +780,6 @@ while ($outer)
# Test execution of source in a while loop
---exec echo "--source var/tmp/sourced.sql" > var/tmp/sourced1.sql
--disable_abort_on_error
# Sourcing of a file within while loop, sourced file will
# source other file
@@ -589,11 +787,12 @@ let $num= 9;
while ($num)
{
SELECT 'In loop' AS "";
- --source var/tmp/sourced1.sql
+ --source $MYSQLTEST_VARDIR/tmp/sourced.inc
dec $num;
}
--enable_abort_on_error
--enable_query_log
+--remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
# ----------------------------------------------------------------------------
# Test sleep command
@@ -683,7 +882,7 @@ system echo "hej" > /dev/null;
--exec echo "system false;" | $MYSQL_TEST 2>&1
--disable_abort_on_error
-system NonExistsinfComamdn;
+system NonExistsinfComamdn 2> /dev/null;
--enable_abort_on_error
@@ -700,6 +899,30 @@ echo test3stop
--delimiter ;
echo test4;
+
+# ----------------------------------------------------------------------------
+# Test if
+# ----------------------------------------------------------------------------
+
+let $counter=10;
+if ($counter)
+{
+ echo Counter is greater than 0, (counter=10);
+}
+if (!$counter)
+{
+ echo Counter is not 0, (counter=10);
+}
+let $counter=0;
+if ($counter)
+{
+ echo Counter is greater than 0, (counter=0);
+}
+if (!$counter)
+{
+ echo Counter is not 0, (counter=0);
+}
+
# ----------------------------------------------------------------------------
# Test while, { and }
# ----------------------------------------------------------------------------
@@ -713,11 +936,158 @@ while ($i)
# One liner
#let $i=1;while ($i){echo $i;dec $i;}
-
+let $i=0;
+while (!$i)
+{
+ echo Testing while with not;
+ inc $i;
+}
# Exceed max nesting level
+--write_file $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc
+let $1 = 10;
+while ($1)
+{
+while ($1)
+{
+while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ while ($1)
+{
+ echo $1;
+ dec $1;
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+}
+EOF
+# Fix win path
+--replace_result \\ / $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1
---exec echo "source include/mysqltest_while.inc;" | $MYSQL_TEST 2>&1
+--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc;" | $MYSQL_TEST 2>&1
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc
--error 1
--exec echo "while \$i;" | $MYSQL_TEST 2>&1
--error 1
@@ -731,20 +1101,20 @@ while ($i)
--error 1
--exec echo "{;" | $MYSQL_TEST 2>&1
---system echo "while (0)" > var/log/mysqltest.sql
---system echo "echo hej;" >> var/log/mysqltest.sql
+--system echo "while (0)" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo "echo hej;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
--error 1
---exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
---system echo "while (0)" > var/log/mysqltest.sql
---system echo "{echo hej;" >> var/log/mysqltest.sql
+--system echo "while (0)" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo "{echo hej;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
--error 1
---exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
---system echo "while (0){" > var/log/mysqltest.sql
---system echo "echo hej;" >> var/log/mysqltest.sql
+--system echo "while (0){" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo "echo hej;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
--error 1
---exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
# ----------------------------------------------------------------------------
# Test error messages returned from comments starting with a command
@@ -772,7 +1142,7 @@ select "a" as col1, "c" as col2;
--exec echo "replace_result a;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "replace_result a ;" | $MYSQL_TEST 2>&1
---exec echo "replace_result a b;" | $MYSQL_TEST 2>&1
+--exec echo "replace_result a b; echo OK;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--replace_result a b c" | $MYSQL_TEST 2>&1
--error 1
@@ -809,6 +1179,71 @@ select "a" as col1, "c" as col2;
--error 1
--exec echo "save_master_pos; sync_with_master a;" | $MYSQL_TEST 2>&1
+# ----------------------------------------------------------------------------
+# Test connect
+# ----------------------------------------------------------------------------
+
+--error 1
+--exec echo "connect;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "connect ();" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "connect (con2);" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "connect (con2,);" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "connect (con2,localhost,root,,illegal_db);" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "connect (con1,localhost,root,,,illegal_port,);" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1
+
+# Repeat connect/disconnect
+--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+let $i=100;
+while ($i)
+{
+ connect (test_con1,localhost,root,,);
+ disconnect test_con1;
+ dec $i;
+}
+EOF
+--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1
+
+# Repeat connect/disconnect, exceed max number of connections
+--system echo "let \$i=200;" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo "while (\$i)" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo "{" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo " connect (test_con1,localhost,root,,); " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo " disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo " dec \$i; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo "}" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error 1
+--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
+
+# Select disconnected connection
+--system echo "connect (test_con1,localhost,root,,);" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo "disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo "connection test_con1;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error 1
+--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
+
+# Connection name already used
+--system echo "connect (test_con1,localhost,root,,);" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--system echo "connect (test_con1,localhost,root,,);" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error 1
+--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
+
+# connect when "disable_abort_on_error" caused "connection not found"
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--disable_abort_on_error
+connect (con1,localhost,root,,);
+connection default;
+connection con1;
+--enable_abort_on_error
# ----------------------------------------------------------------------------
# Test mysqltest arguments
@@ -818,6 +1253,8 @@ select "a" as col1, "c" as col2;
--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc
--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc
--exec $MYSQL_TEST --test_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc
+# Fix Win paths
+--replace_result \\ /
--error 1
--exec $MYSQL_TEST -x non_existing_file.inc 2>&1
@@ -841,3 +1278,275 @@ while ($num)
SELECT 1 as a;
+
+#
+# Bug #10251: Identifiers containing quotes not handled correctly
+#
+select 1 as `a'b`, 2 as `a"b`;
+
+# Test escaping of quotes
+select 'aaa\\','aa''a',"aa""a";
+
+#
+# Check of include/show_msg.inc and include/show_msg80.inc
+#
+
+# The message contains in most cases a string with the default character set
+let $message= Here comes a message;
+--source include/show_msg.inc
+
+# The message could also contain a string with character set utf8
+let $message= `SELECT USER()`;
+--source include/show_msg.inc
+
+# The message contains more then 80 characters on multiple lines
+# and is kept between double quotes.
+let $message=
+"Here comes a very very long message that
+ - is longer then 80 characters and
+ - consists of several lines";
+--source include/show_msg80.inc
+
+# The message contains more then 80 characters on multiple lines
+# and uses the auxiliary character "." at the beginning of the message lines.
+let $message= . Here comes a very very long message that
+ . - is longer then 80 characters and
+ . - consists of several lines;
+--source include/show_msg80.inc
+
+#
+# Test --enable_parsing / disable_parsing
+#
+--disable_query_log
+--disable_parsing
+# The following will not enable query logging
+--enable_query_log
+select "this will not be executed";
+--enable_parsing
+select "this will be executed";
+--enable_query_log
+
+#
+# Test zero length result file. Should not pass
+#
+--exec touch $MYSQLTEST_VARDIR/tmp/zero_length_file.result
+--exec echo "echo ok;" > $MYSQLTEST_VARDIR/tmp/query.sql
+--error 1
+--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result 2>&1
+#
+# Test that a test file that does not generate any output fails.
+#
+--exec echo "let \$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
+--error 1
+--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql 2>&1
+
+#
+# Test that mysqltest fails when there are no queries executed
+# but a result file exists
+# NOTE! This will never happen as long as it's not allowed to have
+# test files that produce no output
+#--exec echo "something" > $MYSQLTEST_VARDIR/tmp/result_file.result
+#--exec echo "let \$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
+#--error 1
+#--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/result_file.result 2>&1
+
+#
+# Bug #11731 mysqltest in multi-statement queries ignores errors in
+# non-1st queries
+#
+
+echo Failing multi statement query;
+# PS does not support multi statement
+--exec echo "--disable_ps_protocol" > $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "delimiter ||||;" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "create table t1 (a int primary key);" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "insert into t1 values (1);" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "select 'select-me';" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "insertz 'error query'||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "delimiter ;||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+
+--error 1
+--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/bug11731.sql 2>&1
+drop table t1;
+
+--error 1
+--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
+# The .out file should be non existent
+--exec test ! -s $MYSQLTEST_VARDIR/tmp/bug11731.out
+drop table t1;
+
+
+echo Multi statement using expected error;
+# PS does not support multi statement
+--exec echo "--disable_ps_protocol" > $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "delimiter ||||;" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "--error 1064" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "create table t1 (a int primary key);" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "insert into t1 values (1);" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "select 'select-me';" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "insertz "error query"||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "delimiter ;||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+
+# These two should work since the error is expected
+--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/bug11731.sql 2>&1
+drop table t1;
+
+--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
+# The .out file should exist
+--exec test -s $MYSQLTEST_VARDIR/tmp/bug11731.out
+drop table t1;
+
+#
+# Bug#19890 mysqltest: "query" command is broken
+#
+
+# It should be possible to use the command "query" to force mysqltest to
+# send the command to the server although it's a builtin mysqltest command.
+--error 1064
+query sleep;
+
+--error 1064
+--query sleep
+
+# Just an empty query command
+--error 1065
+query ;
+
+# test for replace_regex
+--replace_regex /at/b/
+select "at" as col1, "c" as col2;
+
+--replace_regex /at/b/i
+select "at" as col1, "AT" as col2, "c" as col3;
+
+--replace_regex /a/b/ /ct/d/
+select "a" as col1, "ct" as col2;
+
+--replace_regex /(strawberry)/raspberry and \1/ /blueberry/blackberry/ /potato/tomato/;
+select "strawberry","blueberry","potato";
+
+--error 1
+--exec echo "--replace_regex a" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--replace_regex a;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex a;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex a ;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex a b; echo OK;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--replace_regex /a b c" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex /a /b c ;" | $MYSQL_TEST 2>&1
+
+# REQUIREMENT
+# replace_regex should replace substitutions from left to right in output
+
+create table t1 (a int, b int);
+insert into t1 values (1,3);
+insert into t1 values (2,4);
+--replace_regex /A/C/ /B/D/i /3/2/ /2/1/
+select * from t1;
+drop table t1;
+
+# ----------------------------------------------------------------------------
+# test for remove_file
+# ----------------------------------------------------------------------------
+
+--error 1
+--exec echo "remove_file ;" | $MYSQL_TEST 2>&1
+
+--error 1
+remove_file non_existing_file;
+
+# ----------------------------------------------------------------------------
+# test for write_file
+# ----------------------------------------------------------------------------
+--error 1
+--exec echo "write_file ;" | $MYSQL_TEST 2>&1
+
+--error 1
+--exec echo "write_file filename ;" | $MYSQL_TEST 2>&1
+
+--error 1
+--exec echo "write_file filename \";" | $MYSQL_TEST 2>&1
+
+write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+Content for test_file1
+EOF
+file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+
+write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp END_DELIMITER;
+Content for test_file1 contains EOF
+END_DELIMITER
+file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+
+# ----------------------------------------------------------------------------
+# test for file_exist
+# ----------------------------------------------------------------------------
+--error 1
+--exec echo "file_exists ;" | $MYSQL_TEST 2>&1
+
+--error 0,1
+remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+Content for test_file1
+EOF
+file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+
+
+# ----------------------------------------------------------------------------
+# test for copy_file
+# ----------------------------------------------------------------------------
+--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
+file1
+EOF
+
+copy_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp;
+file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
+remove_file $MYSQLTEST_VARDIR/tmp/file1.tmp;
+remove_file $MYSQLTEST_VARDIR/tmp/file2.tmp;
+
+--error 1
+--exec echo "copy_file ;" | $MYSQL_TEST 2>&1
+
+--error 1
+--exec echo "copy_file from_file;" | $MYSQL_TEST 2>&1
+
+# ----------------------------------------------------------------------------
+# test for perl
+# ----------------------------------------------------------------------------
+--perl
+print "hello\n";
+EOF
+
+--perl EOF
+print "hello\n";
+EOF
+
+--perl DELIMITER
+print "hello\n";
+DELIMITER
+
+--error 1
+--exec echo "perl TOO_LONG_DELIMITER ;" | $MYSQL_TEST 2>&1
+
+perl;
+print "hello\n";
+EOF
+
+perl;
+ # Print "hello"
+ print "hello\n";
+EOF
+
+
+--echo End of tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 7c2a42404ad..d986d3e5111 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -351,14 +351,14 @@ create table t1 (a int, b int);
insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2);
prepare stmt from
"explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?";
---replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
set @v=5;
-execute stmt using @v;
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
-set @v=0;
execute stmt using @v;
+set @v=0;
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
+execute stmt using @v;
set @v=5;
+--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
execute stmt using @v;
drop table t1;
deallocate prepare stmt;
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index 6f15ba8f673..ec4964d116a 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -305,8 +305,8 @@ prepare stmt4 from ' show table status from test like ''t9%'' ';
--replace_result 2147483647 4294967295
# Bug#4288
execute stmt4;
---replace_column 2 #
prepare stmt4 from ' show status like ''Threads_running'' ';
+--replace_column 2 #
execute stmt4;
prepare stmt4 from ' show variables like ''sql_mode'' ';
execute stmt4;
diff --git a/mysql-test/t/ps_grant.test b/mysql-test/t/ps_grant.test
index 4cb056db358..afd543caacc 100644
--- a/mysql-test/t/ps_grant.test
+++ b/mysql-test/t/ps_grant.test
@@ -35,7 +35,7 @@ use mysqltest;
--source include/ps_create.inc
--source include/ps_renew.inc
--enable_query_log
-eval use $DB;
+use test;
grant usage on mysqltest.* to second_user@localhost
identified by 'looser' ;
grant select on mysqltest.t9 to second_user@localhost
diff --git a/mysql-test/t/rpl000018.test b/mysql-test/t/rpl000018.test
deleted file mode 100644
index aee052ffd28..00000000000
--- a/mysql-test/t/rpl000018.test
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Running test with abort-slave-event-count=1
-# This will force slave to reconnect after every event
-#
-
-require_manager;
-connect (master,localhost,root,,test,0,master.sock);
-connect (slave,localhost,root,,test,0,slave.sock);
-connection master;
-reset master;
-server_stop master;
-server_start master;
-connection slave;
-reset slave;
-start slave;
-connection master;
-show binary logs;
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1(n int);
-insert into t1 values (3351);
-sync_slave_with_master;
-select * from t1;
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_chain_temp_table.test b/mysql-test/t/rpl_chain_temp_table.test
deleted file mode 100644
index 96e228a17a1..00000000000
--- a/mysql-test/t/rpl_chain_temp_table.test
+++ /dev/null
@@ -1,101 +0,0 @@
- # This test makes some assumptions about values of thread ids, which should be
-# true if the servers have been restarted for this test. So we want to
-# stop/restart servers. Note that if assumptions are wrong, the test will not
-# fail; it will just fail to test the error-prone scenario.
-# Using the manager is the only way to have more than one slave server.
-# So you must run this test with --manager.
-
-require_manager;
-server_stop master;
-server_start master;
-server_stop slave;
-server_start slave;
-# no need for slave_sec (no assumptions on thread ids for this server).
-
-source include/master-slave.inc;
-connect (slave_sec,localhost,root,,test,0,slave.sock-1);
-connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
-reset master;
-save_master_pos;
-connection slave_sec;
-eval change master to master_host='127.0.0.1',master_port=$SLAVE_MYPORT, master_user='root';
-start slave;
-sync_with_master;
-
-# :P now we have a chain ready-to-test.
-
-connection master;
-create temporary table t1 (a int);
-save_master_pos;
-connection slave;
-sync_with_master;
-connection master1;
-create temporary table t1 (a int);
-save_master_pos;
-connection slave;
-sync_with_master;
-save_master_pos;
-
-# First test:
-
-connection slave_sec;
-# Before BUG#1686 ("If 2 master threads with same-name temp table, slave makes
-# bad binlog") was fixed, sync_with_master failed
-sync_with_master;
-show status like 'slave_open_temp_tables';
-
-# 'master' and 'master1' usually have thread id 2-3 or 3-4.
-# 'slave' and 'slave1' usually have thread id 2-3.
-connection slave;
-create temporary table t1 (a int);
-connection slave1;
-create temporary table t1 (a int);
-# So it's likely that in the binlog of slave we get
-# server_id=of_master thread_id=3 create temp...
-# server_id=of_slave thread_id=3 create temp...
-# which would confuse slave-sec unless slave-sec uses server id to distinguish
-# between temp tables (here thread id is obviously not enough to distinguish).
-
-save_master_pos;
-
-# Second test:
-
-connection slave_sec;
-# If we did not use the server id to distinguish between temp tables,
-# sync_with_master would fail
-sync_with_master;
-show status like 'slave_open_temp_tables';
-
-# Third test (BUG#1240 "slave of slave breaks when STOP SLAVE was issud on
-# parent slave and temp tables").
-stop slave;
-connection slave;
-insert into t1 values(1);
-create table t2 as select * from t1;
-save_master_pos;
-connection slave_sec;
-start slave;
-sync_with_master;
-show status like 'slave_open_temp_tables';
-select * from t2;
-
-# clean up
-connection slave;
-drop table t2;
-save_master_pos;
-connection slave_sec;
-sync_with_master;
-
-# On purpose, we don't delete the temporary tables explicitely.
-# So temp tables remain on slave (remember they are not deleted when the slave
-# SQL thread terminates). If you run this test with
-# --valgrind --valgrind-options=--show-reachable=yes
-# you will see if they get cleaned up at slave's shutdown (that is, if the
-# memory they use is freed (it should) by mysqld before it terminates).
-# If they wouldn't be cleaned up, you would see some "still reachable" blocks in
-# Valgrind.
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test
index cf079048fc3..a6f4c2ba9be 100644
--- a/mysql-test/t/rpl_charset.test
+++ b/mysql-test/t/rpl_charset.test
@@ -106,6 +106,8 @@ select * from mysqltest2.t1 order by a;
connection master;
drop database mysqltest2;
drop database mysqltest3;
+# file_id: xx can vary depending on previous tests
+--replace_regex /file_id=[0-9]/file_id=x/
show binlog events from 79;
sync_slave_with_master;
diff --git a/mysql-test/t/rpl_failsafe.test b/mysql-test/t/rpl_failsafe.test
deleted file mode 100644
index 4336d897fc0..00000000000
--- a/mysql-test/t/rpl_failsafe.test
+++ /dev/null
@@ -1,24 +0,0 @@
-require_manager;
-source include/master-slave.inc;
-connect (slave_sec,localhost,root,,test,0,slave.sock-1);
-connect (slave_ter,localhost,root,,test,0,slave.sock-2);
-connection master;
-show variables like 'rpl_recovery_rank';
-show status like 'Rpl_status';
-create table t1(n int);
-drop table t1;
-sync_slave_with_master;
-show variables like 'rpl_recovery_rank';
-show status like 'Rpl_status';
-connection slave_sec;
-start slave;
-sync_with_master;
-show variables like 'rpl_recovery_rank';
-show status like 'Rpl_status';
-connection slave_ter;
-start slave;
-sync_with_master;
-show variables like 'rpl_recovery_rank';
-show status like 'Rpl_status';
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_flush_tables.test b/mysql-test/t/rpl_flush_tables.test
index 378fa479f09..aea8d7a5353 100644
--- a/mysql-test/t/rpl_flush_tables.test
+++ b/mysql-test/t/rpl_flush_tables.test
@@ -8,6 +8,8 @@
# merge table getting renamed.
--source include/not_windows.inc
+let $SERVER_VERSION=`select version()`;
+
create table t1 (a int);
insert into t1 values (10);
create table t2 (a int);
diff --git a/mysql-test/t/rpl_heap.test b/mysql-test/t/rpl_heap.test
deleted file mode 100644
index 66dac1d7926..00000000000
--- a/mysql-test/t/rpl_heap.test
+++ /dev/null
@@ -1,51 +0,0 @@
-# You must run this test with --manager.
-
-require_manager;
-
-# Don't know why, but using TCP/IP connections makes this test fail
-# with "Lost connection to MySQL server during query" when we
-# issue a query after the server restart.
-# Maybe this is something awkward in mysqltest or in the manager?
-# So we use sockets.
-connect (master,localhost,root,,test,0,master.sock);
-connect (slave,localhost,root,,test,0,slave.sock);
-
-connection master;
-reset master;
-drop table if exists t1;
-# we use CREATE SELECT to verify that DELETE does not get into binlog
-# before CREATE SELECT
-create table t1 type=HEAP select 10 as a;
-insert into t1 values(11);
-save_master_pos;
-show binlog events from 79;
-connection slave;
-reset slave;
-start slave;
-sync_with_master;
-show create table t1;
-select * from t1; # should be one row
-
-server_stop master;
-server_start master;
-
-connection master;
-select * from t1;
-# to check that DELETE is not written twice
-# (the LIMIT is to not use the query cache)
-select * from t1 limit 10;
-save_master_pos;
-show binlog events in 'master-bin.002' from 79;
-
-connection slave;
-sync_with_master;
-select * from t1; # should be empty
-
-# clean up
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/rpl_loaddatalocal.test b/mysql-test/t/rpl_loaddatalocal.test
index 2ca142c3b64..fd91aba856a 100644
--- a/mysql-test/t/rpl_loaddatalocal.test
+++ b/mysql-test/t/rpl_loaddatalocal.test
@@ -20,11 +20,13 @@ while ($1)
}
set SQL_LOG_BIN=1;
enable_query_log;
-select * into outfile '../../var/master-data/rpl_loaddatalocal.select_outfile' from t1;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
#This will generate a 20KB file, now test LOAD DATA LOCAL
truncate table t1;
-load data local infile './var/master-data/rpl_loaddatalocal.select_outfile' into table t1;
-system rm ./var/master-data/rpl_loaddatalocal.select_outfile ;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
save_master_pos;
connection slave;
sync_with_master;
diff --git a/mysql-test/t/rpl_trunc_temp.test b/mysql-test/t/rpl_trunc_temp.test
index be570a6f80c..b4ea3c318da 100644
--- a/mysql-test/t/rpl_trunc_temp.test
+++ b/mysql-test/t/rpl_trunc_temp.test
@@ -29,7 +29,4 @@ connection slave;
show status like 'Slave_open_temp_tables';
-connection master;
-
-
# End of 4.1 tests
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 6defa8b16a5..f3877b301d6 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1721,7 +1721,7 @@ select (select a from t1) = (1,2);
select (1,2,3) = (select * from t1);
-- error 1241
select (select * from t1) = (1,2,3);
-drop table t1
+drop table t1;
#
# Item_int_with_ref check (BUG#10020)
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index 2ac55da7442..2c3f4e5efce 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -23,7 +23,7 @@ CREATE TABLE t2 (a char(257), b varbinary(70000), c varchar(70000000));
show columns from t2;
create table t3 (a long, b long byte);
show create TABLE t3;
-drop table t1,t2,t3
+drop table t1,t2,t3;
#
# Check errors with blob