mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixes to get mysql-test-run more portable
This commit is contained in:
@ -15430,6 +15430,8 @@ mysql> select 'new*\n*line' REGEXP 'new\\*.\\*line';
|
||||
-> 1
|
||||
mysql> select "a" REGEXP "A", "a" REGEXP BINARY "A";
|
||||
-> 1 0
|
||||
mysql> select "a" REGEXP "^[a-d]";
|
||||
-> 1
|
||||
@end example
|
||||
|
||||
@item
|
||||
@ -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}.
|
||||
@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 functions, control flow
|
||||
@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.
|
||||
The default is ascending order; this may be specified explicitly using
|
||||
the @code{ASC} keyword.
|
||||
|
||||
@item
|
||||
You can in the @code{WHERE} clause use any of the functions that
|
||||
@strong{MySQL} support. @xref{Functions}.
|
||||
|
||||
@item
|
||||
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
|
||||
@ -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
|
||||
@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
|
||||
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
|
||||
@ -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
|
||||
TERMINATED BY}, @code{ESCAPED BY}, or @code{LINES TERMINATED BY}
|
||||
characters to reliably be able to read the file
|
||||
back. @code{ASCII 0} is escaped to make it easier to view with some
|
||||
pagers.
|
||||
characters to reliably be able to read the file back. @code{ASCII 0} is
|
||||
escaped to make it easier to view with some pagers.
|
||||
|
||||
As the resulting file doesn't have to conform to the SQL syntax, nothing
|
||||
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
|
||||
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
|
||||
terminations and without any escaping. This is useful if you want to
|
||||
store a blob in a file.
|
||||
@end itemize
|
||||
|
||||
@findex JOIN
|
||||
@findex INNER JOIN
|
||||
|
@ -23,7 +23,7 @@
|
||||
* Monty
|
||||
**/
|
||||
|
||||
#define MTEST_VERSION "1.2"
|
||||
#define MTEST_VERSION "1.4"
|
||||
|
||||
#include "global.h"
|
||||
#include "my_sys.h"
|
||||
@ -50,7 +50,7 @@
|
||||
#define MIN_VAR_ALLOC 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;
|
||||
const char* user = 0, *host = 0, *unix_sock = 0;
|
||||
int port = 0;
|
||||
@ -62,6 +62,7 @@ FILE* file_stack[MAX_INCLUDE_DEPTH];
|
||||
FILE** cur_file;
|
||||
FILE** file_stack_end;
|
||||
uint lineno_stack[MAX_INCLUDE_DEPTH];
|
||||
char TMPDIR[FN_REFLEN];
|
||||
|
||||
int block_stack[BLOCK_STACK_DEPTH];
|
||||
int *cur_block, *block_stack_end;
|
||||
@ -494,38 +495,41 @@ int do_let(struct query* q)
|
||||
|
||||
int do_sleep(struct query* q)
|
||||
{
|
||||
char* p, *arg;
|
||||
char *p;
|
||||
struct timeval t;
|
||||
int dec_mul = 1000000;
|
||||
p = (char*)q->q + q->first_word_len;
|
||||
while(*p && isspace(*p)) p++;
|
||||
if (!*p)
|
||||
die("Missing argument in sleep\n");
|
||||
arg = p;
|
||||
t.tv_sec = atoi(arg);
|
||||
t.tv_usec = 0;
|
||||
while(*p && *p != '.' && !isspace(*p))
|
||||
p++;
|
||||
if (*p == '.')
|
||||
if (opt_sleep)
|
||||
t.tv_sec = opt_sleep;
|
||||
else
|
||||
{
|
||||
char c;
|
||||
char *p_end;
|
||||
p++;
|
||||
p_end = p + 6;
|
||||
|
||||
for(;p <= p_end; ++p)
|
||||
t.tv_sec = atoi(p);
|
||||
while(*p && *p != '.' && !isspace(*p))
|
||||
p++;
|
||||
if (*p == '.')
|
||||
{
|
||||
c = *p - '0';
|
||||
if (c < 10 && c >= 0)
|
||||
char c;
|
||||
char *p_end;
|
||||
p++;
|
||||
p_end = p + 6;
|
||||
|
||||
for(;p <= p_end; ++p)
|
||||
{
|
||||
t.tv_usec = t.tv_usec * 10 + c;
|
||||
dec_mul /= 10;
|
||||
c = *p - '0';
|
||||
if (c < 10 && c >= 0)
|
||||
{
|
||||
t.tv_usec = t.tv_usec * 10 + c;
|
||||
dec_mul /= 10;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
*p = 0;
|
||||
t.tv_usec *= dec_mul;
|
||||
return select(0,0,0,0, &t);
|
||||
}
|
||||
@ -617,6 +621,7 @@ int do_connect(struct query* q)
|
||||
char* con_name, *con_user,*con_pass, *con_host, *con_port_str,
|
||||
*con_db, *con_sock;
|
||||
char* p;
|
||||
char buff[FN_REFLEN];
|
||||
|
||||
p = q->q + q->first_word_len;
|
||||
|
||||
@ -636,6 +641,7 @@ int do_connect(struct query* q)
|
||||
|
||||
if (!mysql_init(&next_con->mysql))
|
||||
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,
|
||||
con_db, atoi(con_port_str), con_sock, 0))
|
||||
die("Could not open connection '%s': %s", con_name,
|
||||
@ -952,19 +958,21 @@ int read_query(struct query** q_ptr)
|
||||
|
||||
struct option long_options[] =
|
||||
{
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"silent", no_argument, 0, 'q'},
|
||||
{"database", required_argument, 0, 'D'},
|
||||
{"help", no_argument, 0, '?'},
|
||||
{"host", required_argument, 0, 'h'},
|
||||
{"password", optional_argument, 0, 'p'},
|
||||
{"port", required_argument, 0, 'P'},
|
||||
{"quiet", no_argument, 0, 'q'},
|
||||
{"record", no_argument, 0, 'r'},
|
||||
{"result-file", required_argument, 0, 'R'},
|
||||
{"help", no_argument, 0, '?'},
|
||||
{"user", required_argument, 0, 'u'},
|
||||
{"password", optional_argument, 0, 'p'},
|
||||
{"host", required_argument, 0, 'h'},
|
||||
{"silent", no_argument, 0, 'q'},
|
||||
{"sleep", required_argument, 0, 'T'},
|
||||
{"socket", required_argument, 0, 'S'},
|
||||
{"database", required_argument, 0, 'D'},
|
||||
{"port", required_argument, 0, 'P'},
|
||||
{"tmpdir", required_argument, 0, 't'},
|
||||
{"user", required_argument, 0, 'u'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{0, 0,0,0}
|
||||
};
|
||||
|
||||
@ -991,6 +999,8 @@ void usage()
|
||||
-D, --database=... Database to use.\n\
|
||||
-P, --port=... Port number 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, --result-file=... Read/Store result from/in this file.\n\
|
||||
-v, --verbose Write more.\n\
|
||||
@ -1006,7 +1016,7 @@ int parse_args(int argc, char **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)
|
||||
{
|
||||
switch(c)
|
||||
@ -1048,6 +1058,12 @@ int parse_args(int argc, char **argv)
|
||||
case 'q':
|
||||
silent = 1;
|
||||
break;
|
||||
case 't':
|
||||
strnmov(TMPDIR,optarg,sizeof(TMPDIR));
|
||||
break;
|
||||
case 'T':
|
||||
opt_sleep=atoi(optarg);
|
||||
break;
|
||||
case 'V':
|
||||
print_version();
|
||||
exit(0);
|
||||
@ -1255,6 +1271,7 @@ int main(int argc, char** argv)
|
||||
my_bool require_file=0;
|
||||
char save_file[FN_REFLEN];
|
||||
save_file[0]=0;
|
||||
TMPDIR[0]=0;
|
||||
|
||||
MY_INIT(argv[0]);
|
||||
memset(cons, 0, sizeof(cons));
|
||||
|
@ -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
|
||||
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
|
||||
test case you should do create the result file as follows:
|
||||
|
||||
|
3
mysql-test/include/have_default_master.inc
Normal file
3
mysql-test/include/have_default_master.inc
Normal file
@ -0,0 +1,3 @@
|
||||
-- require r/have_default_master.require
|
||||
connection master;
|
||||
show variables like "port";
|
@ -1,7 +1,7 @@
|
||||
connect (master,localhost,root,,test,0,var/tmp/mysql.sock);
|
||||
connect (master1,localhost,root,,test,0,var/tmp/mysql.sock);
|
||||
connect (slave,localhost,root,,test,0,var/tmp/mysql-slave.sock);
|
||||
connect (slave1,localhost,root,,test,0,var/tmp/mysql-slave.sock);
|
||||
connect (master,localhost,root,,test,0,mysql-master.sock);
|
||||
connect (master1,localhost,root,,test,0,mysql-master.sock);
|
||||
connect (slave,localhost,root,,test,0,mysql-slave.sock);
|
||||
connect (slave1,localhost,root,,test,0,mysql-slave.sock);
|
||||
connection slave;
|
||||
!slave stop;
|
||||
@r/slave-stopped.result show status like 'Slave_running';
|
||||
|
@ -41,6 +41,7 @@ fi
|
||||
# On IRIX hostname is in /usr/bsd so add this to the path
|
||||
PATH=$PATH:/usr/bsd
|
||||
hostname=`hostname` # Install this too in the user table
|
||||
hostname="$hostname%" # Fix if not fully qualified hostname
|
||||
|
||||
resolved=127.0.0.1
|
||||
|
||||
|
@ -19,7 +19,7 @@ TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
|
||||
# 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!
|
||||
|
||||
@ -65,6 +65,7 @@ if [ -d ../sql ] ; then
|
||||
else
|
||||
BINARY_DIST=1
|
||||
fi
|
||||
|
||||
#BASEDIR is always one above mysql-test directory
|
||||
CWD=`pwd`
|
||||
cd ..
|
||||
@ -83,28 +84,77 @@ USERT=0
|
||||
SYST=0
|
||||
REALT=0
|
||||
MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp
|
||||
TIMEFILE="$MYSQL_TMP_DIR/mysqltest-time"
|
||||
RES_SPACE=" "
|
||||
MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \
|
||||
myisammrg heap sql"
|
||||
GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out
|
||||
GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err
|
||||
|
||||
MASTER_RUNNING=0
|
||||
MASTER_MYPORT=9306
|
||||
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
|
||||
#--
|
||||
|
||||
MYRUN_DIR=$MYSQL_TEST_DIR/var/run
|
||||
MASTER_MYPORT=9306
|
||||
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_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld.log"
|
||||
MASTER_MYERR="$MYSQL_TEST_DIR/var/log/mysqld.err"
|
||||
|
||||
SLAVE_MYPORT=9307
|
||||
SLAVE_MYDDIR="$MYSQL_TEST_DIR/var/slave-data"
|
||||
SLAVE_MYSOCK="$MYSQL_TMP_DIR/mysql-slave.sock"
|
||||
SLAVE_MYPID="$MYRUN_DIR/mysqld-slave.pid"
|
||||
@ -145,59 +195,16 @@ else
|
||||
INSTALL_DB="./install_test_db -bin"
|
||||
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 [ -z "$1" ]
|
||||
then
|
||||
USE_RUNNING_SERVER=""
|
||||
fi
|
||||
if [ -n "$USE_RUNNING_SERVER" ]
|
||||
then
|
||||
MASTER_MYSOCK="/tmp/mysql.sock"
|
||||
fi
|
||||
|
||||
if [ -w / ]
|
||||
then
|
||||
@ -206,6 +213,15 @@ then
|
||||
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --user=root"
|
||||
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
|
||||
#--
|
||||
@ -223,7 +239,7 @@ error () {
|
||||
}
|
||||
|
||||
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() {
|
||||
@ -316,6 +332,7 @@ start_master()
|
||||
--socket=$MASTER_MYSOCK \
|
||||
--log=$MASTER_MYLOG --default-character-set=latin1 \
|
||||
--core \
|
||||
--tmpdir=$MYSQL_TMP_DIR \
|
||||
--language=english $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
|
||||
if [ x$DO_DDD = x1 ]
|
||||
then
|
||||
@ -358,11 +375,12 @@ start_slave()
|
||||
--socket=$SLAVE_MYSOCK \
|
||||
--log=$SLAVE_MYLOG --default-character-set=latin1 \
|
||||
--core \
|
||||
--tmpdir=$MYSQL_TMP_DIR \
|
||||
--language=english $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
|
||||
if [ x$DO_DDD = x1 ]
|
||||
then
|
||||
$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"
|
||||
elif [ x$DO_GDB = x1 ]
|
||||
then
|
||||
@ -380,6 +398,7 @@ mysql_start () {
|
||||
start_master
|
||||
start_slave
|
||||
cd $MYSQL_TEST_DIR
|
||||
sleep $SLEEP_TIME # Give mysqld time to start properly
|
||||
return 1
|
||||
}
|
||||
|
||||
@ -392,7 +411,7 @@ stop_slave ()
|
||||
then # try harder!
|
||||
$ECHO "slave not cooperating with mysqladmin, will try manual kill"
|
||||
kill `$CAT $SLAVE_MYPID`
|
||||
sleep 2
|
||||
sleep $SLEEP_TIME
|
||||
if [ -f $SLAVE_MYPID ] ; then
|
||||
$ECHO "slave refused to die, resorting to SIGKILL murder"
|
||||
kill -9 `$CAT $SLAVE_MYPID`
|
||||
@ -402,7 +421,7 @@ stop_slave ()
|
||||
fi
|
||||
fi
|
||||
SLAVE_RUNNING=0
|
||||
sleep 2 # Give mysqld time to go down properly
|
||||
sleep $SLEEP_TIME # Give mysqld time to go down properly
|
||||
fi
|
||||
}
|
||||
|
||||
@ -415,7 +434,7 @@ stop_master ()
|
||||
then # try harder!
|
||||
$ECHO "master not cooperating with mysqladmin, will try manual kill"
|
||||
kill `$CAT $MASTER_MYPID`
|
||||
sleep 2
|
||||
sleep $SLEEP_TIME
|
||||
if [ -f $MASTER_MYPID ] ; then
|
||||
$ECHO "master refused to die, resorting to SIGKILL murder"
|
||||
kill -9 `$CAT $MASTER_MYPID`
|
||||
@ -425,7 +444,7 @@ stop_master ()
|
||||
fi
|
||||
fi
|
||||
MASTER_RUNNING=0
|
||||
sleep 2 # Give mysqld time to go down properly
|
||||
sleep $SLEEP_TIME # Give mysqld time to go down properly
|
||||
fi
|
||||
}
|
||||
|
||||
@ -461,11 +480,6 @@ run_testcase ()
|
||||
slave_opt_file=$TESTDIR/$tname-slave.opt
|
||||
slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt
|
||||
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
|
||||
if [ x$RECORD = x1 ]; then
|
||||
extra_flags="-r"
|
||||
else
|
||||
extra_flags=""
|
||||
fi
|
||||
|
||||
if [ -f $master_opt_file ] ;
|
||||
then
|
||||
@ -514,18 +528,18 @@ run_testcase ()
|
||||
|
||||
if [ -f $tf ] ; then
|
||||
$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`
|
||||
res=$?
|
||||
|
||||
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`
|
||||
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`
|
||||
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`
|
||||
else
|
||||
USERT=" ...."
|
||||
@ -533,21 +547,19 @@ run_testcase ()
|
||||
REALT=" ...."
|
||||
fi
|
||||
|
||||
timestr="$USERT $SYST $REALT"
|
||||
pname=`$ECHO "$tname "|$CUT -c 1-16`
|
||||
$ECHO -n "$pname $timestr"
|
||||
|
||||
|
||||
timestr="$USERT $SYST $REALT"
|
||||
pname=`$ECHO "$tname "|$CUT -c 1-16`
|
||||
RES="$pname $timestr"
|
||||
|
||||
if [ $res = 0 ]; then
|
||||
total_inc
|
||||
pass_inc
|
||||
$ECHO "$RES_SPACE [ pass ]"
|
||||
$ECHO "$RES$RES_SPACE [ pass ]"
|
||||
else
|
||||
if [ $res = 1 ]; then
|
||||
total_inc
|
||||
fail_inc
|
||||
$ECHO "$RES_SPACE [ fail ]"
|
||||
$ECHO "$RES$RES_SPACE [ fail ]"
|
||||
$ECHO
|
||||
error_is
|
||||
$ECHO
|
||||
@ -563,7 +575,7 @@ run_testcase ()
|
||||
$ECHO ""
|
||||
else
|
||||
pass_inc
|
||||
$ECHO "$RES_SPACE [ skipped ]"
|
||||
$ECHO "$RES$RES_SPACE [ skipped ]"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -1,9 +1,5 @@
|
||||
0 256 00000000000000065536 2147483647 -2147483648 2147483648 +4294967296
|
||||
0 256 65536 2147483647 -2147483648 2147483648 4294967296
|
||||
922337203685477580 92233720368547758000
|
||||
922337203685477580 92233720368547758080
|
||||
-922337203685477580 -92233720368547758000
|
||||
-922337203685477580 -92233720368547758080
|
||||
9223372036854775807 -009223372036854775808
|
||||
9223372036854775807 -9223372036854775808
|
||||
+9999999999999999999 -9999999999999999999
|
||||
|
2
mysql-test/r/have_default_master.require
Normal file
2
mysql-test/r/have_default_master.require
Normal file
@ -0,0 +1,2 @@
|
||||
Variable_name Value
|
||||
port 9306
|
@ -2,8 +2,6 @@
|
||||
# Test of reading of bigint values
|
||||
#
|
||||
select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
|
||||
select 922337203685477580,92233720368547758000;
|
||||
select -922337203685477580,-92233720368547758000;
|
||||
select 9223372036854775807,-009223372036854775808;
|
||||
select +9999999999999999999,-9999999999999999999;
|
||||
|
||||
|
@ -18,7 +18,7 @@ drop table if exists choo;
|
||||
create table choo (k int);
|
||||
insert into choo values(55);
|
||||
connection slave;
|
||||
sleep 2;
|
||||
sleep 3;
|
||||
@r/rpl000008.result select foo.n,bar.m,choo.k from foo,bar,choo;
|
||||
connection master;
|
||||
drop table if exists foo,bar,choo;
|
||||
|
@ -21,6 +21,6 @@ sleep 1;
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
connect (master2,localhost,root,,test,0,var/tmp/mysql.sock);
|
||||
connect (master2,localhost,root,,test,0,mysql-master.sock);
|
||||
connection master2;
|
||||
drop table if exists t1,t2;
|
||||
|
@ -27,6 +27,6 @@ while ($1)
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
connect (master2,localhost,root,,test,0,var/tmp/mysql.sock);
|
||||
connect (master2,localhost,root,,test,0,mysql-master.sock);
|
||||
connection master2;
|
||||
drop table if exists t1,t2;
|
||||
|
@ -1,4 +1,5 @@
|
||||
source include/master-slave.inc;
|
||||
source include/have_default_master.inc;
|
||||
connection master;
|
||||
show master status;
|
||||
connection slave;
|
||||
|
@ -1,5 +1,6 @@
|
||||
connect (master,localhost,root,,test,0,var/tmp/mysql.sock);
|
||||
connect (slave,localhost,root,,test,0,var/tmp/mysql-slave.sock);
|
||||
connect (master,localhost,root,,test,0,mysql-master.sock);
|
||||
connect (slave,localhost,root,,test,0, mysql-slave.sock);
|
||||
source include/have_default_master.inc;
|
||||
connection master;
|
||||
reset master;
|
||||
show master status;
|
||||
|
@ -1,5 +1,6 @@
|
||||
connect (master,localhost,root,,test,0,var/tmp/mysql.sock);
|
||||
connect (slave,localhost,root,,test,0,var/tmp/mysql-slave.sock);
|
||||
connect (master,localhost,root,,test,0,mysql-master.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 chmod 000 var/slave-data/master.info;
|
||||
connection slave;
|
||||
|
Reference in New Issue
Block a user