Commit 637232d9 authored by unknown's avatar unknown
Browse files

Fix tests after merge

Straighten out and comment behaviour for --require and --result in run_query


client/mysqltest.c:
   If --require or --result has been provided for a query command->record_file file be set.
  In that case it should either dump to file if recording or check with content in file if running.
mysql-test/r/mysqltest.result:
  Fix up tests and results after merge
mysql-test/t/mysqltest.test:
  Fix up tests and results after merge
parent 6576b384
Loading
Loading
Loading
Loading
+18 −14
Original line number Diff line number Diff line
@@ -3925,23 +3925,27 @@ 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])
    /* 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);
  if (ds == &ds_result)
+7 −8
Original line number Diff line number Diff line
@@ -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;
+9 −9
Original line number Diff line number Diff line
@@ -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
@@ -1021,8 +1020,9 @@ drop table t1;
--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;