Commit 12d0f179 authored by monty@donna.mysql.com's avatar monty@donna.mysql.com
Browse files

Fixes for mysqltest

parent 432adefd
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -19317,10 +19317,11 @@ new @code{INSERT DELAYED} commands are received within
@code{delayed_insert_timeout} seconds, the handler terminates.
@item
If more than @code{delayed_queue_size} rows are pending already in a specific
handler queue, the thread waits until there is room in the queue.  This is
useful to ensure that the @code{mysqld} server doesn't use all memory for the
delayed memory queue.
If more than @code{delayed_queue_size} rows are pending already in a
specific handler queue, the thread requesting @code{INSERT DELAYED}
waits until there is room in the queue.  This is done to ensure that
the @code{mysqld} server doesn't use all memory for the delayed memory
queue.
@item
The handler thread will show up in the @strong{MySQL} process list
+36 −18
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@

**********************************************************************/

#define MTEST_VERSION "1.5"
#define MTEST_VERSION "1.6"

#include <global.h>
#include <my_sys.h>
@@ -71,23 +71,24 @@
#define MIN_VAR_ALLOC	  32
#define BLOCK_STACK_DEPTH  32

int record = 0, verbose = 0, silent = 0, opt_sleep=0;
static int record = 0, verbose = 0, silent = 0, opt_sleep=0;
static char *db = 0, *pass=0;
const char* user = 0, *host = 0, *unix_sock = 0;
int port = 0;
static int port = 0;
static uint start_lineno, *lineno;

static char **default_argv;
static const char *load_default_groups[]= { "mysqltest","client",0 };

FILE* file_stack[MAX_INCLUDE_DEPTH];
FILE** cur_file;
FILE** file_stack_end;
uint lineno_stack[MAX_INCLUDE_DEPTH];
char TMPDIR[FN_REFLEN];
static FILE* file_stack[MAX_INCLUDE_DEPTH];
static FILE** cur_file;
static FILE** file_stack_end;
static uint lineno_stack[MAX_INCLUDE_DEPTH];
static char TMPDIR[FN_REFLEN];

int block_stack[BLOCK_STACK_DEPTH];
int *cur_block, *block_stack_end;
static int block_stack[BLOCK_STACK_DEPTH];
static int *cur_block, *block_stack_end;
static uint global_expected_errno=0;

DYNAMIC_ARRAY q_lines;

@@ -137,13 +138,13 @@ struct st_query
  enum { Q_CONNECTION=1, Q_QUERY, Q_CONNECT,
	 Q_SLEEP, Q_INC, Q_DEC,Q_SOURCE,
	 Q_DISCONNECT,Q_LET, Q_ECHO, Q_WHILE, Q_END_BLOCK,
	 Q_SYSTEM, Q_RESULT, Q_REQUIRE,
	 Q_SYSTEM, Q_RESULT, Q_REQUIRE, Q_ERROR,
	 Q_UNKNOWN, Q_COMMENT, Q_COMMENT_WITH_COMMAND} type;
};

const char *command_names[] = {
"connection", "query","connect","sleep","inc","dec","source","disconnect",
"let","echo","while","end","system","result", "require",0
"let","echo","while","end","system","result", "require","error",0
};

TYPELIB command_typelib= {array_elements(command_names),"",
@@ -541,6 +542,20 @@ static void get_file_name(char *filename, struct st_query* q)
}


static int get_int(struct st_query* q)
{
  char* p=q->first_argument;
  int res;
  DBUG_ENTER("get_int");
  while (*p && isspace(*p)) p++;
  if (!*p)
    die("Missing argument in %s\n", q->query);
  res=atoi(p);
  DBUG_PRINT("result",("res: %d",res));
  DBUG_RETURN(res);
}


int select_connection(struct st_query* q)
{
  char* p=q->first_argument, *name;
@@ -896,16 +911,16 @@ int read_query(struct st_query** q_ptr)
    get_dynamic(&q_lines, (gptr) q_ptr, parser.current_line) ;
    return 0;
  }
  if (!(*q_ptr=q=(struct st_query*) my_malloc(sizeof(*q), MYF(MY_WME)))
     || insert_dynamic(&q_lines, (gptr) &q)
     )
    die("Out of memory");
  if (!(*q_ptr=q=(struct st_query*) my_malloc(sizeof(*q), MYF(MY_WME))) ||
      insert_dynamic(&q_lines, (gptr) &q))
    die(NullS);

  q->record_file[0] = 0;
  q->require_file=0;
  q->abort_on_error = 1;
  q->first_word_len = 0;
  q->expected_errno = 0;
  q->expected_errno = global_expected_errno;
  q->abort_on_error = global_expected_errno == 0;
  global_expected_errno=0;
  q->type = Q_UNKNOWN;
  q->query=0;
  if (read_line(read_query_buf, sizeof(read_query_buf)))
@@ -1357,6 +1372,9 @@ int main(int argc, char** argv)
	get_file_name(save_file,q);
	require_file=0;
	break;
      case Q_ERROR:
	global_expected_errno=get_int(q);
	break;
      case Q_REQUIRE:
	get_file_name(save_file,q);
	require_file=1;
+8 −2
Original line number Diff line number Diff line
@@ -588,11 +588,17 @@ run_testcase ()
	if [ x$FORCE != x1 ] ; then
	 $ECHO "Aborting. To continue, re-run with '--force'."
	 $ECHO
         if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
	 then
	   mysql_stop
   	 fi
	 exit 1
	fi
	 
        if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
	then
	  mysql_restart
	fi
	$ECHO "Resuming Tests"
	$ECHO ""
      else
+8 −4
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),
update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102;
update t1 set id=id+1000;
!$1062 update t1 set id=1024 where id=1009; 
-- error 1062
update t1 set id=1024 where id=1009; 
select * from t1;
update ignore t1 set id=id+1; # This will change all rows
select * from t1;
@@ -100,12 +101,14 @@ commit;
select n, "after commit" from t1;
commit;
insert into t1 values (5);
!$1062 insert into t1 values (4);
-- error 1062
insert into t1 values (4);
commit;
select n, "after commit" from t1;
set autocommit=1;
insert into t1 values (6);
!$1062 insert into t1 values (4);
-- error 1062
insert into t1 values (4);
select n from t1;
# nop
rollback;
@@ -135,7 +138,8 @@ drop table t1;

CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=bdb;
insert into t1 values ('pippo', 12);
!$1062 insert into t1 values ('pippo', 12); # Gives error
-- error 1062
insert into t1 values ('pippo', 12); # Gives error
delete from t1;
delete from t1 where id = 'pippo';
select * from t1;
+0 −1
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ int my_chsize(File fd, my_off_t newlength, myf MyFlags)
#endif
    /* Full file with 0 until it's as big as requested */
    bzero(buff,IO_SIZE);
    my_seek(fd, old_length, MY_SEEK_SET, MYF(MY_WME+MY_FAE));
    while (newlength-oldsize > IO_SIZE)
    {
      if (my_write(fd,(byte*) buff,IO_SIZE,MYF(MY_NABP)))
Loading