diff options
author | unknown <monty@donna.mysql.com> | 2000-12-15 16:12:31 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2000-12-15 16:12:31 +0200 |
commit | 7322a906a860c9aa17ba3bf681f65b2d7f2497ee (patch) | |
tree | 218630fcd3a47db36372c12886c88d38e397f5c3 /mysql-test | |
parent | e7fde22e1a2e8e1eb1ea122a6b5f97786453200a (diff) | |
download | mariadb-git-7322a906a860c9aa17ba3bf681f65b2d7f2497ee.tar.gz |
Fixed <=>
Added mysqltest for <=>
Removed use of TAB in output from mysql-test-run
Docs/manual.texi:
Changelog
client/mysqltest.c:
Added missing argument; Changed to use standard defines
mysql-test/README:
Cleaned up
mysql-test/mysql-test-run.sh:
Removed use of TAB in output
(We are now also depening on sed)
sql/item_cmpfunc.cc:
Fixed <=>
sql/item_cmpfunc.h:
Fixed <=>
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/README | 25 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.sh | 48 | ||||
-rw-r--r-- | mysql-test/r/equal.result | 15 | ||||
-rw-r--r-- | mysql-test/t/equal.test | 29 |
4 files changed, 88 insertions, 29 deletions
diff --git a/mysql-test/README b/mysql-test/README index 35ab424190e..f33218b617c 100644 --- a/mysql-test/README +++ b/mysql-test/README @@ -16,14 +16,27 @@ You can create your own test cases. To create a test case: in the file, put a set of SQL commands that will create some tables, load test data, run some queries to manipulate it. - then do ./mysql-test-run -record test_case_name - and look at r/test_case_name.result - edit the result if necessary. If you - have to edit it, you have found a bug. + We would appreciate if the test tables were called t1, t2, t3 ... (to not + conflict too much with existing tables). + + If you are using mysqltest commands (like result file names) in your + test case you should do create the result file as follows: + + mysql-test-run --record < t/test_case_name.test + + If you only have a simple test cases consistent of SQL commands and comments + you can create the test case one of the following ways: + + mysql < t/test_case_name.test > r/test_case_name.result + + mysql-test-run --record --record-file=r/test_case_name.result < t/test_case_name.test + + When this is done, take a look at r/test_case_name.result + - If the result is wrong, you have found a bug; In this case you should + edit the test result to the correct results so that we can verify + that the bug is corrected in future releases. To submit your test case, put your .test file and .result file(s) into a tar.gz archive, add a README that explains the problem, ftp the archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail to bugs@lists.mysql.com - - - diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 08295a5a555..90277be13ff 100755 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -1,6 +1,7 @@ #! /bin/sh # mysql-test-run - originally written by Matt Wagner <matt@mysql.com> # modified by Sasha Pachev <sasha@mysql.com> +# Sligtly updated by Monty #++ # Access Definitions @@ -23,10 +24,10 @@ else if [ -f ./mysql-test-run ] && [ -d ../sql ] ; then SOURCE_DIST=1 else - echo "If you are using binary distribution, run me from install root as \ - scripts/mysql-test-run. On source distribution run me from source root as \ - mysql-test/mysql-test-run or from mysql-test as ./mysql-test-run" - exit 1 + echo "If you are using binary distribution, run me from install root as" + echo "scripts/mysql-test-run. On source distribution run me from source root" + echo "as mysql-test/mysql-test-run or from mysql-test as ./mysql-test-run" + exit 1 fi fi @@ -44,6 +45,7 @@ BASEDIR=`pwd` cd $CWD MYSQL_TEST_DIR=$BASEDIR/mysql-test STD_DATA=$MYSQL_TEST_DIR/std_data +SED=sed TESTDIR="$MYSQL_TEST_DIR/t/" TESTSUFFIX=test @@ -55,8 +57,7 @@ SYST=0 REALT=0 MY_TMP_DIR=$MYSQL_TEST_DIR/var/tmp TIMEFILE="$MYSQL_TEST_DIR/var/tmp/mysqltest-time" -DASHBLANK="---- ---- -------" -RES_SPACE=" " +RES_SPACE=" " MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \ myisammrg heap sql" GCOV_MSG=/tmp/mysqld-gcov.out #gcov output @@ -69,13 +70,7 @@ SLAVE_RUNNING=0 [ -z "$COLUMNS" ] && COLUMNS=80 E=`expr $COLUMNS - 8` -C=0 - -while [ $C != $E ] -do - DASH72="${DASH72}-" - C=`expr $C + 1` -done +DASH72=`expr substr '________________________________________________________________________' 1 $E` #++ # mysqld Environment Parameters @@ -193,6 +188,10 @@ error () { exit 1 } +prefix_to_8() { + echo " $1" | $SED -e 's:.*\(........\)$:\1:' +} + pass_inc () { TOT_PASS=`$EXPR $TOT_PASS + 1` } @@ -393,8 +392,7 @@ mysql_loadstd () { run_testcase () { tf=$1 - tname=`$BASENAME $tf` - tname=`$ECHO $tname | $CUT -d . -f 1` + tname=`$BASENAME $tf .test` master_opt_file=$TESTDIR/$tname-master.opt slave_opt_file=$TESTDIR/$tname-slave.opt slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt @@ -459,23 +457,27 @@ run_testcase () mytime=`$CAT $TIMEFILE | $TR '\n' '-'` 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=`prefix_to_8 $SYST` REALT=`$ECHO $mytime | $CUT -d - -f 1 | $CUT -d ' ' -f 2` + REALT=`prefix_to_8 $REALT` else - USERT="...." - SYST="...." - REALT="...." + USERT=" ...." + SYST=" ...." + REALT=" ...." fi - timestr="$USERT $SYST $REALT" - outstr="$tname $timestr" + timestr="$USERT $SYST $REALT" + pname=`$EXPR substr "$tname " 1 16` + $SETCOLOR_NORMAL && $ECHO -n "$pname $timestr" total_inc if [ $res != 0 ]; then fail_inc - echo "$outstr $RES_SPACE [ fail ]" + echo "$RES_SPACE [ fail ]" $ECHO "failed output" $CAT $TIMEFILE $ECHO @@ -491,7 +493,7 @@ run_testcase () echo "Resuming Tests" else pass_inc - echo "$outstr $RES_SPACE [ pass ]" + echo "$RES_SPACE [ pass ]" fi fi @@ -519,7 +521,7 @@ mysql_loadstd $ECHO "Starting Tests for MySQL daemon" $ECHO -$ECHO " TEST USER SYSTEM ELAPSED RESULT" +$ECHO " TEST USER SYSTEM ELAPSED RESULT" $ECHO $DASH72 if [ -z "$1" ] ; diff --git a/mysql-test/r/equal.result b/mysql-test/r/equal.result new file mode 100644 index 00000000000..9de9eafee6a --- /dev/null +++ b/mysql-test/r/equal.result @@ -0,0 +1,15 @@ +0<=>0 0.0<=>0.0 "A"<=>"A" NULL<=>NULL +1 1 1 1 +1<=>0 0<=>NULL NULL<=>0 +0 0 0 +1.0<=>0.0 0.0<=>NULL NULL<=>0.0 +0 0 0 +"A"<=>"B" "A"<=>NULL NULL<=>"A" +0 0 0 +id value id value t1.value<=>t2.value +1 NULL 1 NULL 1 +id value +1 NULL +id value +1 NULL +id value diff --git a/mysql-test/t/equal.test b/mysql-test/t/equal.test new file mode 100644 index 00000000000..0d7a4ed9778 --- /dev/null +++ b/mysql-test/t/equal.test @@ -0,0 +1,29 @@ +# +# Testing of the <=> operator +# + +# +# First some simple tests +# + +select 0<=>0,0.0<=>0.0,"A"<=>"A",NULL<=>NULL; +select 1<=>0,0<=>NULL,NULL<=>0; +select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0; +select "A"<=>"B","A"<=>NULL,NULL<=>"A"; + +# +# Test with tables +# + +drop table if exists t1,t2; +create table t1 (id int, value int); +create table t2 (id int, value int); + +insert into t1 values (1,null); +insert into t2 values (1,null); + +select t1.*, t2.*, t1.value<=>t2.value from t1, t2 where t1.id=t2.id and t1.id=1; +select * from t1 where id <=>id; +select * from t1 where value <=> value; +select * from t1 where id <=> value or value<=>id; +drop table t1,t2; |