Bug #11754855 46528: NEED A WAY TO PASS A VARIABLE TO MTR COMMANDS

modified function do_get_error in mysqltest.cc to handle multiple variable passed
added test case to mysqltest.test to verify handling to multiple errors passed
parent 3babc75e
...@@ -4839,6 +4839,7 @@ void do_get_errcodes(struct st_command *command) ...@@ -4839,6 +4839,7 @@ void do_get_errcodes(struct st_command *command)
struct st_match_err *to= saved_expected_errors.err; struct st_match_err *to= saved_expected_errors.err;
char *p= command->first_argument; char *p= command->first_argument;
uint count= 0; uint count= 0;
char *next;
DBUG_ENTER("do_get_errcodes"); DBUG_ENTER("do_get_errcodes");
...@@ -4858,6 +4859,17 @@ void do_get_errcodes(struct st_command *command) ...@@ -4858,6 +4859,17 @@ void do_get_errcodes(struct st_command *command)
while (*end && *end != ',' && *end != ' ') while (*end && *end != ',' && *end != ' ')
end++; end++;
next=end;
/* code to handle variables passed to mysqltest */
if( *p == '$')
{
const char* fin;
VAR *var = var_get(p,&fin,0,0);
p=var->str_val;
end=p+var->str_val_len;
}
if (*p == 'S') if (*p == 'S')
{ {
char *to_ptr= to->code.sqlstate; char *to_ptr= to->code.sqlstate;
...@@ -4932,7 +4944,7 @@ void do_get_errcodes(struct st_command *command) ...@@ -4932,7 +4944,7 @@ void do_get_errcodes(struct st_command *command)
die("Too many errorcodes specified"); die("Too many errorcodes specified");
/* Set pointer to the end of the last error code */ /* Set pointer to the end of the last error code */
p= end; p= next;
/* Find next ',' */ /* Find next ',' */
while (*p && *p != ',') while (*p && *p != ',')
......
...@@ -662,6 +662,17 @@ a D ...@@ -662,6 +662,17 @@ a D
1 1 1 1
1 4 1 4
drop table t1; drop table t1;
create table t2 ( a char(10));
garbage;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
garbage;
Got one of the listed errors
garbage;
Got one of the listed errors
insert into t1 values ("Abcd");
Got one of the listed errors
garbage;
drop table t2;
create table t1 ( f1 char(10)); create table t1 ( f1 char(10));
insert into t1 values ("Abcd"); insert into t1 values ("Abcd");
select * from t1; select * from t1;
......
...@@ -2065,6 +2065,31 @@ insert into t1 values (2,4); ...@@ -2065,6 +2065,31 @@ insert into t1 values (2,4);
select * from t1; select * from t1;
drop table t1; drop table t1;
#-------------------------------------------------------------------------
# BUG #11754855 : Passing variable to --error
#-------------------------------------------------------------------------
create table t2 ( a char(10));
let $errno1=0;
let $errno2=ER_PARSE_ERROR;
let $errno3=ER_NO_SUCH_TABLE;
--error $errno2
garbage;
--error $errno2,$errno3
garbage;
--error $errno2,ER_NO_SUCH_TABLE
garbage;
--error ER_NO_SUCH_TABLE,$errno2
insert into t1 values ("Abcd");
--error $errno1,ER_PARSE_ERROR
garbage;
drop table t2;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Tests of send # Tests of send
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
......
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