diff options
author | unknown <monty@donna.mysql.com> | 2001-01-04 02:56:38 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2001-01-04 02:56:38 +0200 |
commit | 92a3aedc05dd07e1d00986f237a2097af595e584 (patch) | |
tree | 372d81dfa5cc567493d3b099189518dfa6fc14c5 /mysql-test | |
parent | 47521c20a06107b7c8f7d185f01c13ba206cca0f (diff) | |
download | mariadb-git-92a3aedc05dd07e1d00986f237a2097af595e584.tar.gz |
Fixes to get mysql-test-run more portable
Docs/manual.texi:
More examples based on user comments
client/mysqltest.c:
Added --sleep and --tmpdir
mysql-test/README:
Update
mysql-test/include/master-slave.inc:
Fixed to not be dependent on path to sockets
mysql-test/install_test_db.sh:
Added privilege for hostname%
mysql-test/mysql-test-run.sh:
Portability fixes + a lot of new options
mysql-test/r/bigint.result:
Made test portable
mysql-test/t/bigint.test:
Made test portable
mysql-test/t/rpl000008.test:
Changed sleeptime
mysql-test/t/rpl000012.test:
Fixed to not be dependent on path to sockets
mysql-test/t/rpl000013.test:
Fixed to not be dependent on path to sockets
mysql-test/t/rpl000014.test:
Fixed to not be dependent on path to sockets
mysql-test/t/rpl000015.test:
Fixed to not be dependent on path to sockets
mysql-test/t/rpl000016.test:
Fixed to not be dependent on path to sockets
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/README | 4 | ||||
-rw-r--r-- | mysql-test/include/have_default_master.inc | 3 | ||||
-rw-r--r-- | mysql-test/include/master-slave.inc | 8 | ||||
-rw-r--r-- | mysql-test/install_test_db.sh | 1 | ||||
-rw-r--r-- | mysql-test/mysql-test-run.sh | 168 | ||||
-rw-r--r-- | mysql-test/r/bigint.result | 4 | ||||
-rw-r--r-- | mysql-test/r/have_default_master.require | 2 | ||||
-rw-r--r-- | mysql-test/t/bigint.test | 2 | ||||
-rw-r--r-- | mysql-test/t/rpl000008.test | 2 | ||||
-rw-r--r-- | mysql-test/t/rpl000012.test | 2 | ||||
-rw-r--r-- | mysql-test/t/rpl000013.test | 2 | ||||
-rw-r--r-- | mysql-test/t/rpl000014.test | 1 | ||||
-rw-r--r-- | mysql-test/t/rpl000015.test | 5 | ||||
-rw-r--r-- | mysql-test/t/rpl000016.test | 5 |
14 files changed, 114 insertions, 95 deletions
diff --git a/mysql-test/README b/mysql-test/README index ca7284d173a..6ad59ea6a8b 100644 --- a/mysql-test/README +++ b/mysql-test/README @@ -18,6 +18,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: diff --git a/mysql-test/include/have_default_master.inc b/mysql-test/include/have_default_master.inc new file mode 100644 index 00000000000..eff1414c16a --- /dev/null +++ b/mysql-test/include/have_default_master.inc @@ -0,0 +1,3 @@ +-- require r/have_default_master.require +connection master; +show variables like "port"; diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index 8270c0e46f6..69ab73db6b5 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -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'; diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh index 28e6ad34419..3ee2aa42fad 100644 --- a/mysql-test/install_test_db.sh +++ b/mysql-test/install_test_db.sh @@ -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 diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 62d0e990053..65e4f395e75 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -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 diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 501f489ca86..08e21b279bc 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -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 diff --git a/mysql-test/r/have_default_master.require b/mysql-test/r/have_default_master.require new file mode 100644 index 00000000000..ca8342ffb08 --- /dev/null +++ b/mysql-test/r/have_default_master.require @@ -0,0 +1,2 @@ +Variable_name Value +port 9306 diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 91997c811b5..9a819463f3f 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -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; diff --git a/mysql-test/t/rpl000008.test b/mysql-test/t/rpl000008.test index 58a00b4ffbb..d17190ef31d 100644 --- a/mysql-test/t/rpl000008.test +++ b/mysql-test/t/rpl000008.test @@ -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; diff --git a/mysql-test/t/rpl000012.test b/mysql-test/t/rpl000012.test index 8a231c3f04d..d4b40a48386 100644 --- a/mysql-test/t/rpl000012.test +++ b/mysql-test/t/rpl000012.test @@ -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; diff --git a/mysql-test/t/rpl000013.test b/mysql-test/t/rpl000013.test index ec9ca1ce8d2..4d4dc3f491a 100644 --- a/mysql-test/t/rpl000013.test +++ b/mysql-test/t/rpl000013.test @@ -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; diff --git a/mysql-test/t/rpl000014.test b/mysql-test/t/rpl000014.test index 3ab5360d82d..1a2ce014813 100644 --- a/mysql-test/t/rpl000014.test +++ b/mysql-test/t/rpl000014.test @@ -1,4 +1,5 @@ source include/master-slave.inc; +source include/have_default_master.inc; connection master; show master status; connection slave; diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index dda1b528e10..a2528aa9b42 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -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; diff --git a/mysql-test/t/rpl000016.test b/mysql-test/t/rpl000016.test index 5704bfeaf66..2ee68cd230f 100644 --- a/mysql-test/t/rpl000016.test +++ b/mysql-test/t/rpl000016.test @@ -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; |