Fix tests after merge

Straighten out and comment behaviour for --require and --result in run_query
parent 2dbb3bc2
......@@ -3925,22 +3925,26 @@ static void run_query(MYSQL *mysql, struct st_query *command, int flags)
mysql_errno(mysql), mysql_error(mysql));
}
if (record)
if (command->record_file[0])
{
/* Recording in progress */
if (!command->record_file[0])
die("Missing result file");
/* Dump the output from _this_ query to the specified record_file */
str_to_file(command->record_file, ds->str, ds->length);
}
else if (command->record_file[0])
{
/*
The output from _this_ query should be checked against an already
existing file which has been specified using --require or --result
*/
check_result(ds, command->record_file, command->require_file);
/* A result file was specified for _this_ query */
if (record)
{
/*
Recording in progress
Dump the output from _this_ query to the specified record_file
*/
str_to_file(command->record_file, ds->str, ds->length);
} else {
/*
The output from _this_ query should be checked against an already
existing file which has been specified using --require or --result
*/
check_result(ds, command->record_file, command->require_file);
}
}
dynstr_free(&ds_warnings);
......
......@@ -396,20 +396,20 @@ root@localhost
--------------------------------------------------------------------------------
this will be executed
this will be executed
mysqltest: Result length mismatch
mysqltest: The test didn't produce any output
Failing multi statement query
mysqltest: At line 3: query 'create table t1 (a int primary key);
insert into t1 values (1);
select 'select-me';
insertz 'error query'' failed: 1064: 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 'insertz 'error query'' at line 1
drop table t1;
drop table t1;
create table t1 (a int primary key);
mysqltest: At line 3: query 'create table t1 (a int primary key);
insert into t1 values (1);
select 'select-me';
insertz error query||||
select-me
select-me
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 'insertz error query' at line 1
insertz 'error query'' failed: 1064: 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 'insertz 'error query'' at line 1
drop table t1;
Multi statement using expected error
create table t1 (a int primary key);
insert into t1 values (1);
select 'select-me';
......@@ -418,5 +418,4 @@ select-me
select-me
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 'insertz error query' at line 1
drop table t1;
mysqltest: Result length mismatch
mysqltest: The test didn't produce any output
drop table t1;
......@@ -984,7 +984,7 @@ select "this will be executed";
# non-1st queries
#
# Failing multi statement query
echo Failing multi statement query;
# PS does not support multi statement
--exec echo "--disable_ps_protocol" > var/tmp/bug11731.sql
--exec echo "delimiter ||||;" >> var/tmp/bug11731.sql
......@@ -999,14 +999,13 @@ select "this will be executed";
drop table t1;
--error 1
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out
# The .out file should be empty, cat will fail!
--error 1
--exec cat $MYSQL_TEST_DIR/var/tmp/bug11731.out
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out 2>&1
# The .out file should be non existent
--exec test ! -e $MYSQL_TEST_DIR/var/tmp/bug11731.out
drop table t1;
# Using expected error
echo Multi statement using expected error;
# PS does not support multi statement
--exec echo "--disable_ps_protocol" > var/tmp/bug11731.sql
--exec echo "delimiter ||||;" >> var/tmp/bug11731.sql
......@@ -1018,11 +1017,12 @@ drop table t1;
--exec echo "delimiter ;||||" >> var/tmp/bug11731.sql
# These two should work since the error is expected
--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql 2>&1
--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql 2>&1
drop table t1;
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out
--exec cat $MYSQL_TEST_DIR/var/tmp/bug11731.out
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out 2>&1
# The .out file should exist
--exec test -s $MYSQL_TEST_DIR/var/tmp/bug11731.out
drop table t1;
......
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