3582 sayantan.dutta@stripped 2011-10-19
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
modified:
client/mysqltest.cc
mysql-test/r/mysqltest.result
mysql-test/t/mysqltest.test
3581 Nirbhay Choubey 2011-10-18 [merge]
Merge of fix for bug#13102538 from mysql-5.1.
modified:
cmd-line-utils/libedit/np/strlcat.c
cmd-line-utils/libedit/np/strlcpy.c
cmd-line-utils/libedit/np/unvis.c
cmd-line-utils/libedit/np/vis.c
cmd-line-utils/libedit/np/vis.h
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc 2011-09-30 13:25:19 +0000
+++ b/client/mysqltest.cc 2011-10-19 07:23:52 +0000
@@ -4839,6 +4839,7 @@ void do_get_errcodes(struct st_command *
struct st_match_err *to= saved_expected_errors.err;
char *p= command->first_argument;
uint count= 0;
+ char *next;
DBUG_ENTER("do_get_errcodes");
@@ -4858,6 +4859,17 @@ void do_get_errcodes(struct st_command *
while (*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')
{
char *to_ptr= to->code.sqlstate;
@@ -4932,7 +4944,7 @@ void do_get_errcodes(struct st_command *
die("Too many errorcodes specified");
/* Set pointer to the end of the last error code */
- p= end;
+ p= next;
/* Find next ',' */
while (*p && *p != ',')
=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result 2011-09-15 11:09:24 +0000
+++ b/mysql-test/r/mysqltest.result 2011-10-19 07:23:52 +0000
@@ -662,6 +662,17 @@ a D
1 1
1 4
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));
insert into t1 values ("Abcd");
select * from t1;
=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test 2011-09-15 11:09:24 +0000
+++ b/mysql-test/t/mysqltest.test 2011-10-19 07:23:52 +0000
@@ -2065,6 +2065,31 @@ insert into t1 values (2,4);
select * from 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
# ----------------------------------------------------------------------------
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5 branch (sayantan.dutta:3581 to 3582) Bug#11754855 | sayantan.dutta | 19 Oct |