Commit 7541a877 authored by monty@donna.mysql.com's avatar monty@donna.mysql.com

Fixes to get mysql-test-run more portable

parent ff0e2e2d
...@@ -15430,6 +15430,8 @@ mysql> select 'new*\n*line' REGEXP 'new\\*.\\*line'; ...@@ -15430,6 +15430,8 @@ mysql> select 'new*\n*line' REGEXP 'new\\*.\\*line';
-> 1 -> 1
mysql> select "a" REGEXP "A", "a" REGEXP BINARY "A"; mysql> select "a" REGEXP "A", "a" REGEXP BINARY "A";
-> 1 0 -> 1 0
mysql> select "a" REGEXP "^[a-d]";
-> 1
@end example @end example
@item @item
...@@ -15495,6 +15497,16 @@ Note that in some context @strong{MySQL} will not be able to use the ...@@ -15495,6 +15497,16 @@ Note that in some context @strong{MySQL} will not be able to use the
index efficiently when you cast an indexed column to @code{BINARY}. index efficiently when you cast an indexed column to @code{BINARY}.
@end table @end table
If you want to compare a blob case-insensitively you can always convert
the blob to upper case before doing the comparison:
@example
SELECT 'A' LIKE UPPER(blob_col) FROM table_name;
@end example
We plan to soon introduce casting between different character sets to
make string comparison even more flexible.
@findex control flow functions @findex control flow functions
@findex functions, control flow @findex functions, control flow
@node Control flow functions, Mathematical functions, Casts, Functions @node Control flow functions, Mathematical functions, Casts, Functions
...@@ -18719,6 +18731,10 @@ name of the column in the @code{ORDER BY} clause that you are sorting by. ...@@ -18719,6 +18731,10 @@ name of the column in the @code{ORDER BY} clause that you are sorting by.
The default is ascending order; this may be specified explicitly using The default is ascending order; this may be specified explicitly using
the @code{ASC} keyword. the @code{ASC} keyword.
@item
You can in the @code{WHERE} clause use any of the functions that
@strong{MySQL} support. @xref{Functions}.
@item @item
The @code{HAVING} clause can refer to any column or alias named in the The @code{HAVING} clause can refer to any column or alias named in the
@code{select_expression}. It is applied last, just before items are sent to @code{select_expression}. It is applied last, just before items are sent to
...@@ -18815,6 +18831,13 @@ cannot already exist (among other things, this prevents database tables and ...@@ -18815,6 +18831,13 @@ cannot already exist (among other things, this prevents database tables and
files such as @file{/etc/passwd} from being destroyed). You must have the files such as @file{/etc/passwd} from being destroyed). You must have the
@strong{file} privilege on the server host to use this form of @code{SELECT}. @strong{file} privilege on the server host to use this form of @code{SELECT}.
@code{SELECT ... INTO OUTFILE} is mainly intended to let you very
quickly dump a table on the server machine. If you want to create the
resulting file on some other host than the server host you can't use
@code{SELECT ... INTO OUTFILE}. In this case you should instead use some
client program like @code{mysqldump --tab} or @code{mysql -e "SELECT
..." > outfile} to generate the file.
@code{SELECT ... INTO OUTFILE} is the complement of @code{LOAD DATA @code{SELECT ... INTO OUTFILE} is the complement of @code{LOAD DATA
INFILE}; the syntax for the @code{export_options} part of the statement INFILE}; the syntax for the @code{export_options} part of the statement
consists of the same @code{FIELDS} and @code{LINES} clauses that are used consists of the same @code{FIELDS} and @code{LINES} clauses that are used
...@@ -18835,19 +18858,29 @@ Additionally, @code{ASCII 0} is converted to @code{ESCAPED BY} followed by 0 ...@@ -18835,19 +18858,29 @@ Additionally, @code{ASCII 0} is converted to @code{ESCAPED BY} followed by 0
The reason for the above is that you MUST escape any @code{FIELDS The reason for the above is that you MUST escape any @code{FIELDS
TERMINATED BY}, @code{ESCAPED BY}, or @code{LINES TERMINATED BY} TERMINATED BY}, @code{ESCAPED BY}, or @code{LINES TERMINATED BY}
characters to reliably be able to read the file characters to reliably be able to read the file back. @code{ASCII 0} is
back. @code{ASCII 0} is escaped to make it easier to view with some escaped to make it easier to view with some pagers.
pagers.
As the resulting file doesn't have to conform to the SQL syntax, nothing As the resulting file doesn't have to conform to the SQL syntax, nothing
else need be escaped. else need be escaped.
@end itemize
Here follows an example of getting a file in the format used by many
old programs.
@example
SELECT a,b,a+b INTO OUTFILE "/tmp/result.text"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY "\n"
FROM test_table;
@end example
@item
@findex DUMPFILE @findex DUMPFILE
If you use @code{INTO DUMPFILE} instead of @code{INTO OUTFILE}, @strong{MySQL} If you use @code{INTO DUMPFILE} instead of @code{INTO OUTFILE}, @strong{MySQL}
will only write one row into the file, without any column or line will only write one row into the file, without any column or line
terminations and without any escaping. This is useful if you want to terminations and without any escaping. This is useful if you want to
store a blob in a file. store a blob in a file.
@end itemize
@findex JOIN @findex JOIN
@findex INNER JOIN @findex INNER JOIN
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* Monty * Monty
**/ **/
#define MTEST_VERSION "1.2" #define MTEST_VERSION "1.4"
#include "global.h" #include "global.h"
#include "my_sys.h" #include "my_sys.h"
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#define MIN_VAR_ALLOC 32 #define MIN_VAR_ALLOC 32
#define BLOCK_STACK_DEPTH 32 #define BLOCK_STACK_DEPTH 32
int record = 0, verbose = 0, silent = 0; int record = 0, verbose = 0, silent = 0, opt_sleep=0;
static char *db = 0, *pass=0; static char *db = 0, *pass=0;
const char* user = 0, *host = 0, *unix_sock = 0; const char* user = 0, *host = 0, *unix_sock = 0;
int port = 0; int port = 0;
...@@ -62,6 +62,7 @@ FILE* file_stack[MAX_INCLUDE_DEPTH]; ...@@ -62,6 +62,7 @@ FILE* file_stack[MAX_INCLUDE_DEPTH];
FILE** cur_file; FILE** cur_file;
FILE** file_stack_end; FILE** file_stack_end;
uint lineno_stack[MAX_INCLUDE_DEPTH]; uint lineno_stack[MAX_INCLUDE_DEPTH];
char TMPDIR[FN_REFLEN];
int block_stack[BLOCK_STACK_DEPTH]; int block_stack[BLOCK_STACK_DEPTH];
int *cur_block, *block_stack_end; int *cur_block, *block_stack_end;
...@@ -494,16 +495,19 @@ int do_let(struct query* q) ...@@ -494,16 +495,19 @@ int do_let(struct query* q)
int do_sleep(struct query* q) int do_sleep(struct query* q)
{ {
char* p, *arg; char *p;
struct timeval t; struct timeval t;
int dec_mul = 1000000; int dec_mul = 1000000;
p = (char*)q->q + q->first_word_len; p = (char*)q->q + q->first_word_len;
while(*p && isspace(*p)) p++; while(*p && isspace(*p)) p++;
if (!*p) if (!*p)
die("Missing argument in sleep\n"); die("Missing argument in sleep\n");
arg = p;
t.tv_sec = atoi(arg);
t.tv_usec = 0; t.tv_usec = 0;
if (opt_sleep)
t.tv_sec = opt_sleep;
else
{
t.tv_sec = atoi(p);
while(*p && *p != '.' && !isspace(*p)) while(*p && *p != '.' && !isspace(*p))
p++; p++;
if (*p == '.') if (*p == '.')
...@@ -525,7 +529,7 @@ int do_sleep(struct query* q) ...@@ -525,7 +529,7 @@ int do_sleep(struct query* q)
break; break;
} }
} }
*p = 0; }
t.tv_usec *= dec_mul; t.tv_usec *= dec_mul;
return select(0,0,0,0, &t); return select(0,0,0,0, &t);
} }
...@@ -617,6 +621,7 @@ int do_connect(struct query* q) ...@@ -617,6 +621,7 @@ int do_connect(struct query* q)
char* con_name, *con_user,*con_pass, *con_host, *con_port_str, char* con_name, *con_user,*con_pass, *con_host, *con_port_str,
*con_db, *con_sock; *con_db, *con_sock;
char* p; char* p;
char buff[FN_REFLEN];
p = q->q + q->first_word_len; p = q->q + q->first_word_len;
...@@ -636,6 +641,7 @@ int do_connect(struct query* q) ...@@ -636,6 +641,7 @@ int do_connect(struct query* q)
if (!mysql_init(&next_con->mysql)) if (!mysql_init(&next_con->mysql))
die("Failed on mysql_init()"); die("Failed on mysql_init()");
con_sock=fn_format(buff, con_sock, TMPDIR,"",0);
if (!mysql_real_connect(&next_con->mysql, con_host, con_user, con_pass, if (!mysql_real_connect(&next_con->mysql, con_host, con_user, con_pass,
con_db, atoi(con_port_str), con_sock, 0)) con_db, atoi(con_port_str), con_sock, 0))
die("Could not open connection '%s': %s", con_name, die("Could not open connection '%s': %s", con_name,
...@@ -952,19 +958,21 @@ int read_query(struct query** q_ptr) ...@@ -952,19 +958,21 @@ int read_query(struct query** q_ptr)
struct option long_options[] = struct option long_options[] =
{ {
{"verbose", no_argument, 0, 'v'}, {"database", required_argument, 0, 'D'},
{"version", no_argument, 0, 'V'}, {"help", no_argument, 0, '?'},
{"silent", no_argument, 0, 'q'}, {"host", required_argument, 0, 'h'},
{"password", optional_argument, 0, 'p'},
{"port", required_argument, 0, 'P'},
{"quiet", no_argument, 0, 'q'}, {"quiet", no_argument, 0, 'q'},
{"record", no_argument, 0, 'r'}, {"record", no_argument, 0, 'r'},
{"result-file", required_argument, 0, 'R'}, {"result-file", required_argument, 0, 'R'},
{"help", no_argument, 0, '?'}, {"silent", no_argument, 0, 'q'},
{"user", required_argument, 0, 'u'}, {"sleep", required_argument, 0, 'T'},
{"password", optional_argument, 0, 'p'},
{"host", required_argument, 0, 'h'},
{"socket", required_argument, 0, 'S'}, {"socket", required_argument, 0, 'S'},
{"database", required_argument, 0, 'D'}, {"tmpdir", required_argument, 0, 't'},
{"port", required_argument, 0, 'P'}, {"user", required_argument, 0, 'u'},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{0, 0,0,0} {0, 0,0,0}
}; };
...@@ -991,6 +999,8 @@ void usage() ...@@ -991,6 +999,8 @@ void usage()
-D, --database=... Database to use.\n\ -D, --database=... Database to use.\n\
-P, --port=... Port number to use for connection.\n\ -P, --port=... Port number to use for connection.\n\
-S, --socket=... Socket file to use for connection.\n\ -S, --socket=... Socket file to use for connection.\n\
-t, --tmpdir=... Temporary directory where sockets are put\n\
-T, --sleep=# Sleep always this many seconds on sleep commands\n\
-r, --record Record output of test_file into result file.\n\ -r, --record Record output of test_file into result file.\n\
-R, --result-file=... Read/Store result from/in this file.\n\ -R, --result-file=... Read/Store result from/in this file.\n\
-v, --verbose Write more.\n\ -v, --verbose Write more.\n\
...@@ -1006,7 +1016,7 @@ int parse_args(int argc, char **argv) ...@@ -1006,7 +1016,7 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
while((c = getopt_long(argc, argv, "h:p::u:P:D:S:R:?rvVq", while((c = getopt_long(argc, argv, "h:p::u:P:D:S:R:t:T:?rvVq",
long_options, &option_index)) != EOF) long_options, &option_index)) != EOF)
{ {
switch(c) switch(c)
...@@ -1048,6 +1058,12 @@ int parse_args(int argc, char **argv) ...@@ -1048,6 +1058,12 @@ int parse_args(int argc, char **argv)
case 'q': case 'q':
silent = 1; silent = 1;
break; break;
case 't':
strnmov(TMPDIR,optarg,sizeof(TMPDIR));
break;
case 'T':
opt_sleep=atoi(optarg);
break;
case 'V': case 'V':
print_version(); print_version();
exit(0); exit(0);
...@@ -1255,6 +1271,7 @@ int main(int argc, char** argv) ...@@ -1255,6 +1271,7 @@ int main(int argc, char** argv)
my_bool require_file=0; my_bool require_file=0;
char save_file[FN_REFLEN]; char save_file[FN_REFLEN];
save_file[0]=0; save_file[0]=0;
TMPDIR[0]=0;
MY_INIT(argv[0]); MY_INIT(argv[0]);
memset(cons, 0, sizeof(cons)); memset(cons, 0, sizeof(cons));
......
...@@ -19,6 +19,10 @@ You can create your own test cases. To create a test case: ...@@ -19,6 +19,10 @@ You can create your own test cases. To create a test case:
We would appreciate if the test tables were called t1, t2, t3 ... (to not We would appreciate if the test tables were called t1, t2, t3 ... (to not
conflict too much with existing tables). conflict too much with existing tables).
Your test should begin by dropping the tables you are going to create and
end by dropping them again. This will ensure that one can run the test
over and over again.
If you are using mysqltest commands (like result file names) in your If you are using mysqltest commands (like result file names) in your
test case you should do create the result file as follows: test case you should do create the result file as follows:
......
-- require r/have_default_master.require
connection master;
show variables like "port";
connect (master,localhost,root,,test,0,var/tmp/mysql.sock); connect (master,localhost,root,,test,0,mysql-master.sock);
connect (master1,localhost,root,,test,0,var/tmp/mysql.sock); connect (master1,localhost,root,,test,0,mysql-master.sock);
connect (slave,localhost,root,,test,0,var/tmp/mysql-slave.sock); connect (slave,localhost,root,,test,0,mysql-slave.sock);
connect (slave1,localhost,root,,test,0,var/tmp/mysql-slave.sock); connect (slave1,localhost,root,,test,0,mysql-slave.sock);
connection slave; connection slave;
!slave stop; !slave stop;
@r/slave-stopped.result show status like 'Slave_running'; @r/slave-stopped.result show status like 'Slave_running';
......
...@@ -41,6 +41,7 @@ fi ...@@ -41,6 +41,7 @@ fi
# On IRIX hostname is in /usr/bsd so add this to the path # On IRIX hostname is in /usr/bsd so add this to the path
PATH=$PATH:/usr/bsd PATH=$PATH:/usr/bsd
hostname=`hostname` # Install this too in the user table hostname=`hostname` # Install this too in the user table
hostname="$hostname%" # Fix if not fully qualified hostname
resolved=127.0.0.1 resolved=127.0.0.1
......
...@@ -19,7 +19,7 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work ...@@ -19,7 +19,7 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
# Program Definitions # Program Definitions
#-- #--
PATH=/bin:/usr/bin:/usr/local/bin PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd
# No paths below as we can't be sure where the program is! # No paths below as we can't be sure where the program is!
...@@ -65,6 +65,7 @@ if [ -d ../sql ] ; then ...@@ -65,6 +65,7 @@ if [ -d ../sql ] ; then
else else
BINARY_DIST=1 BINARY_DIST=1
fi fi
#BASEDIR is always one above mysql-test directory #BASEDIR is always one above mysql-test directory
CWD=`pwd` CWD=`pwd`
cd .. cd ..
...@@ -83,28 +84,77 @@ USERT=0 ...@@ -83,28 +84,77 @@ USERT=0
SYST=0 SYST=0
REALT=0 REALT=0
MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp
TIMEFILE="$MYSQL_TMP_DIR/mysqltest-time"
RES_SPACE=" " RES_SPACE=" "
MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \ MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \
myisammrg heap sql" myisammrg heap sql"
GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out
GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err
MASTER_RUNNING=0 MASTER_RUNNING=0
MASTER_MYPORT=9306
SLAVE_RUNNING=0 SLAVE_RUNNING=0
SLAVE_MYPORT=9307
EXTRA_MYSQL_TEST_OPT=""
USE_RUNNING_SERVER=1
DO_GCOV=""
DO_GDB=""
DO_DDD=""
SLEEP_TIME=2
while test $# -gt 0; do
case "$1" in
--force ) FORCE=1 ;;
--local) USE_RUNNING_SERVER="" ;;
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
--master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;;
--slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;;
--record)
RECORD=1;
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
--sleep=*)
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1"
SLEEP_TIME=`$ECHO "$1" | $SED -e "s;--sleep=;;"`
;;
--gcov )
if [ x$BINARY_DIST = x1 ] ; then
$ECHO "Cannot do coverage test without the source - please use source dist"
exit 1
fi
DO_GCOV=1
;;
--gdb )
if [ x$BINARY_DIST = x1 ] ; then
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with -gdb option"
fi
DO_GDB=1
;;
--ddd )
if [ x$BINARY_DIST = x1 ] ; then
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with -gdb option"
fi
DO_DDD=1
;;
--debug)
EXTRA_MASTER_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/master.trace
EXTRA_SLAVE_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/slave.trace
;;
-- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;;
esac
shift
done
#++ #++
# mysqld Environment Parameters # mysqld Environment Parameters
#-- #--
MYRUN_DIR=$MYSQL_TEST_DIR/var/run MYRUN_DIR=$MYSQL_TEST_DIR/var/run
MASTER_MYPORT=9306
MASTER_MYDDIR="$MYSQL_TEST_DIR/var/lib" MASTER_MYDDIR="$MYSQL_TEST_DIR/var/lib"
MASTER_MYSOCK="$MYSQL_TMP_DIR/mysql.sock" MASTER_MYSOCK="$MYSQL_TMP_DIR/mysql-master.sock"
MASTER_MYPID="$MYRUN_DIR/mysqld.pid" MASTER_MYPID="$MYRUN_DIR/mysqld.pid"
MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld.log" MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld.log"
MASTER_MYERR="$MYSQL_TEST_DIR/var/log/mysqld.err" MASTER_MYERR="$MYSQL_TEST_DIR/var/log/mysqld.err"
SLAVE_MYPORT=9307
SLAVE_MYDDIR="$MYSQL_TEST_DIR/var/slave-data" SLAVE_MYDDIR="$MYSQL_TEST_DIR/var/slave-data"
SLAVE_MYSOCK="$MYSQL_TMP_DIR/mysql-slave.sock" SLAVE_MYSOCK="$MYSQL_TMP_DIR/mysql-slave.sock"
SLAVE_MYPID="$MYRUN_DIR/mysqld-slave.pid" SLAVE_MYPID="$MYRUN_DIR/mysqld-slave.pid"
...@@ -145,59 +195,16 @@ else ...@@ -145,59 +195,16 @@ else
INSTALL_DB="./install_test_db -bin" INSTALL_DB="./install_test_db -bin"
fi fi
SLAVE_MYSQLD=$MYSQLD #this will be changed later if we are doing gcov
MYSQL_TEST="$MYSQL_TEST --no-defaults --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent -v"
GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
USE_RUNNING_SERVER=1
DO_GCOV=""
DO_GDB=""
DO_DDD=""
while test $# -gt 0; do
case "$1" in
--force ) FORCE=1 ;;
--record ) RECORD=1 ;;
--local) USE_RUNNING_SERVER="" ;;
--gcov )
if [ x$BINARY_DIST = x1 ] ; then
$ECHO "Cannot do coverage test without the source - please use source dist"
exit 1
fi
DO_GCOV=1
;;
--gdb )
if [ x$BINARY_DIST = x1 ] ; then
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with -gdb option"
fi
DO_GDB=1
;;
--ddd )
if [ x$BINARY_DIST = x1 ] ; then
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with -gdb option"
fi
DO_DDD=1
;;
--debug)
EXTRA_MASTER_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/master.trace
EXTRA_SLAVE_MYSQLD_OPT=--debug=d:t:O,$MYSQL_TMP_DIR/slave.trace
;;
-- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;;
esac
shift
done
# If we should run all tests cases, we will use a local server for that # If we should run all tests cases, we will use a local server for that
if [ -z "$1" ] if [ -z "$1" ]
then then
USE_RUNNING_SERVER="" USE_RUNNING_SERVER=""
fi fi
if [ -n "$USE_RUNNING_SERVER" ]
then
MASTER_MYSOCK="/tmp/mysql.sock"
fi
if [ -w / ] if [ -w / ]
then then
...@@ -206,6 +213,15 @@ then ...@@ -206,6 +213,15 @@ then
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --user=root" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --user=root"
fi fi
MYSQL_TEST="$MYSQL_TEST --no-defaults --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent -v --tmpdir=$MYSQL_TMP_DIR"
GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out
GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err
TIMEFILE="$MYSQL_TMP_DIR/mysqltest-time"
SLAVE_MYSQLD=$MYSQLD #this can be changed later if we are doing gcov
#++ #++
# Function Definitions # Function Definitions
#-- #--
...@@ -223,7 +239,7 @@ error () { ...@@ -223,7 +239,7 @@ error () {
} }
error_is () { error_is () {
$ECHO `$CAT $TIMEFILE` | $SED -e 's/.* At line \(.*\)\: \(.*\)Command .*$/ \>\> Error at line \1: \2<\</' $TR "\n" " " < $TIMEFILE | $SED -e 's/.* At line \(.*\)\: \(.*\)Command .*$/ \>\> Error at line \1: \2<\</'
} }
prefix_to_8() { prefix_to_8() {
...@@ -316,6 +332,7 @@ start_master() ...@@ -316,6 +332,7 @@ start_master()
--socket=$MASTER_MYSOCK \ --socket=$MASTER_MYSOCK \
--log=$MASTER_MYLOG --default-character-set=latin1 \ --log=$MASTER_MYLOG --default-character-set=latin1 \
--core \ --core \
--tmpdir=$MYSQL_TMP_DIR \
--language=english $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT" --language=english $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
if [ x$DO_DDD = x1 ] if [ x$DO_DDD = x1 ]
then then
...@@ -358,11 +375,12 @@ start_slave() ...@@ -358,11 +375,12 @@ start_slave()
--socket=$SLAVE_MYSOCK \ --socket=$SLAVE_MYSOCK \
--log=$SLAVE_MYLOG --default-character-set=latin1 \ --log=$SLAVE_MYLOG --default-character-set=latin1 \
--core \ --core \
--tmpdir=$MYSQL_TMP_DIR \
--language=english $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT" --language=english $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
if [ x$DO_DDD = x1 ] if [ x$DO_DDD = x1 ]
then then
$ECHO "set args $master_args" > $GDB_SLAVE_INIT $ECHO "set args $master_args" > $GDB_SLAVE_INIT
ddd --debugger "gdb -x $GDB_SLAVE_INIT" $MYSQLD & ddd --debugger "gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD &
prompt_user "Hit enter to continue after you've started the master" prompt_user "Hit enter to continue after you've started the master"
elif [ x$DO_GDB = x1 ] elif [ x$DO_GDB = x1 ]
then then
...@@ -380,6 +398,7 @@ mysql_start () { ...@@ -380,6 +398,7 @@ mysql_start () {
start_master start_master
start_slave start_slave
cd $MYSQL_TEST_DIR cd $MYSQL_TEST_DIR
sleep $SLEEP_TIME # Give mysqld time to start properly
return 1 return 1
} }
...@@ -392,7 +411,7 @@ stop_slave () ...@@ -392,7 +411,7 @@ stop_slave ()
then # try harder! then # try harder!
$ECHO "slave not cooperating with mysqladmin, will try manual kill" $ECHO "slave not cooperating with mysqladmin, will try manual kill"
kill `$CAT $SLAVE_MYPID` kill `$CAT $SLAVE_MYPID`
sleep 2 sleep $SLEEP_TIME
if [ -f $SLAVE_MYPID ] ; then if [ -f $SLAVE_MYPID ] ; then
$ECHO "slave refused to die, resorting to SIGKILL murder" $ECHO "slave refused to die, resorting to SIGKILL murder"
kill -9 `$CAT $SLAVE_MYPID` kill -9 `$CAT $SLAVE_MYPID`
...@@ -402,7 +421,7 @@ stop_slave () ...@@ -402,7 +421,7 @@ stop_slave ()
fi fi
fi fi
SLAVE_RUNNING=0 SLAVE_RUNNING=0
sleep 2 # Give mysqld time to go down properly sleep $SLEEP_TIME # Give mysqld time to go down properly
fi fi
} }
...@@ -415,7 +434,7 @@ stop_master () ...@@ -415,7 +434,7 @@ stop_master ()
then # try harder! then # try harder!
$ECHO "master not cooperating with mysqladmin, will try manual kill" $ECHO "master not cooperating with mysqladmin, will try manual kill"
kill `$CAT $MASTER_MYPID` kill `$CAT $MASTER_MYPID`
sleep 2 sleep $SLEEP_TIME
if [ -f $MASTER_MYPID ] ; then if [ -f $MASTER_MYPID ] ; then
$ECHO "master refused to die, resorting to SIGKILL murder" $ECHO "master refused to die, resorting to SIGKILL murder"
kill -9 `$CAT $MASTER_MYPID` kill -9 `$CAT $MASTER_MYPID`
...@@ -425,7 +444,7 @@ stop_master () ...@@ -425,7 +444,7 @@ stop_master ()
fi fi
fi fi
MASTER_RUNNING=0 MASTER_RUNNING=0
sleep 2 # Give mysqld time to go down properly sleep $SLEEP_TIME # Give mysqld time to go down properly
fi fi
} }
...@@ -461,11 +480,6 @@ run_testcase () ...@@ -461,11 +480,6 @@ run_testcase ()
slave_opt_file=$TESTDIR/$tname-slave.opt slave_opt_file=$TESTDIR/$tname-slave.opt
slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0` SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
if [ x$RECORD = x1 ]; then
extra_flags="-r"
else
extra_flags=""
fi
if [ -f $master_opt_file ] ; if [ -f $master_opt_file ] ;
then then
...@@ -514,18 +528,18 @@ run_testcase () ...@@ -514,18 +528,18 @@ run_testcase ()
if [ -f $tf ] ; then if [ -f $tf ] ; then
$RM -f r/$tname.*reject $RM -f r/$tname.*reject
mytime=`$TIME -p $MYSQL_TEST -R r/$tname.result $extra_flags \ mytime=`$TIME -p $MYSQL_TEST -R r/$tname.result $EXTRA_MYSQL_TEST_OPT \
< $tf 2> $TIMEFILE` < $tf 2> $TIMEFILE`
res=$? res=$?
if [ $res = 0 ]; then if [ $res = 0 ]; then
mytime=`$CAT $TIMEFILE | $TAIL -3 | $TR '\n' '-'` mytime=`$CAT $TIMEFILE | $TAIL -3 | $TR '\n' ':'`
USERT=`$ECHO $mytime | $CUT -d - -f 2 | $CUT -d ' ' -f 2` USERT=`$ECHO $mytime | $CUT -d : -f 2 | $CUT -d ' ' -f 2`
USERT=`prefix_to_8 $USERT` USERT=`prefix_to_8 $USERT`
SYST=`$ECHO $mytime | $CUT -d - -f 3 | $CUT -d ' ' -f 2` SYST=`$ECHO $mytime | $CUT -d : -f 3 | $CUT -d ' ' -f 2`
SYST=`prefix_to_8 $SYST` SYST=`prefix_to_8 $SYST`
REALT=`$ECHO $mytime | $CUT -d - -f 1 | $CUT -d ' ' -f 2` REALT=`$ECHO $mytime | $CUT -d : -f 1 | $CUT -d ' ' -f 2`
REALT=`prefix_to_8 $REALT` REALT=`prefix_to_8 $REALT`
else else
USERT=" ...." USERT=" ...."
...@@ -535,19 +549,17 @@ run_testcase () ...@@ -535,19 +549,17 @@ run_testcase ()
timestr="$USERT $SYST $REALT" timestr="$USERT $SYST $REALT"
pname=`$ECHO "$tname "|$CUT -c 1-16` pname=`$ECHO "$tname "|$CUT -c 1-16`
$ECHO -n "$pname $timestr" RES="$pname $timestr"
if [ $res = 0 ]; then if [ $res = 0 ]; then
total_inc total_inc
pass_inc pass_inc
$ECHO "$RES_SPACE [ pass ]" $ECHO "$RES$RES_SPACE [ pass ]"
else else
if [ $res = 1 ]; then if [ $res = 1 ]; then
total_inc total_inc
fail_inc fail_inc
$ECHO "$RES_SPACE [ fail ]" $ECHO "$RES$RES_SPACE [ fail ]"
$ECHO $ECHO
error_is error_is
$ECHO $ECHO
...@@ -563,7 +575,7 @@ run_testcase () ...@@ -563,7 +575,7 @@ run_testcase ()
$ECHO "" $ECHO ""
else else
pass_inc pass_inc
$ECHO "$RES_SPACE [ skipped ]" $ECHO "$RES$RES_SPACE [ skipped ]"
fi fi
fi fi
fi fi
......
0 256 00000000000000065536 2147483647 -2147483648 2147483648 +4294967296 0 256 00000000000000065536 2147483647 -2147483648 2147483648 +4294967296
0 256 65536 2147483647 -2147483648 2147483648 4294967296 0 256 65536 2147483647 -2147483648 2147483648 4294967296
922337203685477580 92233720368547758000
922337203685477580 92233720368547758080
-922337203685477580 -92233720368547758000
-922337203685477580 -92233720368547758080
9223372036854775807 -009223372036854775808 9223372036854775807 -009223372036854775808
9223372036854775807 -9223372036854775808 9223372036854775807 -9223372036854775808
+9999999999999999999 -9999999999999999999 +9999999999999999999 -9999999999999999999
......
Variable_name Value
port 9306
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# Test of reading of bigint values # Test of reading of bigint values
# #
select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296; select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
select 922337203685477580,92233720368547758000;
select -922337203685477580,-92233720368547758000;
select 9223372036854775807,-009223372036854775808; select 9223372036854775807,-009223372036854775808;
select +9999999999999999999,-9999999999999999999; select +9999999999999999999,-9999999999999999999;
......
...@@ -18,7 +18,7 @@ drop table if exists choo; ...@@ -18,7 +18,7 @@ drop table if exists choo;
create table choo (k int); create table choo (k int);
insert into choo values(55); insert into choo values(55);
connection slave; connection slave;
sleep 2; sleep 3;
@r/rpl000008.result select foo.n,bar.m,choo.k from foo,bar,choo; @r/rpl000008.result select foo.n,bar.m,choo.k from foo,bar,choo;
connection master; connection master;
drop table if exists foo,bar,choo; drop table if exists foo,bar,choo;
...@@ -21,6 +21,6 @@ sleep 1; ...@@ -21,6 +21,6 @@ sleep 1;
# #
# Clean up # Clean up
# #
connect (master2,localhost,root,,test,0,var/tmp/mysql.sock); connect (master2,localhost,root,,test,0,mysql-master.sock);
connection master2; connection master2;
drop table if exists t1,t2; drop table if exists t1,t2;
...@@ -27,6 +27,6 @@ while ($1) ...@@ -27,6 +27,6 @@ while ($1)
# #
# Clean up # Clean up
# #
connect (master2,localhost,root,,test,0,var/tmp/mysql.sock); connect (master2,localhost,root,,test,0,mysql-master.sock);
connection master2; connection master2;
drop table if exists t1,t2; drop table if exists t1,t2;
source include/master-slave.inc; source include/master-slave.inc;
source include/have_default_master.inc;
connection master; connection master;
show master status; show master status;
connection slave; connection slave;
......
connect (master,localhost,root,,test,0,var/tmp/mysql.sock); connect (master,localhost,root,,test,0,mysql-master.sock);
connect (slave,localhost,root,,test,0,var/tmp/mysql-slave.sock); connect (slave,localhost,root,,test,0, mysql-slave.sock);
source include/have_default_master.inc;
connection master; connection master;
reset master; reset master;
show master status; show master status;
......
connect (master,localhost,root,,test,0,var/tmp/mysql.sock); connect (master,localhost,root,,test,0,mysql-master.sock);
connect (slave,localhost,root,,test,0,var/tmp/mysql-slave.sock); connect (slave,localhost,root,,test,0,mysql-slave.sock);
source include/have_default_master.inc;
system cat /dev/null > var/slave-data/master.info; system cat /dev/null > var/slave-data/master.info;
system chmod 000 var/slave-data/master.info; system chmod 000 var/slave-data/master.info;
connection slave; connection slave;
......
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