2
# mysql-test-run - originally written by Matt Wagner <matt@mysql.com>
3
# modified by Sasha Pachev <sasha@mysql.com>
4
# Slightly updated by Monty
5
# Cleaned up again by Matt
7
# List of failed cases (--force) backported from 4.1 by Joerg
10
#echo "##################################################";
11
#echo "This script is deprecated and will soon be removed";
12
#echo "Use mysql-test-run.pl instead";
13
#echo "##################################################";
24
TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
26
if [ -z "$MYSQL_TCP_PORT" ]; then
27
MYSQL_TCP_PORT=@MYSQL_TCP_PORT@
28
if [ @MYSQL_TCP_PORT_DEFAULT@ -eq 0 ]; then
29
ESP=`getent services mysql/tcp`
31
MYSQL_TCP_PORT=`echo "$ESP"|sed -e's-^[a-z]*[ ]*\([0-9]*\)/[a-z]*$-\1-g'`
38
# For query_cache test
40
SCO_SV | UnixWare | OpenUNIX )
41
# do nothing (Causes strange behavior)
44
# do nothing (avoid error message)
57
PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$PATH
58
MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master"
64
IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
75
echo "Fatal error: Cannot find program $file in $PATH" 1>&2
83
sleep_until_file_deleted ()
87
loop=$SLEEP_TIME_FOR_DELETE
88
while (test $loop -gt 0)
103
sleep_until_file_created ()
108
while (test $loop -gt 0)
115
loop=`expr $loop - 1`
117
echo "ERROR: $file was not created in $org_time seconds; Aborting"
126
#$WAIT_PID pid $SLEEP_TIME_FOR_DELETE
129
# Check that valgrind is installed
132
FIND_VALGRIND=`which valgrind` # this will print an error if not found
133
# Give good warning to the user and stop
134
if [ -z "$FIND_VALGRIND" ] ; then
135
$ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org ."
138
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
139
valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && FIND_VALGRIND="$FIND_VALGRIND --tool=memcheck"
140
FIND_VALGRIND="$FIND_VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$MYSQL_TEST_DIR/valgrind.supp"
143
# No paths below as we can't be sure where the program is!
147
BASENAME=`which basename`
148
if test $? != 0; then exit 1; fi
149
DIFF=`which diff | $SED q`
150
if test $? != 0; then exit 1; fi
155
ECHO=echo # use internal echo if possible
156
EXPR=expr # use internal if possible
159
if test $? != 0; then exit 1; fi
162
if test $? != 0; then exit 1; fi
165
if test $? != 0; then exit 1; fi
168
# Are we using a source or a binary distribution?
171
if [ -d bin/mysqld ] && [ -d mysql-test ] ; then
174
if [ -d $testdir/mysql-test ] ; then
179
if [ ! -f ./mysql-test-run ] ; then
180
$ECHO "Can't find the location for the mysql-test-run script"
182
$ECHO "Go to to the mysql-test directory and execute the script as follows:"
183
$ECHO "./mysql-test-run."
191
# BASEDIR is always above mysql-test directory ...
195
if [ -d ./sql ] ; then
200
# ... one level for tar.gz, two levels for a RPM installation
201
if [ ! -f ./bin/mysql_upgrade ] ; then
202
# Has to be RPM installation
209
MYSQL_TEST_WINDIR=$MYSQL_TEST_DIR
210
MYSQLTEST_VARDIR=$MYSQL_TEST_DIR/var
211
export MYSQL_TEST_DIR MYSQL_TEST_WINDIR MYSQLTEST_VARDIR
212
STD_DATA=$MYSQL_TEST_DIR/std_data
213
hostname=`hostname` # Installed in the mysql privilege table
215
MANAGER_QUIET_OPT="-q"
216
TESTDIR="$MYSQL_TEST_DIR/t"
227
MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp
230
# Use a relative path for where the slave will find the dumps
231
# generated by "LOAD DATA" on the master. The path is relative
232
# since it must have fixed length to test logging
233
# i.e otherwise the output from "SHOW MASTER STATUS" will vary
234
# with the strlen() of MYSQL_TEST_DIR
235
SLAVE_LOAD_TMPDIR=../tmp
238
MYSQLD_SRC_DIRS="strings mysys include extra regex myisam \
240
MY_LOG_DIR="$MYSQL_TEST_DIR/var/log"
242
# Set LD_LIBRARY_PATH if we are using shared libraries
244
LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$LD_LIBRARY_PATH"
245
DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$DYLD_LIBRARY_PATH"
246
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
249
# Allow anyone in the group to see the generated database files
253
export UMASK UMASK_DIR
257
MASTER_MYHOST=127.0.0.1
260
SLAVE_MYHOST=127.0.0.1
261
SLAVE_MYPORT=9308 # leave room for 2 masters for cluster tests
262
MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log
264
NDBCLUSTER_PORT_SLAVE=9358
267
# To make it easier for different devs to work on the same host,
268
# an environment variable can be used to control all ports. A small
269
# number is to be used, 0 - 16 or similar.
271
# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
272
# versions of this script, else a 4.0 test run might conflict with a
273
# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
274
# all port numbers might not be used in this version of the script.
276
if [ -n "$MTR_BUILD_THREAD" ] ; then
277
MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 10 + 10000`
278
SLAVE_MYPORT=`expr $MASTER_MYPORT + 3`
279
NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 6`
280
NDBCLUSTER_PORT_SLAVE=`expr $MASTER_MYPORT + 7`
282
echo "Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD"
283
echo "Using MASTER_MYPORT = $MASTER_MYPORT"
284
echo "Using SLAVE_MYPORT = $SLAVE_MYPORT"
285
echo "Using NDBCLUSTER_PORT = $NDBCLUSTER_PORT"
286
echo "Using NDBCLUSTER_PORT_SLAVE = $NDBCLUSTER_PORT_SLAVE"
294
EXTRA_MYSQL_TEST_OPT=""
295
EXTRA_MYSQLCHECK_OPT=""
296
EXTRA_MYSQLDUMP_OPT=""
297
EXTRA_MYSQLSLAP_OPT=""
298
EXTRA_MYSQLSHOW_OPT=""
299
EXTRA_MYSQLBINLOG_OPT=""
301
USE_NDBCLUSTER=@USE_NDBCLUSTER@
302
USE_NDBCLUSTER_SLAVE=@USE_NDBCLUSTER@
304
USE_NDBCLUSTER_ONLY=0
305
USE_RUNNING_NDBCLUSTER=""
306
USE_RUNNING_NDBCLUSTER_SLAVE=""
309
NDBCLUSTER_EXTRA_OPTS=""
317
SLEEP_TIME_AFTER_RESTART=1
318
SLEEP_TIME_FOR_DELETE=10
319
SLEEP_TIME_FOR_FIRST_MASTER=400 # Enough time to create innodb tables
320
SLEEP_TIME_FOR_SECOND_MASTER=400
321
SLEEP_TIME_FOR_FIRST_SLAVE=400
322
SLEEP_TIME_FOR_SECOND_SLAVE=300
325
START_WAIT_TIMEOUT=10
327
MYSQL_TEST_SSL_OPTS=""
329
USE_EMBEDDED_SERVER=""
335
MASTER_MYSQLDBINLOG=1
344
STRESS_TEST_DURATION=""
349
$ECHO "Logging: $0 $*" # To ensure we see all arguments in the output, for the test analysis tool
351
while test $# -gt 0; do
354
USE_EMBEDDED_SERVER=1
355
USE_MANAGER=0 NO_SLAVE=1
358
USE_NDBCLUSTER_SLAVE=""
359
TEST_MODE="$TEST_MODE embedded" ;;
364
TEST_MODE="$TEST_MODE purify" ;;
365
--user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;;
367
--timer) USE_TIMER=1 ;;
368
--old-master) MASTER_40_ARGS="";;
370
MASTER_MYSQLD=`$ECHO "$1" | $SED -e "s;--master-binary=;;"` ;;
372
SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;;
373
--local) USE_RUNNING_SERVER=0 ;;
374
--extern) USE_RUNNING_SERVER=1 ;;
376
USE_NDBCLUSTER="--ndbcluster" ;;
377
--with-ndbcluster-slave)
378
USE_NDBCLUSTER_SLAVE="--ndbcluster" ;;
379
--with-ndbcluster-all)
380
USE_NDBCLUSTER="--ndbcluster"
381
USE_NDBCLUSTER_SLAVE="--ndbcluster"
382
USE_NDBCLUSTER_ALL=1 ;;
383
--with-ndbcluster-only)
384
USE_NDBCLUSTER="--ndbcluster"
385
USE_NDBCLUSTER_SLAVE="--ndbcluster"
386
USE_NDBCLUSTER_ONLY=1 ;;
387
--ndb-connectstring=*)
388
USE_NDBCLUSTER="--ndbcluster" ;
389
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
390
--ndb-connectstring-slave=*)
391
USE_NDBCLUSTER_SLAVE="--ndbcluster" ;
392
USE_RUNNING_NDBCLUSTER_SLAVE=`$ECHO "$1" | $SED -e "s;--ndb-connectstring-slave=;;"` ;;
394
NDBCLUSTER_EXTRA_OPTS=" "
399
--ndb_mgm-extra-opts=*)
400
NDB_MGM_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgm-extra-opts=;;"` ;;
401
--ndb_mgmd-extra-opts=*)
402
NDB_MGMD_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgmd-extra-opts=;;"` ;;
404
NDBD_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndbd-extra-opts=;;"` ;;
405
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
408
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --host=127.0.0.1 \
409
--port=$MYSQL_MYPORT"
411
--master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;;
412
--slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;;
413
--ndbcluster_port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster_port=;;"` ;;
414
--ndbcluster-port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster-port=;;"` ;;
415
--ndbcluster-port-slave=*) NDBCLUSTER_PORT_SLAVE=`$ECHO "$1" | $SED -e "s;--ndbcluster-port-slave=;;"` ;;
417
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
418
--ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
419
--ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem \
420
--ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem"
421
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
422
--ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
423
--ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem \
424
--ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem"
425
MYSQL_TEST_SSL_OPTS="--ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
426
--ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem \
427
--ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem" ;;
431
--skip-rpl) NO_SLAVE=1 ;;
432
--skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;;
433
--do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;;
434
--start-from=* ) START_FROM=`$ECHO "$1" | $SED -e "s;--start-from=;;"` ;;
435
--warnings | --log-warnings)
436
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --log-warnings"
437
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --log-warnings"
440
START_WAIT_TIMEOUT=`$ECHO "$1" | $SED -e "s;--wait-timeout=;;"`
441
STOP_WAIT_TIMEOUT=$START_WAIT_TIMEOUT;;
444
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
460
STRESS_SUITE=`$ECHO "$1" | $SED -e "s;--stress-suite=;;"`
463
STRESS_THREADS=`$ECHO "$1" | $SED -e "s;--stress-threads=;;"`
465
--stress-test-file=*)
466
STRESS_TEST_FILE=`$ECHO "$1" | $SED -e "s;--stress-test-file=;;"`
468
--stress-init-file=*)
469
STRESS_INIT_FILE=`$ECHO "$1" | $SED -e "s;--stress-init-file=;;"`
472
STRESS_MODE=`$ECHO "$1" | $SED -e "s;--stress-mode=;;"`
474
--stress-loop-count=*)
475
STRESS_LOOP_COUNT=`$ECHO "$1" | $SED -e "s;--stress-loop-count=;;"`
477
--stress-test-count=*)
478
STRESS_TEST_COUNT=`$ECHO "$1" | $SED -e "s;--stress-test-count=;;"`
480
--stress-test-duration=*)
481
STRESS_TEST_DURATION=`$ECHO "$1" | $SED -e "s;--stress-test-duration=;;"`
483
--big*) # Actually --big-test
484
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
486
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
488
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1"
489
SLEEP_TIME_AFTER_RESTART=`$ECHO "$1" | $SED -e "s;--sleep=;;"`
492
TEST_MODE="$TEST_MODE ps-protocol" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
494
USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"`
497
TMP=`$ECHO "$1" | $SED -e "s;--mysqld=;;"`
498
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $TMP"
499
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $TMP"
502
if [ x$BINARY_DIST = x1 ] ; then
503
$ECHO "Cannot do coverage test without the source - please use source dist"
513
START_WAIT_TIMEOUT=300
514
STOP_WAIT_TIMEOUT=300
515
if [ x$BINARY_DIST = x1 ] ; then
516
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --gdb option"
519
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
520
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
521
# This needs to be checked properly
526
if [ x$BINARY_DIST = x1 ] ; then
527
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --client-gdb option"
530
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
531
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
537
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
538
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
541
if [ x$BINARY_DIST = x1 ] ; then
542
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --ddd option"
546
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
547
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
549
--valgrind | --valgrind-all)
551
VALGRIND=$FIND_VALGRIND
552
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc"
553
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc"
554
SLEEP_TIME_AFTER_RESTART=10
555
SLEEP_TIME_FOR_DELETE=60
557
if test "$1" = "--valgrind-all"
559
VALGRIND="$VALGRIND -v --show-reachable=yes"
562
--valgrind-options=*)
563
TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
564
VALGRIND="$VALGRIND $TMP"
566
--skip-ndbcluster-slave | --skip-ndb-slave)
567
USE_NDBCLUSTER_SLAVE=""
568
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster"
570
--valgrind-mysqltest | --valgrind-mysqltest-all)
572
VALGRIND_MYSQLTEST=$FIND_VALGRIND
573
if test "$1" = "--valgrind-mysqltest-all"
575
VALGRIND_MYSQLTEST="$VALGRIND_MYSQLTEST -v --show-reachable=yes"
578
--skip-ndbcluster | --skip-ndb)
580
USE_NDBCLUSTER_SLAVE=""
581
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-ndbcluster"
582
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster"
584
--skip-master-binlog) MASTER_MYSQLDBINLOG=0 ;;
585
--skip-slave-binlog) SLAVE_MYSQLDBINLOG=0 ;;
587
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $1"
588
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $1"
594
EXTRA_MASTER_MYSQLD_TRACE=" \
595
--debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/master.trace"
596
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
597
--debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/slave.trace"
598
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT \
599
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqltest.trace"
600
EXTRA_MYSQLCHECK_OPT="$EXTRA_MYSQLCHECK_OPT \
601
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlcheck.trace"
602
EXTRA_MYSQLDUMP_OPT="$EXTRA_MYSQLDUMP_OPT \
603
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqldump.trace"
604
EXTRA_MYSQLSLAP_OPT="$EXTRA_MYSQLSLAP_OPT \
605
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlslap.trace"
606
EXTRA_MYSQLSHOW_OPT="$EXTRA_MYSQLSHOW_OPT \
607
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlshow.trace"
608
EXTRA_MYSQLBINLOG_OPT="$EXTRA_MYSQLBINLOG_OPT \
609
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlbinlog.trace"
610
EXTRA_MYSQL_CLIENT_TEST_OPT="--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysql_client_test.trace"
619
TMP=`$ECHO "$1" | $SED -e "s;--comment=;;"`
621
echo '############################################'
623
echo '############################################'
626
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
632
if [ -z "$TEST_MODE" ] ; then
635
# Remove the leading space if any
636
TEST_MODE=`echo $TEST_MODE | sed 's/^ *//'`
640
# Skip tests that doesn't work with shell version
642
SKIP_TEST="$SKIP_TEST bootstrap"
645
# mysqld Environment Parameters
648
MYRUN_DIR=$MYSQL_TEST_DIR/var/run
650
MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data"
651
MASTER_MYSOCK="$MYSQL_TMP_DIR/master.sock"
652
MASTER_MYSOCK1=$MYSQL_MYSOCK"1"
653
MASTER_MYPID="$MYRUN_DIR/master.pid"
654
MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/master.log"
655
MASTER_MYERR="$MYSQL_TEST_DIR/var/log/master.err"
657
SLAVE_MYDDIR="$MYSQL_TEST_DIR/var/slave-data"
658
SLAVE_MYSOCK="$MYSQL_TMP_DIR/slave.sock"
659
SLAVE_MYPID="$MYRUN_DIR/slave.pid"
660
SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/slave.log"
661
SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
663
CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
664
SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
666
export MASTER_MYHOST MASTER_MYPORT SLAVE_MYHOST SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
668
NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --data-dir=$MYSQL_TEST_DIR/var --ndb_mgm-extra-opts=$NDB_MGM_EXTRA_OPTS --ndb_mgmd-extra-opts=$NDB_MGMD_EXTRA_OPTS --ndbd-extra-opts=$NDBD_EXTRA_OPTS"
669
NDBCLUSTER_OPTS_SLAVE="--port=$NDBCLUSTER_PORT_SLAVE --data-dir=$MYSQL_TEST_DIR/var"
670
if [ -n "$USE_NDBCLUSTER_SLAVE" ] ; then
671
USE_NDBCLUSTER_SLAVE="$USE_NDBCLUSTER_SLAVE --ndb-connectstring=localhost:$NDBCLUSTER_PORT_SLAVE --ndb-extra-logging"
673
NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT
674
NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log
676
if [ x$SOURCE_DIST = x1 ] ; then
677
MY_BASEDIR=$MYSQL_TEST_DIR
682
# Create the directories
684
# This should be fixed to be not be dependent on the contence of MYSQL_TMP_DIR
686
# (mkdir -p is not portable)
687
[ -d $MYSQL_TEST_DIR/var ] || mkdir $MYSQL_TEST_DIR/var
688
[ -d $MYSQL_TEST_DIR/var/tmp ] || mkdir $MYSQL_TEST_DIR/var/tmp
689
[ -d $MYSQL_TEST_DIR/var/run ] || mkdir $MYSQL_TEST_DIR/var/run
690
[ -d $MYSQL_TEST_DIR/var/log ] || mkdir $MYSQL_TEST_DIR/var/log
692
# Use 'test', not '[' as the shell builtin might not have '-L
693
if test ! -L "$MYSQL_TEST_DIR/var/std_data_ln" ; then
694
ln -s $MYSQL_TEST_DIR/std_data/ $MYSQL_TEST_DIR/var/std_data_ln
697
if test ${COLUMNS:-0} -lt 80 ; then COLUMNS=80 ; fi
698
E=`$EXPR $COLUMNS - 8`
699
DASH72=`$ECHO '-------------------------------------------------------'|$CUT -c 1-$E`
701
# on source dist, we pick up freshly build executables
702
# on binary, use what is installed
703
if [ x$SOURCE_DIST = x1 ] ; then
704
if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
705
if [ -f "$BASEDIR/libmysqld/examples/mysqltest_embedded" ] ; then
706
MYSQL_TEST="$BASEDIR/libmysqld/examples/mysqltest_embedded"
708
echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2
711
MYSQL_CLIENT_TEST="$BASEDIR/libmysqld/examples/mysql_client_test_embedded"
713
MYSQLD="$BASEDIR/sql/mysqld"
714
if [ -n "$VALGRIND" ] ; then
715
MYSQLD="$VALGRIND $MYSQLD"
717
if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
718
MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
719
elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then
720
MYSQL_TEST="$BASEDIR/client/.libs/mysqltest"
722
MYSQL_TEST="$BASEDIR/client/mysqltest"
724
MYSQL_CLIENT_TEST="$BASEDIR/tests/mysql_client_test"
726
if [ -f "$BASEDIR/client/.libs/mysqlcheck" ] ; then
727
MYSQL_CHECK="$BASEDIR/client/.libs/mysqlcheck"
729
MYSQL_CHECK="$BASEDIR/client/mysqlcheck"
731
if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
732
MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
734
MYSQL_DUMP="$BASEDIR/client/mysqldump"
736
if [ -f "$BASEDIR/client/.libs/mysqlslap" ] ; then
737
MYSQL_SLAP="$BASEDIR/client/.libs/mysqlslap"
739
MYSQL_SLAP="$BASEDIR/client/mysqlslap"
741
if [ -f "$BASEDIR/client/.libs/mysqlimport" ] ; then
742
MYSQL_IMPORT="$BASEDIR/client/.libs/mysqlimport"
744
MYSQL_IMPORT="$BASEDIR/client/mysqlimport"
746
if [ -f "$BASEDIR/client/.libs/mysqlshow" ] ; then
747
MYSQL_SHOW="$BASEDIR/client/.libs/mysqlshow"
749
MYSQL_SHOW="$BASEDIR/client/mysqlshow"
751
if [ -f "$BASEDIR/client/.libs/mysqlbinlog" ] ; then
752
MYSQL_BINLOG="$BASEDIR/client/.libs/mysqlbinlog"
754
MYSQL_BINLOG="$BASEDIR/client/mysqlbinlog"
756
if [ -n "$STRACE_CLIENT" ]; then
757
MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST"
760
CLIENT_BINDIR="$BASEDIR/client"
761
MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
762
WAIT_PID="$BASEDIR/extra/mysql_waitpid"
763
MYSQL_MY_PRINT_DEFAULTS="$BASEDIR/extra/my_print_defaults"
764
MYSQL="$CLIENT_BINDIR/mysql"
765
LANGUAGE="$BASEDIR/sql/share/english/"
766
CHARSETSDIR="$BASEDIR/sql/share/charsets"
767
INSTALL_DB="./install_test_db"
768
MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/scripts/mysql_fix_privilege_tables"
769
NDB_TOOLS_DIR="$BASEDIR/storage/ndb/tools"
770
NDB_MGM="$BASEDIR/storage/ndb/src/mgmclient/ndb_mgm"
772
if [ -n "$USE_PURIFY" ] ; then
773
PSUP="$MYSQL_TEST_DIR/suppress.purify"
774
PURIFYOPTIONS="-windows=no -log-file=%v.purifylog -append-logfile -add-suppression-files=$PSUP"
775
if [ -f "${MYSQL_TEST}-purify" ] ; then
776
MYSQL_TEST="${MYSQL_TEST}-purify"
777
PLOG="$MYSQL_TEST.purifylog"
778
if [ -f $PLOG ]; then
783
if [ -f "${MYSQLD}-purify" ] ; then
784
MYSQLD="${MYSQLD}-purify"
785
PLOG="$MYSQLD.purifylog"
786
if [ -f $PLOG ]; then
789
PURIFY_LOGS="$PURIFY_LOGS $PLOG"
795
# We have a binary installation. Note that this can be both from
796
# unpacking a MySQL AB binary distribution (created using
797
# "scripts/make_binary_distribution", and from a "make install".
798
# Unfortunately the structure differs a bit, for a "make install"
799
# currently all binaries are in "bin", for a MySQL AB packaging
800
# some are in "tests".
802
if test -x "$BASEDIR/libexec/mysqld"
804
MYSQLD="$VALGRIND $BASEDIR/libexec/mysqld"
805
elif test -x "$BASEDIR/bin/mysqld"
807
MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
808
elif test -x "$BASEDIR/sbin/mysqld"
810
MYSQLD="$VALGRIND $BASEDIR/sbin/mysqld"
812
$ECHO "Fatal error: Cannot find program mysqld in $BASEDIR/{libexec,bin,sbin}" 1>&2
815
CLIENT_BINDIR="$BASEDIR/bin"
816
if test -d "$BASEDIR/tests"
818
TESTS_BINDIR="$BASEDIR/tests"
820
TESTS_BINDIR="$BASEDIR/bin"
822
MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
823
MYSQL_CHECK="$CLIENT_BINDIR/mysqlcheck"
824
MYSQL_SLAP="$CLIENT_BINDIR/mysqlslap"
825
MYSQL_SHOW="$CLIENT_BINDIR/mysqlshow"
826
MYSQL_IMPORT="$CLIENT_BINDIR/mysqlimport"
827
MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog"
828
MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
829
WAIT_PID="$CLIENT_BINDIR/mysql_waitpid"
830
MYSQL_MY_PRINT_DEFAULTS="$CLIENT_BINDIR/my_print_defaults"
831
MYSQL="$CLIENT_BINDIR/mysql"
832
INSTALL_DB="./install_test_db --bin"
833
MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables"
834
NDB_TOOLS_DIR="$CLIENT_BINDIR"
835
NDB_MGM="$CLIENT_BINDIR/ndb_mgm"
836
if test -d "$BASEDIR/share/mysql/english"
838
LANGUAGE="$BASEDIR/share/mysql/english/"
839
CHARSETSDIR="$BASEDIR/share/mysql/charsets"
841
LANGUAGE="$BASEDIR/share/english/"
842
CHARSETSDIR="$BASEDIR/share/charsets"
844
if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
845
if [ -f "$CLIENT_BINDIR/mysqltest_embedded" ] ; then
846
MYSQL_TEST="$CLIENT_BINDIR/mysqltest_embedded"
848
echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2
851
if [ -d "$BASEDIR/tests/mysql_client_test_embedded" ] ; then
852
MYSQL_CLIENT_TEST="$TESTS_BINDIR/mysql_client_test_embedded"
854
MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test_embedded"
857
MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
858
MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test"
860
if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
861
MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
862
elif [ -f "$BASEDIR/client/mysqldump" ] ; then
863
MYSQL_DUMP="$BASEDIR/client/mysqldump"
865
MYSQL_DUMP="$BASEDIR/bin/mysqldump"
869
if [ -z "$MASTER_MYSQLD" ]
871
MASTER_MYSQLD=$MYSQLD
874
if [ -z "$SLAVE_MYSQLD" ]
879
# If we should run all tests cases, we will use a local server for that
881
if [ -z "$1" -a -z "$DO_STRESS" ]
885
if [ $USE_RUNNING_SERVER -eq 1 ]
887
DBUSER=${DBUSER:-test}
889
DBUSER=${DBUSER:-root} # We want to do FLUSH xxx commands
894
# We are running as root; We need to add the --root argument
895
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --user=root"
896
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --user=root"
899
MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent $EXTRA_MYSQL_CLIENT_TEST_OPT"
900
# Need to pass additional arguments to MYSQL_CLIENT_TEST for embedded server
901
# -A marks each argument for passing to the function which initializes the
903
if [ "x$USE_EMBEDDED_SERVER" = "x1" ]; then
904
MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST -A --language=$LANGUAGE -A --datadir=$SLAVE_MYDDIR -A --character-sets-dir=$CHARSETSDIR"
906
# Save path and name of mysqldump
907
MYSQL_DUMP_DIR="$MYSQL_DUMP"
908
export MYSQL_DUMP_DIR
909
MYSQL_CHECK="$MYSQL_CHECK --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLCHECK_OPT"
910
MYSQL_DUMP="$MYSQL_DUMP --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
911
MYSQL_SLAP="$MYSQL_SLAP -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSLAP_OPT"
912
MYSQL_DUMP_SLAVE="$MYSQL_DUMP_DIR --no-defaults -uroot --socket=$SLAVE_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
913
MYSQL_SHOW="$MYSQL_SHOW --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT"
914
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --debug-info --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
915
MYSQL_IMPORT="$MYSQL_IMPORT --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
916
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
917
MYSQL="$MYSQL --no-defaults --debug-info --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
918
export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_DUMP_SLAVE MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT
919
export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR MYSQL_MY_PRINT_DEFAULTS
923
export NDB_BACKUP_DIR
924
export NDB_TOOLS_OUTPUT
928
NDB_SLAVE_STATUS_OK=1
929
export NDB_SLAVE_STATUS_OK
930
export NDB_EXTRA_TEST NDBCLUSTER_PORT NDBCLUSTER_PORT_SLAVE
932
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
933
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
934
--tmpdir=$MYSQL_TMP_DIR --port=$MASTER_MYPORT $MYSQL_TEST_SSL_OPTS"
935
if [ x$USE_TIMER = x1 ] ; then
936
MYSQL_TEST_ARGS="$MYSQL_TEST_ARGS --timer-file=$MY_LOG_DIR/timer"
938
MYSQL_TEST_BIN=$MYSQL_TEST
939
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
941
# Export MYSQL_TEST variable for use from .test files
944
GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
945
GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
946
GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
947
GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out
948
GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err
949
GPROF_DIR=$MYSQL_TMP_DIR/gprof
950
GPROF_MASTER=$GPROF_DIR/master.gprof
951
GPROF_SLAVE=$GPROF_DIR/slave.gprof
952
TIMEFILE="$MYSQL_TEST_DIR/var/log/mysqltest-time"
953
MYSQLTEST_LOG="$MYSQL_TEST_DIR/var/log/mysqltest.log"
954
if [ -n "$DO_CLIENT_GDB" -o -n "$DO_GDB" ] ; then
958
export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR MASTER_MYSOCK
961
# Function Definitions
970
# We can't use diff -u or diff -a as these are not portable
974
reject_file=r/$1.reject
975
result_file=r/$1.result
980
result_file=$eval_file
983
if [ -x "$DIFF" ] && [ -f $reject_file ]
985
echo "Below are the diffs between actual and expected results:"
986
echo "-------------------------------------------------------"
987
$DIFF -c $result_file $reject_file
988
echo "-------------------------------------------------------"
989
echo "Please follow the instructions outlined at"
990
echo "http://forge.mysql.com/wiki/MySQL_Internals_Porting#Debugging_a_MySQL_Server"
991
echo "to find the reason to this problem and how to report this."
998
mysql_test_args="$MYSQL_TEST_ARGS $1"
999
$ECHO "set args $mysql_test_args < $2" > $GDB_CLIENT_INIT
1000
echo "Set breakpoints ( if needed) and type 'run' in gdb window"
1001
#this xterm should not be backgrounded
1002
$XTERM -title "Client" -e gdb -x $GDB_CLIENT_INIT $MYSQL_TEST_BIN
1011
$ECHO "Errors are (from $TIMEFILE) :"
1013
$ECHO "(the last lines may be the most important ones)"
1017
$ECHO " $1" | $SED -e 's:.*\(........\)$:\1:'
1021
TOT_PASS=`$EXPR $TOT_PASS + 1`
1025
TOT_FAIL=`$EXPR $TOT_FAIL + 1`
1029
TOT_SKIP=`$EXPR $TOT_SKIP + 1`
1033
TOT_TEST=`$EXPR $TOT_TEST + 1`
1041
pname=`$ECHO "$1 "|$CUT -c 1-24`
1044
$ECHO "$RES$RES_SPACE [ skipped ]"
1052
pname=`$ECHO "$1 "|$CUT -c 1-24`
1055
$ECHO "$RES$RES_SPACE [ disabled ] $2"
1059
report_current_test () {
1061
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
1062
eval "master1_running=\$MASTER1_RUNNING"
1063
if [ x$master1_running = x1 ] ; then
1064
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
1066
if [ -n "$PURIFY_LOGS" ] ; then
1067
for log in $PURIFY_LOGS
1069
echo "CURRENT_TEST: $tname" >> $log
1076
if [ $TOT_FAIL = 0 ]; then
1077
$ECHO "All $TOT_TEST tests were successful."
1079
xten=`$EXPR $TOT_PASS \* 10000`
1080
raw=`$EXPR $xten / $TOT_TEST`
1081
raw=`$PRINTF %.4d $raw`
1082
whole=`$PRINTF %.2s $raw`
1083
xwhole=`$EXPR $whole \* 100`
1084
deci=`$EXPR $raw - $xwhole`
1085
$ECHO "Failed ${TOT_FAIL}/${TOT_TEST} tests, ${whole}.${deci}% were successful."
1087
$ECHO "The log files in $MY_LOG_DIR may give you some hint"
1088
$ECHO "of what went wrong."
1089
$ECHO "If you want to report this error, please read first the documentation at"
1090
$ECHO "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html"
1093
if [ $USE_RUNNING_SERVER -eq 0 ]
1096
# Report if there was any fatal warnings/errors in the log files
1098
$RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp
1099
# Remove some non fatal warnings from the log files
1100
$SED -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' -e 's|InnoDB: Warning: we did not need to do crash recovery||g' \
1102
| $SED -e 's!Warning: Table:.* on rename!!g' \
1103
> $MY_LOG_DIR/warnings.tmp
1106
for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning" "missing DBUG_RETURN" "mysqld: Warning" "Attempting backtrace" "Assertion .* failed"
1108
if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
1113
$RM -f $MY_LOG_DIR/warnings.tmp
1114
if [ $GOT_WARNINGS = "1" ]
1116
echo "WARNING: Got errors/warnings while running tests. Please examine"
1117
echo "$MY_LOG_DIR/warnings for details."
1120
fi # USE_RUNNING_SERVER
1122
# Check valgrind errors from mysqltest
1123
if [ ! -z "$VALGRIND_MYSQLTEST" ]
1125
if $GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors" > /dev/null
1127
$ECHO "Valgrind detected errors!"
1128
$GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors"
1129
$ECHO "See $MYSQLTEST_LOG"
1134
mysql_install_db () {
1135
$ECHO "Removing Stale Files"
1136
if [ -z "$USE_OLD_DATA" ]; then
1137
$RM -rf $MASTER_MYDDIR $MASTER_MYDDIR"1"
1138
$ECHO "Installing Master Databases"
1140
if [ $? != 0 ]; then
1141
error "Could not install master test DBs"
1145
if [ ! -z "$USE_NDBCLUSTER" ]
1147
$ECHO "Installing Master Databases 1"
1149
$RM -rf var/master-data1
1150
mkdir var/master-data1
1151
cp -r var/master-data/* var/master-data1
1152
if [ $? != 0 ]; then
1153
error "Could not install master test DBs 1"
1157
$ECHO "Installing Slave Databases"
1158
$RM -rf $SLAVE_MYDDIR $MY_LOG_DIR/*
1159
# $INSTALL_DB -slave
1160
mkdir var/slave-data
1161
cp -r var/master-data/* var/slave-data
1162
if [ $? != 0 ]; then
1163
error "Could not install slave test DBs"
1167
for slave_num in 1 2 ;
1169
$RM -rf var/slave$slave_num-data
1170
mkdir -p var/slave$slave_num-data/mysql
1171
mkdir -p var/slave$slave_num-data/test
1172
cp var/slave-data/mysql/* var/slave$slave_num-data/mysql
1185
if [ -f $MASTER_MYDDIR/gmon.out ]; then
1186
gprof $MASTER_MYSQLD $MASTER_MYDDIR/gmon.out > $GPROF_MASTER
1187
echo "Master execution profile has been saved in $GPROF_MASTER"
1189
if [ -f $SLAVE_MYDDIR/gmon.out ]; then
1190
gprof $SLAVE_MYSQLD $SLAVE_MYDDIR/gmon.out > $GPROF_SLAVE
1191
echo "Slave execution profile has been saved in $GPROF_SLAVE"
1196
$FIND $BASEDIR -name \*.gcov \
1197
-or -name \*.da | $XARGS $RM
1201
$ECHO "Collecting source coverage info..."
1202
[ -f $GCOV_MSG ] && $RM $GCOV_MSG
1203
[ -f $GCOV_ERR ] && $RM $GCOV_ERR
1204
for d in $MYSQLD_SRC_DIRS; do
1206
for f in *.h *.cc *.c; do
1207
$GCOV $f 2>>$GCOV_ERR >>$GCOV_MSG
1212
$ECHO "gcov info in $GCOV_MSG, errors in $GCOV_ERR"
1217
if [ ! $? = 0 ] ; then
1223
launch_in_background()
1226
echo $@ | /bin/sh >> $CUR_MYERR 2>&1 &
1235
# Shutdown time must be high as slave may be in reconnect
1236
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
1238
# Some systems require an extra connect
1239
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
1249
if [ ! -n "$USE_NDBCLUSTER" ] ;
1255
if [ x$USING_NDBCLUSTER = x1 -a -z "$USE_NDBCLUSTER_OPT" ]
1257
rm -f $NDB_TOOLS_OUTPUT
1258
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
1260
if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ]
1262
NDBCLUSTER_EXTRA_OPTS="--small"
1264
OPTS="$NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR --verbose=$NDB_VERBOSE --initial --relative-config-data-dir --core"
1265
if [ "x$NDB_VERBOSE" != "x0" ] ; then
1266
echo "Starting master ndbcluster " $OPTS
1268
./ndb/ndbcluster $OPTS || NDB_STATUS_OK=0
1269
if [ x$NDB_STATUS_OK != x1 ] ; then
1270
if [ x$FORCE != x1 ] ; then
1278
NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT"
1280
NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
1281
echo "Using ndbcluster at $NDB_CONNECTSTRING"
1283
USE_NDBCLUSTER_OPT="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\" --ndb-extra-logging"
1284
export NDB_CONNECTSTRING
1288
rm_ndbcluster_tables()
1290
$RM -f $1/mysql/apply_status*
1291
$RM -f $1/mysql/schema*
1296
if [ -n "$USE_NDBCLUSTER_OPT" ]
1299
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
1301
# Kill any running ndbcluster stuff
1302
$ECHO "Stopping master cluster"
1303
./ndb/ndbcluster $NDBCLUSTER_OPTS --stop
1304
# remove ndb table the hard way as not to upset later tests
1305
rm_ndbcluster_tables $MASTER_MYDDIR
1306
rm_ndbcluster_tables $MASTER_MYDDIR"1"
1311
# The embedded server needs the cleanup so we do some of the start work
1312
# but stop before actually running mysqld or anything.
1316
eval "this_master_running=\$MASTER$1_RUNNING"
1317
if [ x$this_master_running = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
1320
# Remove stale binary logs except for 2 tests which need them
1321
if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
1323
$RM -f $MYSQL_TEST_DIR/var/log/master-bin$1.*
1326
# Remove old master.info and relay-log.info files
1327
$RM -f $MYSQL_TEST_DIR/var/master-data$1/master.info $MYSQL_TEST_DIR/var/master-data$1/relay-log.info
1329
#run master initialization shell script if one exists
1331
if [ -f "$master_init_script" ] ;
1333
/bin/sh $master_init_script
1335
cd $BASEDIR # for gcov
1336
if [ -n "$1" ] ; then
1337
id=`$EXPR $1 + 101`;
1338
this_master_myport=`$EXPR $MASTER_MYPORT + $1`
1339
NOT_FIRST_MASTER_EXTRA_OPTS="--skip-innodb"
1340
eval "MASTER_MYPORT$1=$this_master_myport"
1341
export MASTER_MYPORT$1
1344
this_master_myport=$MASTER_MYPORT
1345
NOT_FIRST_MASTER_EXTRA_OPTS=""
1347
if [ -n "$EXTRA_MASTER_MYSQLD_TRACE" ]
1349
CURR_MASTER_MYSQLD_TRACE="$EXTRA_MASTER_MYSQLD_TRACE$1"
1351
if [ x$MASTER_MYSQLDBINLOG = x1 ]
1353
MASTER_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1"
1355
if [ -z "$DO_BENCH" -a -z "$DO_STRESS" ]
1357
master_args="--no-defaults \
1359
--basedir=$MY_BASEDIR \
1360
--port=$this_master_myport \
1361
--port-open-timeout=380 \
1365
$USE_NDBCLUSTER_OPT \
1366
--datadir=$MASTER_MYDDIR$1 \
1367
--pid-file=$MASTER_MYPID$1 \
1368
--socket=$MASTER_MYSOCK$1 \
1369
--log=$MASTER_MYLOG$1 \
1370
--character-sets-dir=$CHARSETSDIR \
1371
--default-character-set=$CHARACTER_SET \
1372
--tmpdir=$MYSQL_TMP_DIR \
1373
--language=$LANGUAGE \
1374
--innodb_data_file_path=ibdata1:128M:autoextend \
1375
--open-files-limit=1024 \
1376
--log-bin-trust-function-creators \
1379
$MASTER_MYSQLD_BINLOG_OPT \
1380
$EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
1381
$NOT_FIRST_MASTER_EXTRA_OPTS $CURR_MASTER_MYSQLD_TRACE"
1383
master_args="--no-defaults \
1384
--server-id=$id --rpl-recovery-rank=1 \
1385
--basedir=$MY_BASEDIR --init-rpl-role=master \
1386
--port=$this_master_myport \
1387
--port-open-timeout=380 \
1389
--datadir=$MASTER_MYDDIR$1 \
1390
--pid-file=$MASTER_MYPID$1 \
1391
--socket=$MASTER_MYSOCK$1 \
1392
--character-sets-dir=$CHARSETSDIR \
1393
--default-character-set=$CHARACTER_SET \
1395
$USE_NDBCLUSTER_OPT \
1396
--tmpdir=$MYSQL_TMP_DIR \
1397
--language=$LANGUAGE \
1398
--innodb_data_file_path=ibdata1:128M:autoextend \
1399
--log-bin-trust-function-creators \
1402
$MASTER_MYSQLD_BINLOG_OPT \
1403
$EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
1404
$NOT_FIRST_MASTER_EXTRA_OPTS"
1407
CUR_MYERR=$MASTER_MYERR$1
1408
CUR_MYSOCK=$MASTER_MYSOCK$1
1410
# For embedded server we collect the server flags and return
1411
if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
1412
# Add a -A to each argument to pass it to embedded server
1413
EMBEDDED_SERVER_OPTS=""
1414
for opt in $master_args
1416
EMBEDDED_SERVER_OPTS="$EMBEDDED_SERVER_OPTS -A $opt"
1418
EXTRA_MYSQL_TEST_OPT="$EMBEDDED_SERVER_OPTS"
1422
if [ x$DO_DDD = x1 ]
1424
$ECHO "set args $master_args" > $GDB_MASTER_INIT$1
1425
launch_in_background master ddd -display $DISPLAY --debugger \
1426
"gdb -x $GDB_MASTER_INIT$1" $MASTER_MYSQLD
1427
elif [ x$DO_GDB = x1 ]
1429
if [ x$MANUAL_GDB = x1 ]
1431
$ECHO "set args $master_args" > $GDB_MASTER_INIT$1
1432
$ECHO "To start gdb for the master , type in another window:"
1433
$ECHO "cd $MYSQL_TEST_DIR ; gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD"
1434
wait_for_master=1500
1436
( $ECHO set args $master_args;
1437
if [ $USE_MANAGER = 0 ] ; then
1445
fi ) > $GDB_MASTER_INIT$1
1446
launch_in_background master $XTERM -display $DISPLAY \
1447
-title "Master" -e gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD
1450
launch_in_background master $MASTER_MYSQLD $master_args
1452
sleep_until_file_created $MASTER_MYPID$1 $wait_for_master
1453
wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER
1454
eval "MASTER$1_RUNNING=1"
1459
[ x$SKIP_SLAVE = x1 ] && return
1460
eval "this_slave_running=\$SLAVE$1_RUNNING"
1461
[ x$this_slave_running = 1 ] && return
1463
# When testing fail-safe replication, we will have more than one slave
1464
# in this case, we start secondary slaves with an argument
1465
slave_ident="slave$1"
1468
slave_server_id=`$EXPR 2 + $1`
1469
slave_rpl_rank=$slave_server_id
1470
slave_port=`expr $SLAVE_MYPORT + $1`
1471
slave_log="$SLAVE_MYLOG.$1"
1472
slave_err="$SLAVE_MYERR.$1"
1473
slave_datadir="$SLAVE_MYDDIR/../$slave_ident-data/"
1474
slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid"
1475
slave_sock="$SLAVE_MYSOCK-$1"
1479
slave_port=$SLAVE_MYPORT
1480
slave_log=$SLAVE_MYLOG
1481
slave_err=$SLAVE_MYERR
1482
slave_datadir=$SLAVE_MYDDIR
1483
slave_pid=$SLAVE_MYPID
1484
slave_sock="$SLAVE_MYSOCK"
1488
if [ x$USING_NDBCLUSTER = x1 -a -n "$USE_NDBCLUSTER_SLAVE" ] ; then
1489
if [ $slave_server_id -eq 2 ] ; then
1492
if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ]
1494
NDBCLUSTER_EXTRA_OPTS="--small"
1497
OPTS="$NDBCLUSTER_OPTS_SLAVE --initial $NDBCLUSTER_EXTRA_OPTS --ndbd-nodes=1 --verbose=$NDB_VERBOSE --relative-config-data-dir --core"
1498
if [ "x$NDB_VERBOSE" != "x0" ] ; then
1499
echo "Starting slave ndbcluster " $OPTS
1501
./ndb/ndbcluster $OPTS \
1502
|| NDB_SLAVE_STATUS_OK=0
1503
# > /dev/null 2>&1 || NDB_SLAVE_STATUS_OK=0
1505
if [ x$NDB_SLAVE_STATUS_OK != x1 ] ; then
1506
if [ x$FORCE != x1 ] ; then
1509
USE_NDBCLUSTER_SLAVE_OPT=
1510
USE_NDBCLUSTER_SLAVE=
1512
USE_NDBCLUSTER_SLAVE_OPT=$USE_NDBCLUSTER_SLAVE
1515
USE_NDBCLUSTER_SLAVE_OPT=
1518
# Remove stale binary logs and old master.info files
1519
# except for too tests which need them
1520
if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
1522
$RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-*bin.*
1523
$RM -f $slave_datadir/master.info $slave_datadir/relay-log.info
1526
#run slave initialization shell script if one exists
1527
if [ -f "$slave_init_script" ] ;
1529
/bin/sh $slave_init_script
1532
if [ -z "$SLAVE_MASTER_INFO" ] ; then
1533
master_info="--master-user=root \
1534
--master-connect-retry=1 \
1535
--master-host=127.0.0.1 \
1536
--master-password="" \
1537
--master-port=$MASTER_MYPORT \
1538
--server-id=$slave_server_id --rpl-recovery-rank=$slave_rpl_rank"
1540
master_info=$SLAVE_MASTER_INFO
1543
if [ x$SLAVE_MYSQLDBINLOG = x1 ]
1545
SLAVE_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin --log-slave-updates"
1548
$RM -f $slave_datadir/log.*
1549
slave_args="--no-defaults $master_info \
1551
$SLAVE_MYSQLDBINLOG_OPT \
1552
--relay-log=$MYSQL_TEST_DIR/var/log/$slave_ident-relay-bin \
1554
--basedir=$MY_BASEDIR \
1555
--datadir=$slave_datadir \
1556
--pid-file=$slave_pid \
1557
--port=$slave_port \
1558
--port-open-timeout=380 \
1559
--socket=$slave_sock \
1560
--character-sets-dir=$CHARSETSDIR \
1561
--default-character-set=$CHARACTER_SET \
1562
--core --init-rpl-role=slave \
1563
--tmpdir=$MYSQL_TMP_DIR \
1564
--language=$LANGUAGE \
1565
--skip-innodb --skip-ndbcluster --skip-slave-start \
1566
--slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \
1567
--report-host=127.0.0.1 --report-user=root \
1568
--report-port=$slave_port \
1569
--master-retry-count=10 \
1570
-O slave_net_timeout=10 \
1571
--log-bin-trust-function-creators \
1573
$SLAVE_MYSQLD_BINLOG_OPT \
1574
$EXTRA_SLAVE_MYSQLD_OPT $EXTRA_SLAVE_OPT \
1575
$USE_NDBCLUSTER_SLAVE_OPT"
1576
CUR_MYERR=$slave_err
1577
CUR_MYSOCK=$slave_sock
1579
if [ x$DO_DDD = x1 ]
1581
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
1582
launch_in_background $slave_ident ddd -display $DISPLAY --debugger \
1583
"gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD
1584
elif [ x$DO_GDB = x1 ]
1586
if [ x$MANUAL_GDB = x1 ]
1588
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
1589
echo "To start gdb for the slave, type in another window:"
1590
echo "cd $MYSQL_TEST_DIR ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD"
1593
( $ECHO set args $slave_args;
1594
if [ $USE_MANAGER = 0 ] ; then
1602
fi ) > $GDB_SLAVE_INIT
1603
launch_in_background $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \
1604
gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD
1607
launch_in_background $slave_ident $SLAVE_MYSQLD $slave_args
1609
eval "SLAVE$1_RUNNING=1"
1610
sleep_until_file_created $slave_pid $wait_for_slave
1611
wait_for_slave=$SLEEP_TIME_FOR_SECOND_SLAVE
1616
# We should not start the daemon here as we don't know the arguments
1617
# for the test. Better to let the test start the daemon
1619
# $ECHO "Starting MySQL daemon"
1628
eval "this_slave_running=\$SLAVE$1_RUNNING"
1629
slave_ident="slave$1"
1632
slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid"
1634
slave_pid=$SLAVE_MYPID
1636
if [ x$this_slave_running = x1 ]
1638
pid=`$CAT $slave_pid`
1639
shutdown_mysqld $pid $slave_ident
1640
if [ $? != 0 ] && [ -f $slave_pid ]
1642
$ECHO "slave not cooperating with mysqladmin, will try manual kill"
1644
sleep_until_file_deleted $pid $slave_pid
1645
if [ -f $slave_pid ] ; then
1646
$ECHO "slave refused to die. Sending SIGKILL"
1647
kill -9 `$CAT $slave_pid`
1650
$ECHO "slave responded to SIGTERM "
1653
sleep $SLEEP_TIME_AFTER_RESTART
1655
eval "SLAVE$1_RUNNING=0"
1656
if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then
1659
$ECHO "Stopping slave cluster"
1660
./ndb/ndbcluster $NDBCLUSTER_OPTS_SLAVE --stop
1661
rm_ndbcluster_tables $SLAVE_MYDDIR
1667
stop_slave_threads ()
1669
eval "this_slave_running=\$SLAVE$1_RUNNING"
1670
slave_ident="slave$1"
1671
if [ x$this_slave_running = x1 ]
1673
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$slave_ident.sock stop-slave > /dev/null 2>&1
1679
eval "this_master_running=\$MASTER$1_RUNNING"
1680
if [ x$this_master_running = x1 ]
1682
# For embedded server we don't stop anyting but mark that
1683
# MASTER_RUNNING=0 to get cleanup when calling start_master().
1684
if [ x$USE_EMBEDDED_SERVER != x1 ] ; then
1685
pid=`$CAT $MASTER_MYPID$1`
1686
shutdown_mysqld $pid master $1
1687
if [ $? != 0 ] && [ -f $MASTER_MYPID$1 ]
1689
$ECHO "master not cooperating with mysqladmin, will try manual kill"
1691
sleep_until_file_deleted $pid $MASTER_MYPID$1
1692
if [ -f $MASTER_MYPID$1 ] ; then
1693
$ECHO "master refused to die. Sending SIGKILL"
1694
kill -9 `$CAT $MASTER_MYPID$1`
1695
$RM -f $MASTER_MYPID$1
1697
$ECHO "master responded to SIGTERM "
1700
sleep $SLEEP_TIME_AFTER_RESTART
1703
eval "MASTER$1_RUNNING=0"
1709
if [ "$MASTER_RUNNING" = 1 ]
1711
$ECHO "Ending Tests"
1712
$ECHO "Shutting-down MySQL daemon"
1716
$ECHO "Master shutdown finished"
1720
$ECHO "Slave shutdown finished"
1735
# cp $STD_DATA/*.frm $STD_DATA/*.MRG $MASTER_MYDDIR/test
1742
tname=`$BASENAME $tf .test`
1743
master_opt_file=$TESTDIR/$tname-master.opt
1744
slave_opt_file=$TESTDIR/$tname-slave.opt
1745
master_init_script=$TESTDIR/$tname-master.sh
1746
slave_init_script=$TESTDIR/$tname-slave.sh
1747
slave_master_info_file=$TESTDIR/$tname.slave-mi
1748
tsrcdir=$TESTDIR/$tname-src
1749
result_file="r/$tname.result"
1750
echo $tname > $CURRENT_TEST
1751
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0 \& \( $tname : federated \) = 0`
1752
NDBCLUSTER_TEST=`$EXPR \( $tname : '.*ndb.*' \) != 0`
1753
if [ "x$USE_NDBCLUSTER_ALL" = "x1" ] ; then
1756
if [ "x$USE_NDBCLUSTER_ONLY" = "x1" -a "x$NDBCLUSTER_TEST" != "x1" ] ; then
1760
if [ "$USE_MANAGER" = 1 ] ; then
1761
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
1763
if $EXPR "$tname" '<' "$START_FROM" > /dev/null ; then
1768
if [ "$SKIP_TEST" ] ; then
1769
if $EXPR \( "$tname" : "$SKIP_TEST" \) > /dev/null ; then
1775
if [ "$DO_TEST" ] ; then
1776
if $EXPR \( "$tname" : "$DO_TEST" \) > /dev/null ; then
1777
: #empty command to keep some shells happy
1784
if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ; then
1789
# if [ -f "$TESTDIR/$tname.disabled" ]
1791
# comment=`$CAT $TESTDIR/$tname.disabled`;
1792
# disable_test $tname "$comment"
1795
if [ -f "$TESTDIR/disabled.def" ] ; then
1796
comment=`$GREP "^$tname *: *" $TESTDIR/disabled.def`;
1797
if [ -n "$comment" ]
1799
comment=`echo $comment | sed 's/^[^:]*: *//'`
1800
disable_test $tname "$comment"
1805
if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then
1806
# Stop all slave threads, so that we don't have useless reconnection
1807
# attempts and error messages in case the slave and master servers restart.
1809
stop_slave_threads 1
1810
stop_slave_threads 2
1813
# FIXME temporary solution, we will get a new C version of this
1814
# script soon anyway so it is not worth it spending the time
1815
if [ "x$USE_EMBEDDED_SERVER" = "x1" -a -z "$DO_TEST" ] ; then
1820
if [ "$tname" = "$t" ] ; then
1827
if [ $USE_RUNNING_SERVER -eq 0 ] ;
1829
if [ -f $master_opt_file ] ;
1831
EXTRA_MASTER_OPT=`$CAT $master_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
1832
case "$EXTRA_MASTER_OPT" in
1834
TZ=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--timezone=;;"`
1836
# Note that this must be set to space, not "" for test-reset to work
1837
EXTRA_MASTER_OPT=" "
1840
result_file=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--result-file=;;"`
1841
result_file="r/$result_file.result"
1842
# Note that this must be set to space, not "" for test-reset to work
1843
EXTRA_MASTER_OPT=" "
1846
# Note that this must be set to space, not "" for test-reset to work
1847
EXTRA_MASTER_OPT=" "
1853
# only stop the cluster if this test will not use cluster
1854
if [ x$NDBCLUSTER_TEST != x1 ] ;
1859
report_current_test $tname
1860
USING_NDBCLUSTER=$NDBCLUSTER_TEST
1861
# start_ndbcluster knows if cluster is already started
1864
if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
1865
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
1868
TZ=$MY_TZ; export TZ
1870
# If we had extra master opts to the previous run
1871
# or there is no master running (FIXME strange.....)
1872
# or there is a master init script
1873
if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || \
1874
[ -f $master_init_script ] || \
1875
[ -n "$USE_NDBCLUSTER" -a x$NDBCLUSTER_TEST != x$USING_NDBCLUSTER ]
1881
# only stop the cluster if this test will not use cluster
1882
if [ x$NDBCLUSTER_TEST != x1 ] ;
1887
report_current_test $tname
1888
USING_NDBCLUSTER=$NDBCLUSTER_TEST
1889
# start_ndbcluster knows if cluster is already started
1892
if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
1893
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
1897
report_current_test $tname
1901
# We never start a slave if embedded server is used
1902
if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then
1904
if [ -f $slave_opt_file ] ;
1906
EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
1909
if [ ! -z "$EXTRA_SLAVE_OPT" ] || [ x$SLAVE_RUNNING != x1 ] ;
1916
if [ -f $slave_master_info_file ] ; then
1917
SLAVE_MASTER_INFO=`$CAT $slave_master_info_file`
1920
if [ ! -z "$SLAVE_MASTER_INFO" ] || [ x$SLAVE_RUNNING != x1 ] ;
1922
SLAVE_MASTER_INFO=""
1927
USING_NDBCLUSTER=$NDBCLUSTER_TEST
1928
if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then
1929
if [ x$USING_NDBCLUSTER != x1 ] ; then
1933
if [ x$USING_NDBCLUSTER = x1 ] ; then
1939
if [ x$do_slave_restart = x1 ] ; then
1941
echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
1944
echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
1946
if [ x$many_slaves = x1 ]; then
1953
if [ "x$START_AND_EXIT" = "x1" ] ; then
1954
echo "Servers started, exiting"
1960
if [ -f $tf ] ; then
1961
$RM -f r/$tname.*reject
1962
mysql_test_args="-R $result_file $EXTRA_MYSQL_TEST_OPT"
1963
if [ -z "$DO_CLIENT_GDB" ] ; then
1964
`$VALGRIND_MYSQLTEST $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`;
1966
do_gdb_test "$mysql_test_args" "$tf"
1971
# Save the testcase log to mysqltest log file
1972
echo "CURRENT_TEST: $tname" >> $MYSQLTEST_LOG
1973
cat $TIMEFILE >> $MYSQLTEST_LOG
1975
pname=`$ECHO "$tname "|$CUT -c 1-24`
1978
if [ x$many_slaves = x1 ] ; then
1983
if [ $res = 0 ]; then
1987
if [ x$USE_TIMER = x1 -a -f "$MY_LOG_DIR/timer" ]; then
1988
TIMER=`cat $MY_LOG_DIR/timer`
1989
TIMER=`$PRINTF "%13s" $TIMER`
1991
$ECHO "$RES$RES_SPACE [ pass ] $TIMER"
1993
# why the following ``if'' ? That is why res==1 is special ?
1994
if [ $res = 62 ]; then
1996
$ECHO "$RES$RES_SPACE [ skipped ]"
1998
if [ $res -ne 1 ]; then
1999
$ECHO "mysqltest returned unexpected code $res, it has probably crashed" >> $TIMEFILE
2003
$ECHO "$RES$RES_SPACE [ fail ]"
2006
show_failed_diff $tname
2008
if [ x$FORCE != x1 ] ; then
2009
$ECHO "Aborting: $tname failed in $TEST_MODE mode. To continue, re-run with '--force'."
2011
if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \
2012
[ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
2018
FAILED_CASES="$FAILED_CASES $tname"
2019
if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \
2020
[ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
2032
STRESS_BASEDIR="$MYSQL_TEST_DIR/var/stress"
2034
#Clean-up old stress test basedir
2035
if [ -d $STRESS_BASEDIR ] ; then
2036
$RM -rf $STRESS_BASEDIR
2038
#Create stress test basedir
2039
mkdir $STRESS_BASEDIR
2041
if [ "$STRESS_SUITE" != "main" -a "$STRESS_SUITE" != "default" ] ; then
2042
STRESS_SUITE_DIR="$MYSQL_TEST_DIR/suite/$STRESS_SUITE"
2044
STRESS_SUITE_DIR="$MYSQL_TEST_DIR"
2047
if [ -d "$STRESS_SUITE_DIR" ] ; then
2048
STRESS_SUITE_T_DIR="$STRESS_SUITE_DIR/t"
2049
STRESS_SUITE_R_DIR="$STRESS_SUITE_DIR/r"
2050
#FIXME: check that dirs above are exist
2052
echo "Directory $STRESS_SUITE_DIR with test suite doesn't exists. Abort stress testing"
2056
if [ -n "$STRESS_TEST" ] ; then
2057
STRESS_TEST_FILE="$STRESS_BASEDIR/stress_tests.txt"
2058
echo $STRESS_TEST > $STRESS_TEST_FILE
2059
elif [ -n "$STRESS_TEST_FILE" ] ; then
2060
STRESS_TEST_FILE="$STRESS_SUITE_DIR/$STRESS_TEST_FILE"
2061
if [ ! -f "$STRESS_TEST_FILE" ] ; then
2062
echo "Specified file $STRESS_TEST_FILE with list of tests does not exist"
2063
echo "Please ensure that file exists and has proper permissions"
2067
STRESS_TEST_FILE="$STRESS_SUITE_DIR/stress_tests.txt"
2068
if [ ! -f "$STRESS_TEST_FILE" ] ; then
2069
echo "Default file $STRESS_TEST_FILE with list of tests does not exist."
2070
echo "Please use --stress-test-file option to specify custom one or you can"
2071
echo "just specify name of test for testing as last argument in command line"
2076
if [ -n "$STRESS_INIT_FILE" ] ; then
2077
STRESS_INIT_FILE="$STRESS_SUITE_DIR/$STRESS_INIT_FILE"
2078
if [ ! -f "$STRESS_INIT_FILE" ] ; then
2079
echo "Specified file $STRESS_INIT_FILE with list of tests doesn't exist."
2080
echo "Please ensure that file exists and has proper permissions"
2084
STRESS_INIT_FILE="$STRESS_SUITE_DIR/stress_init.txt"
2085
#Check for default init file
2086
if [ ! -f "$STRESS_INIT_FILE" ] ; then
2091
if [ "$STRESS_MODE" != "random" -a "$STRESS_MODE" != "seq" ] ; then
2092
echo "You specified wrong mode '$STRESS_MODE' for stress test."
2093
echo "Correct values are 'random' or 'seq'"
2097
STRESS_TEST_ARGS="--server-socket=$MASTER_MYSOCK \
2098
--server-user=$DBUSER \
2099
--server-database=$DB \
2100
--stress-suite-basedir=$MYSQL_TEST_DIR \
2101
--suite=$STRESS_SUITE \
2102
--stress-tests-file=$STRESS_TEST_FILE \
2103
--stress-basedir=$STRESS_BASEDIR \
2104
--server-logs-dir=$STRESS_BASEDIR \
2105
--stress-mode=$STRESS_MODE \
2106
--mysqltest=$CLIENT_BINDIR/mysqltest \
2107
--threads=$STRESS_THREADS \
2110
--log-error-details \
2113
if [ -n "$STRESS_INIT_FILE" ] ; then
2114
STRESS_TEST_ARGS="$STRESS_TEST_ARGS --stress-init-file=$STRESS_INIT_FILE"
2117
if [ -z "$STRESS_LOOP_COUNT" -a -z "$STRESS_TEST_COUNT" -a
2118
-z "$STRESS_TEST_DURATION" ] ; then
2120
#Limit stress testing with 20 loops in case when any limit parameter
2122
STRESS_TEST_COUNT=20
2125
if [ -n "$STRESS_LOOP_COUNT" ] ; then
2126
STRESS_TEST_ARGS="$STRESS_TEST_ARGS --loop-count=$STRESS_LOOP_COUNT"
2129
if [ -n "$STRESS_TEST_COUNT" ] ; then
2130
STRESS_TEST_ARGS="$STRESS_TEST_ARGS --test-count=$STRESS_TEST_COUNT"
2133
if [ -n "$STRESS_TEST_DURATION" ] ; then
2134
STRESS_TEST_ARGS="$STRESS_TEST_ARGS --test-duration=$STRESS_TEST_DURATION"
2137
echo "Stress test related variables:"
2139
echo "STRESS - $DO_STRESS"
2140
echo "STRESS_SUITE - $STRESS_SUITE"
2141
echo "STRESS_TEST_FILE - $STRESS_TEST_FILE"
2142
echo "STRESS_INIT_FILE - $STRESS_INIT_FILE"
2143
echo "STRESS_THREADS - $STRESS_THREADS"
2144
echo "STRESS_MODE - $STRESS_MODE"
2145
echo "STRESS_TEST_COUNT - $STRESS_TEST_COUNT"
2146
echo "STRESS_LOOP_COUNT - $STRESS_LOOP_COUNT"
2147
echo "STRESS_TEST_DURATION - $STRESS_TEST_DURATION"
2149
#echo "$STRESS_TEST_ARGS";
2151
$MYSQL_TEST_DIR/mysql-stress-test.pl $STRESS_TEST_ARGS
2156
######################################################################
2157
# Main script starts here
2158
######################################################################
2160
[ "$DO_GCOV" -a ! -x "$GCOV" ] && error "No gcov found"
2162
[ "$DO_GCOV" ] && gcov_prepare
2163
[ "$DO_GPROF" ] && gprof_prepare
2165
if [ $USE_RUNNING_SERVER -eq 0 ]
2167
if [ -z "$FAST_START" ]
2169
# Ensure that no old mysqld test servers are running
2170
$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
2171
$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
2172
$MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
2173
$MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT --protocol=tcp -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
2174
$MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $MASTER_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
2175
$MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
2176
$MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
2177
sleep_until_file_deleted 0 $MASTER_MYPID
2178
sleep_until_file_deleted 0 $MASTER_MYPID"1"
2179
sleep_until_file_deleted 0 $SLAVE_MYPID
2181
rm $MASTER_MYPID $MASTER_MYPID"1" $SLAVE_MYPID
2184
# just to force stopping anything from previous runs
2185
USE_NDBCLUSTER_OPT=$USE_NDBCLUSTER
2188
# Remove files that can cause problems
2189
$RM -rf $MYSQL_TEST_DIR/var/ndbcluster
2190
$RM -rf $MYSQL_TEST_DIR/var/tmp/snapshot*
2191
$RM -rf $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
2193
# Remove old berkeley db log files that can confuse the server
2194
$RM -f $MASTER_MYDDIR/log.*
2195
$RM -f $MASTER_MYDDIR"1"/log.*
2197
# Remove old log and reject files
2198
$RM -f r/*.reject r/*.progress r/*.log r/*.warnings
2200
wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER
2201
wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE
2202
$ECHO "Installing Test Databases"
2205
if [ -n "$1" -a `expr "X$*" : '.*ndb'` -eq 0 ]
2212
$ECHO "Loading Standard Test Databases"
2216
$ECHO "Starting Tests"
2218
# Some test cases need USE_RUNNING_SERVER
2219
export USE_RUNNING_SERVER
2222
# This can probably be deleted
2224
if [ "$DO_BENCH" = 1 ]
2228
if [ "$DO_SMALL_BENCH" = 1 ]
2230
EXTRA_BENCH_ARGS="--small-test --small-tables"
2233
if [ x$USING_NDBCLUSTER = x1 ]
2235
EXTRA_BENCH_ARGS="--create-options=TYPE=ndb $EXTRA_BENCH_ARGS"
2238
BENCHDIR=$BASEDIR/sql-bench/
2243
./run-all-tests --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS --log
2247
./$1 --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS
2249
echo "benchmark $1 not found"
2260
if [ "$DO_STRESS" = 1 ]
2263
if [ -n "$1" ] ; then
2267
if [ $USE_RUNNING_SERVER -eq 0 ] ; then
2273
if [ $USE_RUNNING_SERVER -eq 0 ] ; then
2283
if [ x$USE_TIMER = x1 ] ; then
2284
$ECHO "TEST RESULT TIME (ms)"
2292
if [ x$RECORD = x1 ]; then
2293
$ECHO "Will not run in record mode without a specific test case."
2295
for tf in $TESTDIR/*.$TESTSUFFIX
2299
$RM -f $TIMEFILE # Remove for full test
2302
while [ ! -z "$1" ]; do
2303
tname=`$BASENAME $1 .test`
2304
tf=$TESTDIR/$tname.$TESTSUFFIX
2305
if [ -f $tf ] ; then
2308
$ECHO "Test case $tf does not exist."
2317
if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && [ -z "$DO_DDD" ]
2324
[ "$DO_GCOV" ] && gcov_collect # collect coverage information
2325
[ "$DO_GPROF" ] && gprof_collect # collect coverage information
2327
if [ $TOT_FAIL -ne 0 ]; then
2328
$ECHO "mysql-test-run in $TEST_MODE mode: *** Failing the test(s):$FAILED_CASES"
2332
if [ $GOT_WARNINGS -ne 0 ]; then