mysql-test-run Added Serg's SysV/BSD changes. Reworked timing

mysql-test-run	to be more accurate and portable.
parent 284aa787
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
# Access Definitions # Access Definitions
#-- #--
DB=test DB=test
USER=test DBUSER=test
PASSWD= DBPASSWD=
#++ #++
# Misc. Definitions # Misc. Definitions
...@@ -21,8 +21,11 @@ TESTSUFFIX=test ...@@ -21,8 +21,11 @@ TESTSUFFIX=test
TOT_PASS=0 TOT_PASS=0
TOT_FAIL=0 TOT_FAIL=0
TOT_TEST=0 TOT_TEST=0
TIME_FORMAT='%U\t%S\t%E\t%P' USERT=0
DASHBLANK="----\t----\t-------\t----" SYST=0
REALT=0
TIMEFILE="$CWD/var/tmp/mysqltest-time"
DASHBLANK="---- ---- -------"
[ -z $COLUMNS ] && COLUMNS=80 [ -z $COLUMNS ] && COLUMNS=80
E=`expr $COLUMNS - 8` E=`expr $COLUMNS - 8`
...@@ -47,25 +50,30 @@ MYERR="$CWD/var/log/mysqld.err" ...@@ -47,25 +50,30 @@ MYERR="$CWD/var/log/mysqld.err"
#++ #++
# Program Definitions # Program Definitions
#-- #--
BASENAME=/bin/basename
CAT=/bin/cat
CUT=/usr/bin/cut
ECHO=/bin/echo ECHO=/bin/echo
EXPR=/usr/bin/expr EXPR=/usr/bin/expr
PRINTF=/usr/bin/printf PRINTF=/usr/bin/printf
RM=/bin/rm
TIME=/usr/bin/time TIME=/usr/bin/time
TR=/usr/bin/tr
MYSQLD="$BASEDIR/sql/mysqld" MYSQLD="$BASEDIR/sql/mysqld"
MYSQL_TEST="$BASEDIR/client/mysqltest" MYSQL_TEST="$BASEDIR/client/mysqltest"
MYSQLADMIN="$BASEDIR/client/mysqladmin" MYSQLADMIN="$BASEDIR/client/mysqladmin"
MYSQL_TEST="$MYSQL_TEST --socket=$MYSOCK --database=$DB --user=$USER --password=$PASSWD --silent" MYSQL_TEST="$MYSQL_TEST --socket=$MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent"
INSTALL_DB="$MYBIN/mysql-test_install_db" INSTALL_DB="$MYBIN/mysql-test_install_db"
#++ #++
# Terminal Modifications # Terminal Modifications
#-- #--
MOVE_TO_COL="$ECHO -en \\033[300C\\033[20D" MOVE_TO_COL="$ECHO -n "
SETCOLOR_SUCCESS="$ECHO -en \\033[1;32m" SETCOLOR_SUCCESS="$ECHO -n "
SETCOLOR_FAILURE="$ECHO -en \\033[1;31m" SETCOLOR_FAILURE="$ECHO -n "
SETCOLOR_WARNING="$ECHO -en \\033[1;33m" SETCOLOR_WARNING="$ECHO -n "
SETCOLOR_NORMAL="$ECHO -en \\033[0;39m" SETCOLOR_NORMAL="$ECHO -n "
...@@ -160,14 +168,14 @@ mysql_install_db () { ...@@ -160,14 +168,14 @@ mysql_install_db () {
mysql_start () { mysql_start () {
`$MYSQLD --no-defaults \ $MYSQLD --no-defaults \
--skip-networking \ --skip-networking \
--basedir=$CWD \ --basedir=$CWD \
--datadir=$MYDDIR \ --datadir=$MYDDIR \
--pid-file=$MYPID \ --pid-file=$MYPID \
--socket=$MYSOCK \ --socket=$MYSOCK \
--log=$MYLOG \ --log=$MYLOG \
--language=english >> $MYERR 2>&1 &` --language=english >> $MYERR 2>&1 &
return 1 return 1
} }
...@@ -218,30 +226,42 @@ $SETCOLOR_NORMAL && $ECHO -n "Starting Tests for MySQL $TESTVER Series" ...@@ -218,30 +226,42 @@ $SETCOLOR_NORMAL && $ECHO -n "Starting Tests for MySQL $TESTVER Series"
$SETCOLOR_SUCCESS && echo_ok $SETCOLOR_SUCCESS && echo_ok
$ECHO $ECHO
$ECHO -e " TEST\t\t\tUSER\tSYSTEM\tELAPSED\t%CPU\t RESULT" $ECHO " TEST USER SYSTEM ELAPSED RESULT"
$ECHO $DASH72 $ECHO $DASH72
for tf in $TESTDIR/*.$TESTSUFFIX for tf in $TESTDIR/*.$TESTSUFFIX
do do
if [ -f $tf ] ; then if [ -f $tf ] ; then
mytime=`$TIME -f $TIME_FORMAT $MYSQL_TEST < $tf 2>&1` mytime=`$TIME -p $MYSQL_TEST < $tf 2> $TIMEFILE`
res=$? res=$?
tf=`basename $tf` if [ $res != 1 ]; then
mytime=`$CAT $TIMEFILE | $TR '\n' '-'`
USERT=`$ECHO $mytime | $CUT -d - -f 2 | $CUT -d ' ' -f 2`
SYST=`$ECHO $mytime | $CUT -d - -f 3 | $CUT -d ' ' -f 2`
REALT=`$ECHO $mytime | $CUT -d - -f 1 | $CUT -d ' ' -f 2`
else
USERT="...."
SYST="...."
REALT="...."
fi
timestr="$USERT $SYST $REALT"
tf=`$BASENAME $tf`
$SETCOLOR_NORMAL && $ECHO -n "$tf $timestr"
[ $res = 1 ] && mytime=`$ECHO -ne $mytime | cut -b 39-`
$SETCOLOR_NORMAL && $ECHO -ne "$tf\t$mytime"
[ $res = 1 ] && fail_inc && echo_fail
[ $res != 1 ] && pass_inc && echo_pass [ $res != 1 ] && pass_inc && echo_pass
[ $res = 1 ] && fail_inc && echo_fail
total_inc total_inc
if [ $res != 0 ]; then if [ $res != 0 ]; then
$ECHO $ECHO
$SETCOLOR_NORMAL && $ECHO -ne "Restarting mysqld\t$DASHBLANK" $SETCOLOR_NORMAL && $ECHO -n "Restarting mysqld $DASHBLANK"
mysql_restart mysql_restart
$SETCOLOR_SUCCESS && echo_ok $SETCOLOR_SUCCESS && echo_ok
$SETCOLOR_NORMAL && $ECHO -ne "Resuming Tests\t\t$DASHBLANK" $SETCOLOR_NORMAL && $ECHO -n "Resuming Tests $DASHBLANK"
$SETCOLOR_SUCCESS && echo_ok $SETCOLOR_SUCCESS && echo_ok
$ECHO $ECHO
fi fi
...@@ -252,6 +272,7 @@ $ECHO $DASH72 ...@@ -252,6 +272,7 @@ $ECHO $DASH72
$ECHO $ECHO
$SETCOLOR_NORMAL && $ECHO -n "Ending Tests for MySQL $TESTVER Series" $SETCOLOR_NORMAL && $ECHO -n "Ending Tests for MySQL $TESTVER Series"
$SETCOLOR_SUCCESS && echo_ok $SETCOLOR_SUCCESS && echo_ok
$RM $TIMEFILE
$SETCOLOR_NORMAL && $ECHO -n "Shutdown mysqld" $SETCOLOR_NORMAL && $ECHO -n "Shutdown mysqld"
mysql_stop mysql_stop
......
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