run.test mysql-test -> mysqltest

run-all-tests	mysql-test -> mysqltest
README  	mysql-test -> mysqltest
Makefile.am	Retargetted mysql-test to mysqltest.
.del-mysql-test.c	Delete: client/mysql-test.c
mysql-test-run	Added program definitions.
mysqltest.c	BitKeeper file /home/mwagner/work/bk/mysql/client/mysqltest.c
parent 45adf2a8
...@@ -21,8 +21,8 @@ INCLUDES = -I$(srcdir)/../include \ ...@@ -21,8 +21,8 @@ INCLUDES = -I$(srcdir)/../include \
-I.. -I..
LIBS = @CLIENT_LIBS@ LIBS = @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la
bin_PROGRAMS = mysql mysqladmin mysqlshow mysqldump mysqlimport bin_PROGRAMS = mysql mysqladmin mysqlshow mysqldump mysqlimport mysqltest
noinst_PROGRAMS = insert_test select_test thread_test mysql-test noinst_PROGRAMS = insert_test select_test thread_test
noinst_HEADERS = sql_string.h completion_hash.h my_readline.h noinst_HEADERS = sql_string.h completion_hash.h my_readline.h
mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS) mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS)
...@@ -33,8 +33,8 @@ mysqldump_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) ...@@ -33,8 +33,8 @@ mysqldump_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
mysqlimport_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) mysqlimport_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
mysql_test_SOURCES= mysql-test.c mysqltest_SOURCES= mysqltest.c
mysql_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) mysqltest_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
# Fix for mit-threads # Fix for mit-threads
DEFS = -DUNDEF_THREADS_HACK DEFS = -DUNDEF_THREADS_HACK
......
This diff is collapsed.
...@@ -17,6 +17,7 @@ cd $CWD ...@@ -17,6 +17,7 @@ cd $CWD
MYBIN="$CWD/mybin" MYBIN="$CWD/mybin"
TESTVER=3.23 TESTVER=3.23
TESTDIR="$CWD/t/$TESTVER" TESTDIR="$CWD/t/$TESTVER"
TESTSUFFIX=test
TOT_PASS=0 TOT_PASS=0
TOT_FAIL=0 TOT_FAIL=0
TOT_TEST=0 TOT_TEST=0
...@@ -46,9 +47,12 @@ MYERR="$CWD/var/log/mysqld.err" ...@@ -46,9 +47,12 @@ MYERR="$CWD/var/log/mysqld.err"
#++ #++
# Program Definitions # Program Definitions
#-- #--
ECHO=/bin/echo
EXPR=/usr/bin/expr
PRINTF=/usr/bin/printf
TIME=/usr/bin/time TIME=/usr/bin/time
MYSQLD="$BASEDIR/sql/mysqld" MYSQLD="$BASEDIR/sql/mysqld"
MYSQL_TEST="$BASEDIR/client/mysql-test" 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=$USER --password=$PASSWD --silent"
INSTALL_DB="$MYBIN/mysql-test_install_db" INSTALL_DB="$MYBIN/mysql-test_install_db"
...@@ -57,11 +61,11 @@ INSTALL_DB="$MYBIN/mysql-test_install_db" ...@@ -57,11 +61,11 @@ INSTALL_DB="$MYBIN/mysql-test_install_db"
#++ #++
# Terminal Modifications # Terminal Modifications
#-- #--
MOVE_TO_COL="echo -en \\033[300C\\033[20D" MOVE_TO_COL="$ECHO -en \\033[300C\\033[20D"
SETCOLOR_SUCCESS="echo -en \\033[1;32m" SETCOLOR_SUCCESS="$ECHO -en \\033[1;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m" SETCOLOR_FAILURE="$ECHO -en \\033[1;31m"
SETCOLOR_WARNING="echo -en \\033[1;33m" SETCOLOR_WARNING="$ECHO -en \\033[1;33m"
SETCOLOR_NORMAL="echo -en \\033[0;39m" SETCOLOR_NORMAL="$ECHO -en \\033[0;39m"
...@@ -70,78 +74,78 @@ SETCOLOR_NORMAL="echo -en \\033[0;39m" ...@@ -70,78 +74,78 @@ SETCOLOR_NORMAL="echo -en \\033[0;39m"
#-- #--
echo_ok() { echo_ok() {
$MOVE_TO_COL && $SETCOLOR_NORMAL $MOVE_TO_COL && $SETCOLOR_NORMAL
echo -n "[ " $ECHO -n "[ "
$SETCOLOR_SUCCESS $SETCOLOR_SUCCESS
echo -n "ok" $ECHO -n "ok"
$SETCOLOR_NORMAL $SETCOLOR_NORMAL
echo " ]" $ECHO " ]"
return 0 return 0
} }
echo_notok() { echo_notok() {
$MOVE_TO_COL && $SETCOLOR_NORMAL $MOVE_TO_COL && $SETCOLOR_NORMAL
echo -n "[ " $ECHO -n "[ "
$SETCOLOR_FAILURE $SETCOLOR_FAILURE
echo -n "not ok" $ECHO -n "not ok"
$SETCOLOR_NORMAL $SETCOLOR_NORMAL
echo " ]" $ECHO " ]"
return 0 return 0
} }
echo_pass () { echo_pass () {
$MOVE_TO_COL && $SETCOLOR_NORMAL $MOVE_TO_COL && $SETCOLOR_NORMAL
echo -n "[ " $ECHO -n "[ "
$SETCOLOR_SUCCESS $SETCOLOR_SUCCESS
echo -n "pass" $ECHO -n "pass"
$SETCOLOR_NORMAL $SETCOLOR_NORMAL
echo " ]" $ECHO " ]"
return 0 return 0
} }
echo_fail () { echo_fail () {
$MOVE_TO_COL && $SETCOLOR_NORMAL $MOVE_TO_COL && $SETCOLOR_NORMAL
echo -n "[ " $ECHO -n "[ "
$SETCOLOR_FAILURE $SETCOLOR_FAILURE
echo -n "fail" $ECHO -n "fail"
$SETCOLOR_NORMAL $SETCOLOR_NORMAL
echo " ]" $ECHO " ]"
return 0 return 0
} }
error () { error () {
$SETCOLOR_FAILURE $SETCOLOR_FAILURE
echo -n "Error: " && $SETCOLOR_NORMAL && echo $1 $ECHO -n "Error: " && $SETCOLOR_NORMAL && $ECHO $1
$SETCOLOR_NORMAL $SETCOLOR_NORMAL
exit 1 exit 1
} }
pass_inc () { pass_inc () {
TOT_PASS=`expr $TOT_PASS + 1` TOT_PASS=`$EXPR $TOT_PASS + 1`
} }
fail_inc () { fail_inc () {
TOT_FAIL=`expr $TOT_FAIL + 1` TOT_FAIL=`$EXPR $TOT_FAIL + 1`
} }
total_inc () { total_inc () {
TOT_TEST=`expr $TOT_TEST + 1` TOT_TEST=`$EXPR $TOT_TEST + 1`
} }
report_stats () { report_stats () {
if [ $TOT_FAIL = 0 ]; then if [ $TOT_FAIL = 0 ]; then
echo "All tests successful." $ECHO "All tests successful."
else else
echo -n "Failed ${TOT_FAIL}/${TOT_TEST} tests, " $ECHO -n "Failed ${TOT_FAIL}/${TOT_TEST} tests, "
xten=`expr $TOT_PASS \* 10000` # xten=`$EXPR $TOT_PASS \* 10000` #
raw=`expr $xten / $TOT_TEST` # My God raw=`$EXPR $xten / $TOT_TEST` # My God
raw=`printf %.4d $raw` # This is such a ... raw=`$PRINTF %.4d $raw` # This is such a ...
whole=`printf %.2s $raw` # Narttu!! whole=`$PRINTF %.2s $raw` # Narttu!!
xwhole=`expr $whole \* 100` # Hynda!!! xwhole=`$EXPR $whole \* 100` # Hynda!!!
deci=`expr $raw - $xwhole` # deci=`$EXPR $raw - $xwhole` #
echo "${whole}.${deci}% successful." $ECHO "${whole}.${deci}% successful."
fi fi
} }
...@@ -197,27 +201,27 @@ mysql_loadstd () { ...@@ -197,27 +201,27 @@ mysql_loadstd () {
mysql_install_db mysql_install_db
$SETCOLOR_NORMAL && echo -n "Starting mysqld for Testing" $SETCOLOR_NORMAL && $ECHO -n "Starting mysqld for Testing"
mysql_start mysql_start
res=$? res=$?
res=1 res=1
[ $res != 1 ] && echo_notok && error "Starting mysqld" [ $res != 1 ] && echo_notok && error "Starting mysqld"
[ $res = 1 ] && echo_ok [ $res = 1 ] && echo_ok
$SETCOLOR_NORMAL && echo -n "Loading Standard Test Database" $SETCOLOR_NORMAL && $ECHO -n "Loading Standard Test Database"
mysql_loadstd mysql_loadstd
res=$? res=$?
[ $res != 1 ] && echo_notok && error "Loading STD" [ $res != 1 ] && echo_notok && error "Loading STD"
[ $res = 1 ] && echo_ok [ $res = 1 ] && echo_ok
$SETCOLOR_NORMAL && echo -n "Starting Tests for MySQL $TESTVER Series" $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 -e " TEST\t\t\tUSER\tSYSTEM\tELAPSED\t%CPU\t RESULT"
echo $DASH72 $ECHO $DASH72
for tf in $TESTDIR/*.test 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 -f $TIME_FORMAT $MYSQL_TEST < $tf 2>&1`
...@@ -225,31 +229,31 @@ do ...@@ -225,31 +229,31 @@ do
tf=`basename $tf` tf=`basename $tf`
[ $res = 1 ] && mytime=`echo -ne $mytime | cut -b 39-` [ $res = 1 ] && mytime=`$ECHO -ne $mytime | cut -b 39-`
$SETCOLOR_NORMAL && echo -ne "$tf\t$mytime" $SETCOLOR_NORMAL && $ECHO -ne "$tf\t$mytime"
[ $res = 1 ] && fail_inc && echo_fail [ $res = 1 ] && fail_inc && echo_fail
[ $res != 1 ] && pass_inc && echo_pass [ $res != 1 ] && pass_inc && echo_pass
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 -ne "Restarting mysqld\t$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 -ne "Resuming Tests\t\t$DASHBLANK"
$SETCOLOR_SUCCESS && echo_ok $SETCOLOR_SUCCESS && echo_ok
echo $ECHO
fi fi
fi fi
done done
echo $DASH72 $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
$SETCOLOR_NORMAL && echo -n "Shutdown mysqld" $SETCOLOR_NORMAL && $ECHO -n "Shutdown mysqld"
mysql_stop mysql_stop
res=$? res=$?
res=1 res=1
...@@ -258,8 +262,8 @@ res=1 ...@@ -258,8 +262,8 @@ res=1
$SETCOLOR_NORMAL $SETCOLOR_NORMAL
echo $ECHO
report_stats report_stats
echo $ECHO
exit 0 exit 0
...@@ -9,4 +9,4 @@ sh run-all-tests ...@@ -9,4 +9,4 @@ sh run-all-tests
If you would like to add your own test case, create a directory If you would like to add your own test case, create a directory
test-your-test-case-name, write your own run.test following the examples test-your-test-case-name, write your own run.test following the examples
in the other test cases. Note that you can create the files containing in the other test cases. Note that you can create the files containing
the expected output ( master files) by running mysql-test --record < run.test the expected output ( master files) by running mysqltest --record < run.test
\ No newline at end of file \ No newline at end of file
...@@ -4,6 +4,6 @@ for d in test-*; do ...@@ -4,6 +4,6 @@ for d in test-*; do
cd $d cd $d
echo -n $d | sed -e s/test-// echo -n $d | sed -e s/test-//
echo -n "...." echo -n "...."
../../client/mysql-test $@ < run.test ../../client/mysqltest $@ < run.test
cd .. cd ..
done done
\ No newline at end of file
#! ../client/mysql-test #! ../client/mysqltest
# tests if the replicaion preserves timestamp properly # tests if the replicaion preserves timestamp properly
source ../include/master-slave.inc; source ../include/master-slave.inc;
......
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