Commit 767e2ef6 authored by mwagner@evoq.home.mwagner.org's avatar mwagner@evoq.home.mwagner.org

Merge work:/home/bk/mysql

into evoq.home.mwagner.org:/opt/local/x1/work/bk/mysql
parents a23a5d98 ce9b8023
...@@ -4493,9 +4493,15 @@ China [linuxforum.net] @ ...@@ -4493,9 +4493,15 @@ China [linuxforum.net] @
@item @item
@c EMAIL: Vincent_Fong@innovator.com.hk (Vincent Fong) @c EMAIL: Vincent_Fong@innovator.com.hk (Vincent Fong)
@c @image{Flags/china} @c @image{Flags/china}
China [Hong Kong] @ China [ISL/Hong Kong] @
@uref{http://mysql.islnet.net, WWW} @uref{http://mysql.islnet.net, WWW}
@item
@c EMAIL: marquischan@hotmail.com (Marquis Chan)
@c @image{Flags/china}
China [TraLand.com/Hong Kong] @
@uref{http://www.traland.com/mysql/, WWW}
@c @item @c @item
@c Not ok 20000919; Non-existent (Matt) @c Not ok 20000919; Non-existent (Matt)
@c EMAIL: george@netfirm.net (Hongsheng Zhu) @c EMAIL: george@netfirm.net (Hongsheng Zhu)
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# mysql-test-run - originally written by Matt Wagner <matt@mysql.com> # mysql-test-run - originally written by Matt Wagner <matt@mysql.com>
# modified by Sasha Pachev <sasha@mysql.com> # modified by Sasha Pachev <sasha@mysql.com>
# Sligtly updated by Monty # Sligtly updated by Monty
# Cleaned up again by Matt
#++ #++
# Access Definitions # Access Definitions
...@@ -25,16 +26,13 @@ else ...@@ -25,16 +26,13 @@ else
if [ -f ./mysql-test-run ] && [ -d ../sql ] ; then if [ -f ./mysql-test-run ] && [ -d ../sql ] ; then
SOURCE_DIST=1 SOURCE_DIST=1
else else
echo "If you are using binary distribution, run me from install root as" $ECHO "If you are using binary distribution, run from install root as"
echo "scripts/mysql-test-run. On source distribution run me from source root" $ECHO "scripts/mysql-test-run. On source distribution run from source root"
echo "as mysql-test/mysql-test-run or from mysql-test as ./mysql-test-run" $ECHO "as mysql-test/mysql-test-run or from mysql-test as ./mysql-test-run"
exit 1 exit 1
fi fi
fi fi
#++ #++
# Misc. Definitions # Misc. Definitions
#-- #--
...@@ -112,8 +110,8 @@ XARGS=`which xargs | head -1` ...@@ -112,8 +110,8 @@ XARGS=`which xargs | head -1`
[ -z "$COLUMNS" ] && COLUMNS=80 [ -z "$COLUMNS" ] && COLUMNS=80
E=`$EXPR $COLUMNS - 8` E=`$EXPR $COLUMNS - 8`
#DASH72=`expr substr '________________________________________________________________________' 1 $E` #DASH72=`expr substr '------------------------------------------------------------------------' 1 $E`
DASH72=`$ECHO '________________________________________________________________________'|$CUT -c 1-$E` DASH72=`$ECHO '------------------------------------------------------------------------'|$CUT -c 1-$E`
# on source dist, we pick up freshly build executables # on source dist, we pick up freshly build executables
# on binary, use what is installed # on binary, use what is installed
...@@ -132,8 +130,7 @@ fi ...@@ -132,8 +130,7 @@ fi
SLAVE_MYSQLD=$MYSQLD #this will be changed later if we are doing gcov 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"
MYSQL_TEST="$MYSQL_TEST --no-defaults --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent"
GDB_MASTER_INIT=/tmp/gdbinit.master GDB_MASTER_INIT=/tmp/gdbinit.master
GDB_SLAVE_INIT=/tmp/gdbinit.slave GDB_SLAVE_INIT=/tmp/gdbinit.slave
...@@ -141,22 +138,21 @@ while test $# -gt 0; do ...@@ -141,22 +138,21 @@ while test $# -gt 0; do
case "$1" in case "$1" in
--force ) FORCE=1 ;; --force ) FORCE=1 ;;
--record ) RECORD=1 ;; --record ) RECORD=1 ;;
--verbose) MYSQL_TEST="$MYSQL_TEST -v";;
--gcov ) --gcov )
if [ x$BINARY_DIST = x1 ] ; then if [ x$BINARY_DIST = x1 ] ; then
echo "Cannot do coverage test without the source - please use source dist" $ECHO "Cannot do coverage test without the source - please use source dist"
exit 1 exit 1
fi fi
DO_GCOV=1 DO_GCOV=1
;; ;;
--gdb ) --gdb )
if [ x$BINARY_DIST = x1 ] ; then 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" $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with -gdb option"
fi fi
DO_GDB=1 DO_GDB=1
;; ;;
-- ) shift; break ;; -- ) shift; break ;;
--* ) echo "Unrecognized option: $1"; exit 1 ;; --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;; * ) break ;;
esac esac
shift shift
...@@ -168,19 +164,22 @@ done ...@@ -168,19 +164,22 @@ done
prompt_user () prompt_user ()
{ {
echo $1 $ECHO $1
read unused read unused
} }
error () { error () {
$ECHO "Error: $1" $ECHO "Error: $1"
exit 1 exit 1
} }
error_is () {
$ECHO `$CAT $TIMEFILE` | $SED -e 's/.* At line .*\: \(.*\)Command .*$/ \>\> Error: \1<\</'
}
prefix_to_8() { prefix_to_8() {
echo " $1" | $SED -e 's:.*\(........\)$:\1:' $ECHO " $1" | $SED -e 's:.*\(........\)$:\1:'
} }
pass_inc () { pass_inc () {
...@@ -209,22 +208,22 @@ report_stats () { ...@@ -209,22 +208,22 @@ report_stats () {
whole=`$PRINTF %.2s $raw` whole=`$PRINTF %.2s $raw`
xwhole=`$EXPR $whole \* 100` xwhole=`$EXPR $whole \* 100`
deci=`$EXPR $raw - $xwhole` deci=`$EXPR $raw - $xwhole`
$ECHO "Failed ${TOT_FAIL}/${TOT_TEST} tests ${whole}.${deci}% successful." $ECHO "Failed ${TOT_FAIL}/${TOT_TEST} tests, ${whole}.${deci}% successful."
fi fi
} }
mysql_install_db () { mysql_install_db () {
echo "Removing stale files from previous run" $ECHO "Removing Stale Files"
$RM -rf $MASTER_MYDDIR $SLAVE_MYDDIR $SLAVE_MYLOG $MASTER_MYLOG \ $RM -rf $MASTER_MYDDIR $SLAVE_MYDDIR $SLAVE_MYLOG $MASTER_MYLOG \
$SLAVE_MYERR $MASTER_MYERR $SLAVE_MYERR $MASTER_MYERR
[ -d $MYRUN_DIR ] || mkdir -p $MYRUN_DIR [ -d $MYRUN_DIR ] || mkdir -p $MYRUN_DIR
echo "installing master databases" $ECHO "Installing Master Databases"
$INSTALL_DB $INSTALL_DB
if [ $? != 0 ]; then if [ $? != 0 ]; then
error "Could not install master test DBs" error "Could not install master test DBs"
exit 1 exit 1
fi fi
echo "Installing slave databases" $ECHO "Installing Slave Databases"
$INSTALL_DB -slave $INSTALL_DB -slave
if [ $? != 0 ]; then if [ $? != 0 ]; then
error "Could not install slave test DBs" error "Could not install slave test DBs"
...@@ -270,7 +269,7 @@ start_master() ...@@ -270,7 +269,7 @@ start_master()
--language=english $EXTRA_MASTER_OPT" --language=english $EXTRA_MASTER_OPT"
if [ x$DO_GDB = x1 ] if [ x$DO_GDB = x1 ]
then then
echo "set args $master_args" > $GDB_MASTER_INIT $ECHO "set args $master_args" > $GDB_MASTER_INIT
xterm -title "Master" -e gdb -x $GDB_MASTER_INIT $MYSQLD & xterm -title "Master" -e gdb -x $GDB_MASTER_INIT $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"
else else
...@@ -305,7 +304,7 @@ start_slave() ...@@ -305,7 +304,7 @@ start_slave()
--language=english $EXTRA_SLAVE_OPT" --language=english $EXTRA_SLAVE_OPT"
if [ x$DO_GDB = x1 ] if [ x$DO_GDB = x1 ]
then then
echo "set args $slave_args" > $GDB_SLAVE_INIT $ECHO "set args $slave_args" > $GDB_SLAVE_INIT
xterm -title "Slave" -e gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD & xterm -title "Slave" -e gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD &
prompt_user "Hit enter to continue after you've started the slave" prompt_user "Hit enter to continue after you've started the slave"
else else
...@@ -315,6 +314,7 @@ start_slave() ...@@ -315,6 +314,7 @@ start_slave()
} }
mysql_start () { mysql_start () {
$ECHO "Starting MySQL daemon"
start_master start_master
start_slave start_slave
cd $MYSQL_TEST_DIR cd $MYSQL_TEST_DIR
...@@ -327,15 +327,15 @@ stop_slave () ...@@ -327,15 +327,15 @@ stop_slave ()
then then
$MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root shutdown $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root shutdown
if [ $? != 0 ] ; then # try harder! if [ $? != 0 ] ; 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 2
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`
$RM -f $SLAVE_MYPID $RM -f $SLAVE_MYPID
else else
echo "slave responded to SIGTERM " $ECHO "slave responded to SIGTERM "
fi fi
fi fi
SLAVE_RUNNING=0 SLAVE_RUNNING=0
...@@ -348,15 +348,15 @@ stop_master () ...@@ -348,15 +348,15 @@ stop_master ()
then then
$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root shutdown $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root shutdown
if [ $? != 0 ] ; then # try harder! if [ $? != 0 ] ; 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 2
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`
$RM -f $MASTER_MYPID $RM -f $MASTER_MYPID
else else
echo "master responded to SIGTERM " $ECHO "master responded to SIGTERM "
fi fi
fi fi
MASTER_RUNNING=0 MASTER_RUNNING=0
...@@ -365,6 +365,9 @@ stop_master () ...@@ -365,6 +365,9 @@ stop_master ()
mysql_stop () mysql_stop ()
{ {
$ECHO "Ending Tests"
$ECHO "Shutting-down MySQL daemon"
$ECHO
stop_master stop_master
stop_slave stop_slave
return 1 return 1
...@@ -473,28 +476,29 @@ run_testcase () ...@@ -473,28 +476,29 @@ run_testcase ()
if [ $res == 0 ]; then if [ $res == 0 ]; then
total_inc total_inc
pass_inc pass_inc
echo "$RES_SPACE [ pass ]" $ECHO "$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_SPACE [ fail ]"
$ECHO "failed output"
$CAT $TIMEFILE
$ECHO $ECHO
error_is
$ECHO $ECHO
if [ x$FORCE != x1 ] ; then if [ x$FORCE != x1 ] ; then
echo "Aborting, if you want to continue, re-run with --force" $ECHO "Aborting. To continue, re-run with '--force'."
$ECHO
mysql_stop mysql_stop
exit 1 exit 1
fi fi
echo "Restarting mysqld" # $ECHO "Restarting mysqld"
mysql_restart mysql_restart
echo "Resuming Tests" $ECHO "Resuming Tests"
$ECHO
else else
pass_inc pass_inc
echo "$RES_SPACE [ skipped ]" $ECHO "$RES_SPACE [ skipped ]"
fi fi
fi fi
fi fi
...@@ -505,21 +509,20 @@ run_testcase () ...@@ -505,21 +509,20 @@ run_testcase ()
[ "$DO_GCOV" ] && gcov_prepare [ "$DO_GCOV" ] && gcov_prepare
echo "Installing test databases" $ECHO "Installing Test Databases"
mysql_install_db mysql_install_db
#do not automagically start deamons if we are in gdb or running only one test #do not automagically start deamons if we are in gdb or running only one test
#case #case
if [ -z "$DO_GDB" ] && [ -z "$1" ] if [ -z "$DO_GDB" ] && [ -z "$1" ]
then then
$ECHO "Starting mysqld for Testing"
mysql_start mysql_start
fi fi
$ECHO "Loading Standard Test Database" $ECHO "Loading Standard Test Databases"
mysql_loadstd mysql_loadstd
$ECHO "Starting Tests for MySQL daemon" $ECHO "Starting Tests"
$ECHO $ECHO
$ECHO " TEST USER SYSTEM ELAPSED RESULT" $ECHO " TEST USER SYSTEM ELAPSED RESULT"
...@@ -528,7 +531,7 @@ $ECHO $DASH72 ...@@ -528,7 +531,7 @@ $ECHO $DASH72
if [ -z "$1" ] ; if [ -z "$1" ] ;
then then
if [ x$RECORD = x1 ]; then if [ x$RECORD = x1 ]; then
echo "Will not run in record mode without a specific test case" $ECHO "Will not run in record mode without a specific test case."
else else
for tf in $TESTDIR/*.$TESTSUFFIX for tf in $TESTDIR/*.$TESTSUFFIX
do do
...@@ -541,23 +544,20 @@ else ...@@ -541,23 +544,20 @@ else
if [ -f $tf ] ; then if [ -f $tf ] ; then
run_testcase $tf run_testcase $tf
else else
echo "Test case $tf does not exist" $ECHO "Test case $tf does not exist."
fi fi
fi fi
$ECHO $DASH72 $ECHO $DASH72
$ECHO $ECHO
$ECHO "Ending Tests for MySQL daemon"
$RM -f $TIMEFILE $RM -f $TIMEFILE
if [ -z "$DO_GDB" ] ; if [ -z "$DO_GDB" ] ;
then then
$ECHO "Shutdown mysqld"
mysql_stop mysql_stop
fi fi
$ECHO
report_stats report_stats
$ECHO $ECHO
......
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