Commit 76c1bcf9 authored by unknown's avatar unknown

BUG#11316: mysqltest, problems when assigning value with '#' to $variable

 - Add stricter checking of syntax in mysqltest


client/mysqltest.c:
  Stricter checking of syntax in mysqltest.
mysql-test/r/mysqltest.result:
  Update test results
mysql-test/t/create.test:
  Remove extra ;
mysql-test/t/create_select_tmp.test:
  Remove extra ;
mysql-test/t/drop.test:
  Remove extra ;
mysql-test/t/flush.test:
  Remove extra ;
mysql-test/t/handler.test:
  Remove extra ;
mysql-test/t/innodb.test:
  Remove extra ;
mysql-test/t/mysqltest.test:
  Add more tests for replace, replace_columns, comments with commands and sync_with_master
mysql-test/t/rpl000001.test:
  Remove extra ;
mysql-test/t/rpl_EE_error.test:
  Remove extra ;
mysql-test/t/rpl_drop.test:
  Remove extra ;
mysql-test/t/rpl_error_ignored_table.test:
  Remove extra ;
mysql-test/t/rpl_loaddata.test:
  Remove extra ;
parent 9b5b5d6f
This diff is collapsed.
...@@ -308,13 +308,41 @@ test2 ...@@ -308,13 +308,41 @@ test2
test3 test3
test4 test4
1 1
mysqltest: In included file "./include/mysqltest_while.inc": At line 32: Nesting too deeply mysqltest: In included file "./include/mysqltest_while.inc": At line 64: Nesting too deeply
mysqltest: At line 1: missing '(' in while mysqltest: At line 1: missing '(' in while
mysqltest: At line 1: missing ')' in while mysqltest: At line 1: missing ')' in while
mysqltest: At line 1: Missing '{' after while. Found "dec $i" mysqltest: At line 1: Missing '{' after while. Found "dec $i"
mysqltest: At line 1: Stray '}' - end of block before beginning mysqltest: At line 1: Stray '}' - end of block before beginning
mysqltest: At line 1: Stray '}' - end of block before beginning mysqltest: At line 1: Stray 'end' command - end of block before beginning
mysqltest: At line 1: query '' failed: 1065: Query was empty mysqltest: At line 1: query '' failed: 1065: Query was empty
mysqltest: At line 1: Missing '{' after while. Found "echo hej" mysqltest: At line 1: Missing '{' after while. Found "echo hej"
mysqltest: At line 3: Missing end of block mysqltest: At line 3: Missing end of block
mysqltest: At line 1: Missing newline between while and '{' mysqltest: At line 1: Missing newline between while and '{'
mysqltest: At line 1: missing '(' in if
mysqltest: At line 1: Stray 'end' command - end of block before beginning
select "b" bs col1, "c" bs col2;
col1 col2
b c
seledt "b" bs dol1, "d" bs dol2;
dol1 dol2
b d
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a;'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a '
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c '
select "a" as col1, "c" as col2;
col1 col2
b c
select "a" as col1, "c" as col2;
col1 col2
b d
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a'
mysqltest: At line 1: Wrong number of arguments to replace_column in 'replace_column 1'
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a b'
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a 1'
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 b c '
mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: End of line junk detected: "!"
mysqltest: At line 1: Invalid integer argument "a"
...@@ -238,7 +238,7 @@ drop table t1; ...@@ -238,7 +238,7 @@ drop table t1;
create table `t1 `(a int); create table `t1 `(a int);
--error 1102 --error 1102
create database `db1 `; create database `db1 `;
--error 1166; --error 1166
create table t1(`a ` int); create table t1(`a ` int);
# #
......
...@@ -11,19 +11,19 @@ drop table if exists t1, t2; ...@@ -11,19 +11,19 @@ drop table if exists t1, t2;
--enable_warnings --enable_warnings
CREATE TABLE t1 ( a int ); CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1); INSERT INTO t1 VALUES (1),(2),(1);
--error 1062; --error 1062
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146; --error 1146
select * from t2; select * from t2;
--error 1062; --error 1062
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146; --error 1146
select * from t2; select * from t2;
--error 1062; --error 1062
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146; --error 1146
select * from t2; select * from t2;
--error 1062; --error 1062
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146; --error 1146
select * from t2; select * from t2;
...@@ -6,13 +6,13 @@ drop database if exists mysqltest; ...@@ -6,13 +6,13 @@ drop database if exists mysqltest;
drop database if exists client_test_db; drop database if exists client_test_db;
--enable_warnings --enable_warnings
--error 1051; --error 1051
drop table t1; drop table t1;
create table t1(n int); create table t1(n int);
insert into t1 values(1); insert into t1 values(1);
create temporary table t1( n int); create temporary table t1( n int);
insert into t1 values(2); insert into t1 values(2);
--error 1050; --error 1050
create table t1(n int); create table t1(n int);
drop table t1; drop table t1;
select * from t1; select * from t1;
...@@ -56,13 +56,13 @@ drop database mysqltest; ...@@ -56,13 +56,13 @@ drop database mysqltest;
# test drop/create database and FLUSH TABLES WITH READ LOCK # test drop/create database and FLUSH TABLES WITH READ LOCK
flush tables with read lock; flush tables with read lock;
--error 1209,1223; --error 1209,1223
create database mysqltest; create database mysqltest;
unlock tables; unlock tables;
create database mysqltest; create database mysqltest;
show databases; show databases;
flush tables with read lock; flush tables with read lock;
--error 1208,1223; --error 1208,1223
drop database mysqltest; drop database mysqltest;
unlock tables; unlock tables;
drop database mysqltest; drop database mysqltest;
...@@ -73,7 +73,7 @@ drop database mysqltest; ...@@ -73,7 +73,7 @@ drop database mysqltest;
# test create table and FLUSH TABLES WITH READ LOCK # test create table and FLUSH TABLES WITH READ LOCK
drop table t1; drop table t1;
flush tables with read lock; flush tables with read lock;
--error 1223; --error 1223
create table t1(n int); create table t1(n int);
unlock tables; unlock tables;
create table t1(n int); create table t1(n int);
......
...@@ -37,7 +37,7 @@ connection con1; ...@@ -37,7 +37,7 @@ connection con1;
select * from t1; select * from t1;
connection con2; connection con2;
flush tables with read lock; flush tables with read lock;
--error 1099; --error 1099
drop table t2; drop table t2;
connection con1; connection con1;
send drop table t2; send drop table t2;
......
...@@ -300,7 +300,7 @@ handler t5 open as h5; ...@@ -300,7 +300,7 @@ handler t5 open as h5;
handler h5 read first limit 9; handler h5 read first limit 9;
# close first # close first
alter table t1 engine=MyISAM; alter table t1 engine=MyISAM;
--error 1109; --error 1109
handler h1 read first limit 9; handler h1 read first limit 9;
handler h2 read first limit 9; handler h2 read first limit 9;
handler h3 read first limit 9; handler h3 read first limit 9;
...@@ -308,22 +308,22 @@ handler h4 read first limit 9; ...@@ -308,22 +308,22 @@ handler h4 read first limit 9;
handler h5 read first limit 9; handler h5 read first limit 9;
# close last # close last
alter table t5 engine=MyISAM; alter table t5 engine=MyISAM;
--error 1109; --error 1109
handler h1 read first limit 9; handler h1 read first limit 9;
handler h2 read first limit 9; handler h2 read first limit 9;
handler h3 read first limit 9; handler h3 read first limit 9;
handler h4 read first limit 9; handler h4 read first limit 9;
--error 1109; --error 1109
handler h5 read first limit 9; handler h5 read first limit 9;
# close middle # close middle
alter table t3 engine=MyISAM; alter table t3 engine=MyISAM;
--error 1109; --error 1109
handler h1 read first limit 9; handler h1 read first limit 9;
handler h2 read first limit 9; handler h2 read first limit 9;
--error 1109; --error 1109
handler h3 read first limit 9; handler h3 read first limit 9;
handler h4 read first limit 9; handler h4 read first limit 9;
--error 1109; --error 1109
handler h5 read first limit 9; handler h5 read first limit 9;
handler h2 close; handler h2 close;
handler h4 close; handler h4 close;
...@@ -335,11 +335,11 @@ handler h1_1 read first limit 9; ...@@ -335,11 +335,11 @@ handler h1_1 read first limit 9;
handler h1_2 read first limit 9; handler h1_2 read first limit 9;
handler h1_3 read first limit 9; handler h1_3 read first limit 9;
alter table t1 engine=MyISAM; alter table t1 engine=MyISAM;
--error 1109; --error 1109
handler h1_1 read first limit 9; handler h1_1 read first limit 9;
--error 1109; --error 1109
handler h1_2 read first limit 9; handler h1_2 read first limit 9;
--error 1109; --error 1109
handler h1_3 read first limit 9; handler h1_3 read first limit 9;
drop table t1; drop table t1;
drop table t2; drop table t2;
......
...@@ -1183,7 +1183,7 @@ drop table t1; ...@@ -1183,7 +1183,7 @@ drop table t1;
# #
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
--error 1214; --error 1214
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
DROP TABLE t1; DROP TABLE t1;
......
...@@ -705,6 +705,69 @@ while ($i) ...@@ -705,6 +705,69 @@ while ($i)
--error 1 --error 1
--exec echo -e "while (0){\n echo hej;" | $MYSQL_TEST 2>&1 --exec echo -e "while (0){\n echo hej;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
# Test error messages returned from comments starting with a command
# ----------------------------------------------------------------------------
--error 1
--exec echo "--if the other server is down" | $MYSQL_TEST 2>&1
--error 1
--exec echo "-- end when ..." | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
# Test replace
# ----------------------------------------------------------------------------
--replace_result a b
select "a" as col1, "c" as col2;
--replace_result a b c d
select "a" as col1, "c" as col2;
--error 1
--exec echo "--replace_result a" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--replace_result a;" | $MYSQL_TEST 2>&1
--error 1
--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
--error 1
--exec echo "--replace_result a b c" | $MYSQL_TEST 2>&1
--error 1
--exec echo "replace_result a b c ;" | $MYSQL_TEST 2>&1
--replace_column 1 b
select "a" as col1, "c" as col2;
--replace_column 1 b 2 d
select "a" as col1, "c" as col2;
--error 1
--exec echo "--replace_column a" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--replace_column 1" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--replace_column a b" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--replace_column a 1" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--replace_column 1 b c " | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
# Test sync_with_master
# ----------------------------------------------------------------------------
--error 1
--exec echo "save_master_pos; sync_with_master 10!;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "save_master_pos; sync_with_master 10 !;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "save_master_pos; sync_with_master a;" | $MYSQL_TEST 2>&1
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# TODO Test queries, especially their errormessages... so it's easy to debug # TODO Test queries, especially their errormessages... so it's easy to debug
# new scripts and diagnose errors # new scripts and diagnose errors
......
...@@ -89,7 +89,7 @@ kill @id; ...@@ -89,7 +89,7 @@ kill @id;
# We don't drop t3 as this is a temporary table # We don't drop t3 as this is a temporary table
drop table t2; drop table t2;
connection master; connection master;
--error 1053; --error 1053
reap; reap;
connection slave; connection slave;
# The SQL slave thread should now have stopped because the query was killed on # The SQL slave thread should now have stopped because the query was killed on
......
...@@ -22,7 +22,7 @@ set sql_log_bin=0; ...@@ -22,7 +22,7 @@ set sql_log_bin=0;
insert into t1 values(2); insert into t1 values(2);
set sql_log_bin=1; set sql_log_bin=1;
save_master_pos; save_master_pos;
--error 1062; --error 1062
insert into t1 values(1),(2); insert into t1 values(1),(2);
drop table t1; drop table t1;
save_master_pos; save_master_pos;
......
...@@ -5,7 +5,7 @@ source include/master-slave.inc; ...@@ -5,7 +5,7 @@ source include/master-slave.inc;
drop table if exists t1, t2; drop table if exists t1, t2;
--enable_warnings --enable_warnings
create table t1 (a int); create table t1 (a int);
--error 1051; --error 1051
drop table t1, t2; drop table t1, t2;
save_master_pos; save_master_pos;
connection slave; connection slave;
......
...@@ -6,7 +6,7 @@ source include/master-slave.inc; ...@@ -6,7 +6,7 @@ source include/master-slave.inc;
connection master; connection master;
create table t1 (a int primary key); create table t1 (a int primary key);
# generate an error that goes to the binlog # generate an error that goes to the binlog
--error 1062; --error 1062
insert into t1 values (1),(1); insert into t1 values (1),(1);
save_master_pos; save_master_pos;
connection slave; connection slave;
...@@ -45,7 +45,7 @@ select (@id := id) - id from t3; ...@@ -45,7 +45,7 @@ select (@id := id) - id from t3;
kill @id; kill @id;
drop table t2,t3; drop table t2,t3;
connection master; connection master;
--error 0,1053; --error 0,1053
reap; reap;
connection master1; connection master1;
show binlog events from 79; show binlog events from 79;
......
...@@ -123,7 +123,7 @@ connection master; ...@@ -123,7 +123,7 @@ connection master;
reset master; reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)); unique(day));
--error 1062; --error 1062
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines; '\n##\n' starting by '>' ignore 1 lines;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment