Commit 67951fde authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Fix error messages

mysqltest now also writes failed error messages to log
parent 2ac4ad69
This diff is collapsed.
......@@ -113,7 +113,7 @@ static int block_stack[BLOCK_STACK_DEPTH];
static int block_ok_stack[BLOCK_STACK_DEPTH];
static uint global_expected_errno[MAX_EXPECTED_ERRORS];
static uint global_expected_errno[MAX_EXPECTED_ERRORS], global_expected_errors;
DYNAMIC_ARRAY q_lines;
......@@ -194,6 +194,7 @@ struct st_query
int first_word_len;
my_bool abort_on_error, require_file;
uint expected_errno[MAX_EXPECTED_ERRORS];
uint expected_errors;
char record_file[FN_REFLEN];
enum enum_commands type;
};
......@@ -1011,10 +1012,11 @@ static void get_file_name(char *filename, struct st_query* q)
}
static void get_ints(uint *to,struct st_query* q)
static uint get_ints(uint *to,struct st_query* q)
{
char* p=q->first_argument;
long val;
uint count=0;
DBUG_ENTER("get_ints");
if (!*p)
......@@ -1022,12 +1024,13 @@ static void get_ints(uint *to,struct st_query* q)
for (; (p=str2int(p,10,(long) INT_MIN, (long) INT_MAX, &val)) ; p++)
{
count++;
*to++= (uint) val;
if (*p != ',')
break;
}
*to++=0; /* End of data */
DBUG_VOID_RETURN;
DBUG_RETURN(count);
}
/*
......@@ -1583,8 +1586,11 @@ int read_query(struct st_query** q_ptr)
q->first_word_len = 0;
memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
sizeof(global_expected_errno));
q->expected_errors=global_expected_errors;
q->abort_on_error = global_expected_errno[0] == 0;
bzero((gptr) global_expected_errno,sizeof(global_expected_errno));
global_expected_errors=0;
q->type = Q_UNKNOWN;
q->query_buf=q->query=0;
if (read_line(read_query_buf, sizeof(read_query_buf)))
......@@ -1613,6 +1619,7 @@ int read_query(struct st_query** q_ptr)
expected_errno = expected_errno * 10 + *p - '0';
q->expected_errno[0] = expected_errno;
q->expected_errno[1] = 0;
q->expected_errors=1;
}
}
......@@ -1962,28 +1969,33 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
mysql_errno(mysql), mysql_error(mysql));
else
{
for (i=0 ; q->expected_errno[i] ; i++)
for (i=0 ; (uint) i < q->expected_errors ; i++)
{
if ((q->expected_errno[i] == mysql_errno(mysql)))
{
if (i == 0 && q->expected_errno[1] == 0)
if (i == 0 && q->expected_errors == 1)
{
/* Only log error if there is one possible error */
dynstr_append(ds,mysql_error(mysql));
dynstr_append_mem(ds,"\n",1);
}
else
/* Don't log error if we may not get an error */
else if (q->expected_errno[0] != 0)
dynstr_append(ds,"Got one of the listed errors\n");
goto end; /* Ok */
}
}
if (i)
{
dynstr_append(ds,mysql_error(mysql));
dynstr_append_mem(ds,"\n",1);
verbose_msg("query '%s' failed with wrong errno %d instead of %d...",
q->query, mysql_errno(mysql), q->expected_errno[0]);
error=1;
goto end;
}
dynstr_append(ds,mysql_error(mysql));
dynstr_append_mem(ds,"\n",1);
verbose_msg("query '%s' failed: %d: %s", q->query, mysql_errno(mysql),
mysql_error(mysql));
/*
......@@ -2262,7 +2274,7 @@ int main(int argc, char** argv)
case Q_EVAL_RESULT: eval_result = 1; break;
case Q_EVAL:
if (q->query == q->query_buf)
q->query += q->first_word_len;
q->query= q->first_argument;
/* fall through */
case Q_QUERY:
case Q_REAP:
......@@ -2308,7 +2320,7 @@ int main(int argc, char** argv)
require_file=0;
break;
case Q_ERROR:
get_ints(global_expected_errno,q);
global_expected_errors=get_ints(global_expected_errno,q);
break;
case Q_REQUIRE:
get_file_name(save_file,q);
......
......@@ -3,6 +3,7 @@ connect (master1,localhost,root,,test,0,master.sock);
connect (slave,localhost,root,,test,0,slave.sock);
connect (slave1,localhost,root,,test,0,slave.sock);
connection slave;
--error 0,1199
!slave stop;
@r/slave-stopped.result show status like 'Slave_running';
connection master;
......
......@@ -92,16 +92,16 @@ key (n2, n3, n4, n1),
key (n3, n4, n1, n2),
key (n4, n1, n2, n3) );
alter table t1 disable keys;
insert into t1 values(10,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(9,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(8,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(7,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(6,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(5,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(4,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(3,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(2,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(1,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(10,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(9,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(8,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(7,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(6,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(5,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(4,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(3,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(2,RAND()*1000,RAND()*1000,RAND());
insert into t1 values(1,RAND()*1000,RAND()*1000,RAND());
alter table t1 enable keys;
drop table t1;
create table t1 (i int unsigned not null auto_increment primary key);
......
......@@ -7,7 +7,7 @@ use test;
drop table if exists t1,t3;
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1;
load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
select * from t1;
word
Aarhus
......@@ -47,16 +47,16 @@ reset master;
reset slave;
drop table if exists t1,t2;
create table t1(n int);
insert into t1 values(10);
insert into t1 values(9);
insert into t1 values(8);
insert into t1 values(7);
insert into t1 values(6);
insert into t1 values(5);
insert into t1 values(4);
insert into t1 values(3);
insert into t1 values(2);
insert into t1 values(1);
insert into t1 values(10);
insert into t1 values(9);
insert into t1 values(8);
insert into t1 values(7);
insert into t1 values(6);
insert into t1 values(5);
insert into t1 values(4);
insert into t1 values(3);
insert into t1 values(2);
insert into t1 values(1);
create table t2(id int);
insert into t2 values(connection_id());
create temporary table t1_temp(n int);
......
......@@ -6,6 +6,7 @@ slave start;
drop table if exists t1;
create table t1(n int primary key);
insert into t1 values (1),(2),(2);
Duplicate entry '2' for key 1
insert into t1 values (3);
select * from t1;
n
......
......@@ -10,7 +10,7 @@ change master to master_host='127.0.0.1';
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 test 9998 60 4 No 0 0 0
change master to master_host='127.0.0.1',master_user='root',
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
......
slave start;
Could not initialize master info structure, check permisions on master.info
slave start;
change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
Could not initialize master info structure, check permisions on master.info
change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
master_user='root';
Could not initialize master info
reset slave;
change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
master_user='root';
reset master;
slave start;
......@@ -57,12 +60,12 @@ master-bin.005
master-bin.006
show master status;
File Position Binlog_do_db Binlog_ignore_db
master-bin.006 720
master-bin.006 710
slave stop;
slave start;
show slave status;
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Last_log_seq
127.0.0.1 root 9999 60 master-bin.006 720 Yes 0 0 11
127.0.0.1 root 9999 60 master-bin.006 710 Yes 0 0 11
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
......
......@@ -28,13 +28,13 @@ drop database foo;
# test drop/create database and FLUSH TABLES WITH READ LOCK
drop database if exists foo;
flush tables with read lock;
--error 1209,1219;
--error 1209,1223;
create database foo;
unlock tables;
create database foo;
show databases;
flush tables with read lock;
--error 1208,1219;
--error 1208,1223;
drop database foo;
unlock tables;
drop database foo;
......
......@@ -22,25 +22,25 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
# Test some error conditions with UNION
explain select a,b from t1 union all select a,b from t2;
--error 1217
--error 1221
select a,b from t1 into outfile 'skr' union select a,b from t2;
--error 1217
--error 1221
select a,b from t1 order by a union select a,b from t2;
--error 1217
--error 1221
insert into t3 select a from t1 order by a union select a from t2;
--error 1218
--error 1222
create table t3 select a,b from t1 union select a from t2;
--error 1218
--error 1222
select a,b from t1 union select a from t2;
--error 1218
--error 1222
select * from t1 union select a from t2;
--error 1218
--error 1222
select a from t1 union select * from t2;
# Test CREATE, INSERT and REPLACE
......
......@@ -236,4 +236,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -230,4 +230,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -227,4 +227,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -227,4 +227,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -230,4 +230,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"Der verwendete Tabellentyp unterstützt keine FULLTEXT-Indexe",
......@@ -227,4 +227,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -229,4 +229,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -227,4 +227,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -229,4 +229,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -227,4 +227,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -229,4 +229,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -229,4 +229,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -231,4 +231,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -227,4 +227,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -231,4 +231,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -235,4 +235,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -228,4 +228,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
"The used table type doesn't support FULLTEXT indexes",
......@@ -227,4 +227,3 @@
"Kan inte utföra kommandot emedan du har ett READ lås",
"Blandning av transaktionella och icke-transaktionella tabeller är inaktiverat",
"Option '%s' användes två gånger",
"The used table type doesn't support FULLTEXT indexes",
......@@ -220,7 +220,7 @@
" %-.32s@%-.64s ަ",
"Incorrect table definition; All MERGE tables must be in the same database",
"Deadlock found when trying to get lock; Try restarting transaction",
"The used table type doesn't support FULLTEXT indexes",
" æ Цդ FULLTEXT Ӧ",
"Cannot add foreign key constraint",
"Cannot add a child row: a foreign key constraint fails",
"Cannot delete a parent row: a foreign key constraint fails",
......@@ -232,4 +232,3 @@
"Can't execute the query because you have a conflicting read lock",
"Mixing of transactional and non-transactional tables is disabled",
"Option '%s' used twice in statement",
" æ Цդ FULLTEXT Ӧ",
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