mysqltest improvements, updates after merge + test for 5.0

parent 61be2a14
...@@ -837,9 +837,9 @@ int var_set(const char *var_name, const char *var_name_end, ...@@ -837,9 +837,9 @@ int var_set(const char *var_name, const char *var_name_end,
int open_file(const char *name) int open_file(const char *name)
{ {
char buff[FN_REFLEN];
DBUG_ENTER("open_file"); DBUG_ENTER("open_file");
DBUG_PRINT("enter", ("name: %s", name)); DBUG_PRINT("enter", ("name: %s", name));
char buff[FN_REFLEN];
if (!test_if_hard_path(name)) if (!test_if_hard_path(name))
{ {
strxmov(buff, opt_basedir, name, NullS); strxmov(buff, opt_basedir, name, NullS);
...@@ -868,9 +868,9 @@ int open_file(const char *name) ...@@ -868,9 +868,9 @@ int open_file(const char *name)
int check_eol_junk(const char *eol) int check_eol_junk(const char *eol)
{ {
const char *p= eol;
DBUG_ENTER("check_eol_junk"); DBUG_ENTER("check_eol_junk");
DBUG_PRINT("enter", ("eol: %s", eol)); DBUG_PRINT("enter", ("eol: %s", eol));
const char *p= eol;
/* Remove all spacing chars except new line */ /* Remove all spacing chars except new line */
while (*p && my_isspace(charset_info, *p) && (*p != '\n')) while (*p && my_isspace(charset_info, *p) && (*p != '\n'))
p++; p++;
...@@ -1665,7 +1665,7 @@ static uint get_errcodes(match_err *to,struct st_query *q) ...@@ -1665,7 +1665,7 @@ static uint get_errcodes(match_err *to,struct st_query *q)
} }
} }
if (!e->name) if (!e->name)
die("Unknown SQL error '%s'\n", start); die("Unknown SQL error '%s'", start);
} }
else else
{ {
...@@ -2089,7 +2089,7 @@ int connect_n_handle_errors(struct st_query *q, MYSQL* con, const char* host, ...@@ -2089,7 +2089,7 @@ int connect_n_handle_errors(struct st_query *q, MYSQL* con, const char* host,
if (record) if (record)
{ {
if (!q->record_file[0] && !result_file) if (!q->record_file[0] && !result_file)
die("At line %u: Missing result file", start_lineno); die("Missing result file");
if (!result_file) if (!result_file)
str_to_file(q->record_file, ds->str, ds->length); str_to_file(q->record_file, ds->str, ds->length);
} }
...@@ -2235,7 +2235,7 @@ int do_block(enum block_cmd cmd, struct st_query* q) ...@@ -2235,7 +2235,7 @@ int do_block(enum block_cmd cmd, struct st_query* q)
char *p= q->first_argument; char *p= q->first_argument;
const char *expr_start, *expr_end; const char *expr_start, *expr_end;
VAR v; VAR v;
const char *cmd_name= (cmd == Q_WHILE ? "while" : "if"); const char *cmd_name= (cmd == cmd_while ? "while" : "if");
/* Check stack overflow */ /* Check stack overflow */
if (cur_block == block_stack_end) if (cur_block == block_stack_end)
...@@ -3092,7 +3092,7 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags) ...@@ -3092,7 +3092,7 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags)
warn_res= mysql_store_result(mysql); warn_res= mysql_store_result(mysql);
} }
if (!warn_res) if (!warn_res)
verbose_msg("Warning count is %u but didn't get any warnings\n", verbose_msg("Warning count is %u but didn't get any warnings",
count); count);
else else
{ {
...@@ -3183,7 +3183,7 @@ static int normal_handle_error(const char *query, struct st_query *q, ...@@ -3183,7 +3183,7 @@ static int normal_handle_error(const char *query, struct st_query *q,
abort_not_supported_test(); abort_not_supported_test();
if (q->abort_on_error) if (q->abort_on_error)
die("At line %u: query '%s' failed: %d: %s", start_lineno, query, die("query '%s' failed: %d: %s", query,
mysql_errno(mysql), mysql_error(mysql)); mysql_errno(mysql), mysql_error(mysql));
else else
{ {
...@@ -3710,7 +3710,7 @@ static void run_query_stmt_handle_warnings(MYSQL *mysql, DYNAMIC_STRING *ds) ...@@ -3710,7 +3710,7 @@ static void run_query_stmt_handle_warnings(MYSQL *mysql, DYNAMIC_STRING *ds)
{ {
MYSQL_RES *warn_res= mysql_store_result(mysql); MYSQL_RES *warn_res= mysql_store_result(mysql);
if (!warn_res) if (!warn_res)
verbose_msg("Warning count is %u but didn't get any warnings\n", verbose_msg("Warning count is %u but didn't get any warnings",
count); count);
else else
{ {
......
...@@ -684,9 +684,7 @@ set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = ...@@ -684,9 +684,7 @@ set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 =
while v5 < 100000 do while v5 < 100000 do
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1; set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;// end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
#
call p1()// call p1()//
#
v1 v2 v3 * 0.000000000001 v4 * 0.000000000001 v1 v2 v3 * 0.000000000001 v4 * 0.000000000001
1.000000100000 1.999999900000 1.000000100000 1.999999900000 1.000000100000 1.999999900000 1.000000100000 1.999999900000
drop procedure p1; drop procedure p1;
......
...@@ -34,7 +34,7 @@ send flush tables with read lock; ...@@ -34,7 +34,7 @@ send flush tables with read lock;
connection con2; connection con2;
select ((@id := kill_id) - kill_id) from t1; select ((@id := kill_id) - kill_id) from t1;
--sleep 2; # leave time for FLUSH to block --sleep 2 # leave time for FLUSH to block
kill connection @id; kill connection @id;
connection con1; connection con1;
......
...@@ -47,7 +47,7 @@ select get_lock("a", 10); ...@@ -47,7 +47,7 @@ select get_lock("a", 10);
connection con2; connection con2;
let $ID= `select connection_id()`; let $ID= `select connection_id()`;
send select get_lock("a", 10); send select get_lock("a", 10);
--real_sleep 2; real_sleep 2;
connection con1; connection con1;
disable_query_log; disable_query_log;
eval kill query $ID; eval kill query $ID;
......
...@@ -140,7 +140,7 @@ select * from t2; ...@@ -140,7 +140,7 @@ select * from t2;
alter table t2 drop key day; alter table t2 drop key day;
connection master; connection master;
delete from t2; delete from t2;
--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;
......
...@@ -27,7 +27,7 @@ drop function if exists fn1; ...@@ -27,7 +27,7 @@ drop function if exists fn1;
--enable_warnings --enable_warnings
delimiter |; delimiter |;
--error 1418; # not deterministic --error 1418 # not deterministic
create procedure foo() create procedure foo()
begin begin
declare b int; declare b int;
...@@ -85,7 +85,7 @@ call foo2(); ...@@ -85,7 +85,7 @@ call foo2();
--replace_column 2 # 5 # --replace_column 2 # 5 #
show binlog events from 605; show binlog events from 605;
--error 1418; --error 1418
alter procedure foo2 contains sql; alter procedure foo2 contains sql;
# SP with definer's right # SP with definer's right
...@@ -106,7 +106,7 @@ grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1; ...@@ -106,7 +106,7 @@ grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,); connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,);
connection con1; connection con1;
--error 1419; # only full-global-privs user can create a routine --error 1419 # only full-global-privs user can create a routine
create procedure foo4() create procedure foo4()
deterministic deterministic
insert into t1 values (10); insert into t1 values (10);
...@@ -127,7 +127,7 @@ delimiter ;| ...@@ -127,7 +127,7 @@ delimiter ;|
# I add ,0 so that it does not print the error in the test output, # I add ,0 so that it does not print the error in the test output,
# because this error is hostname-dependent # because this error is hostname-dependent
--error 1142,0; --error 1142,0
call foo4(); # invoker has no INSERT grant on table => failure call foo4(); # invoker has no INSERT grant on table => failure
show warnings; show warnings;
...@@ -136,7 +136,7 @@ call foo3(); # success (definer == root) ...@@ -136,7 +136,7 @@ call foo3(); # success (definer == root)
show warnings; show warnings;
--replace_result localhost.localdomain localhost 127.0.0.1 localhost --replace_result localhost.localdomain localhost 127.0.0.1 localhost
--error 1142,0; --error 1142,0
call foo4(); # definer's rights => failure call foo4(); # definer's rights => failure
show warnings; show warnings;
...@@ -226,7 +226,7 @@ select * from mysql.proc where db='mysqltest1'; ...@@ -226,7 +226,7 @@ select * from mysql.proc where db='mysqltest1';
# And now triggers # And now triggers
connection con1; connection con1;
--error 1227; --error 1227
create trigger trg before insert on t1 for each row set new.a= 10; create trigger trg before insert on t1 for each row set new.a= 10;
connection master; connection master;
......
...@@ -315,7 +315,7 @@ INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME)); ...@@ -315,7 +315,7 @@ INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
## Test INSERT with CAST AS DATETIME into TIMESTAMP ## Test INSERT with CAST AS DATETIME into TIMESTAMP
# All test cases expected to fail should return # All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value> # SQLSTATE 22007 <invalid datetime value>
!$1292 --error 1292
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-- should return OK -- should return OK
-- We accept this to be a failure -- We accept this to be a failure
...@@ -406,7 +406,7 @@ INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME)); ...@@ -406,7 +406,7 @@ INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
## Test INSERT with CONVERT to DATETIME into DATETIME ## Test INSERT with CONVERT to DATETIME into DATETIME
# All test cases expected to fail should return # All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value> # SQLSTATE 22007 <invalid datetime value>
!$1292 --error 1292
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-- should return OK -- should return OK
-- We accept this to be a failure -- We accept this to be a failure
......
...@@ -494,7 +494,7 @@ select 0.8 = 0.7 + 0.1; ...@@ -494,7 +494,7 @@ select 0.8 = 0.7 + 0.1;
# #
#drop procedure p1; #drop procedure p1;
# #
delimiter // delimiter //;
# #
create procedure p1 () begin create procedure p1 () begin
declare v1, v2, v3, v4 decimal(16,12); declare v5 int; declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
......
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