summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am2
-rw-r--r--mysql-test/README2
-rw-r--r--mysql-test/include/have_geometry.inc4
-rw-r--r--mysql-test/mysql-test-run.sh6
-rw-r--r--mysql-test/ndb/Makefile.am23
-rwxr-xr-xmysql-test/ndb/ndbcluster.sh (renamed from mysql-test/ndb/install_ndbcluster)88
-rwxr-xr-xmysql-test/ndb/stop_ndbcluster55
-rw-r--r--mysql-test/r/func_gconcat.result2
-rw-r--r--mysql-test/r/gis-rtree.result10
-rw-r--r--mysql-test/r/have_geometry.require2
-rw-r--r--mysql-test/r/select_found.result17
-rw-r--r--mysql-test/t/func_gconcat.test6
-rw-r--r--mysql-test/t/gis-rtree.test2
-rw-r--r--mysql-test/t/gis.test2
-rw-r--r--mysql-test/t/select_found.test19
15 files changed, 159 insertions, 81 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index d23a9919b48..266cc7799b0 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -17,6 +17,8 @@
## Process this file with automake to create Makefile.in
+SUBDIRS = ndb
+
benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh
diff --git a/mysql-test/README b/mysql-test/README
index 7c6efe7940e..bccb05c555c 100644
--- a/mysql-test/README
+++ b/mysql-test/README
@@ -12,7 +12,7 @@ conflict with it.
All tests must pass. If one or more of them fail on your system, please
read the following manual section of how to report the problem:
-http://www.mysql.com/doc/M/y/MySQL_test_suite.html
+http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html
You can create your own test cases. To create a test case:
diff --git a/mysql-test/include/have_geometry.inc b/mysql-test/include/have_geometry.inc
new file mode 100644
index 00000000000..169c3a41ee7
--- /dev/null
+++ b/mysql-test/include/have_geometry.inc
@@ -0,0 +1,4 @@
+-- require r/have_geometry.require
+disable_query_log;
+show variables like "have_geometry";
+enable_query_log;
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 8d675ec7f68..13ddb8f221e 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -1417,7 +1417,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
# Kill any running ndbcluster stuff
- ./ndb/stop_ndbcluster
+ ./ndb/ndbcluster --stop
fi
fi
@@ -1438,7 +1438,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
echo "Starting ndbcluster"
- ./ndb/install_ndbcluster --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
+ ./ndb/ndbcluster --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
export NDB_CONNECTSTRING=`cat Ndb.cfg`
else
export NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
@@ -1538,7 +1538,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
# Kill any running ndbcluster stuff
- ./ndb/stop_ndbcluster
+ ./ndb/ndbcluster --stop
fi
fi
diff --git a/mysql-test/ndb/Makefile.am b/mysql-test/ndb/Makefile.am
new file mode 100644
index 00000000000..44627c85bb5
--- /dev/null
+++ b/mysql-test/ndb/Makefile.am
@@ -0,0 +1,23 @@
+
+benchdir_root= $(prefix)
+testdir = $(benchdir_root)/mysql-test/ndb
+
+test_SCRIPTS = ndbcluster
+
+EXTRA_SCRIPTS = ndbcluster.sh
+
+test_DATA = ndb_config_2_node.ini
+
+SUFFIXES = .sh
+
+.sh:
+ @RM@ -f $@ $@-t
+ @SED@ \
+ -e 's!@''ndbbindir''@!$(ndbbindir)!g' \
+ -e 's!@''ndbtoolsdir''@!$(ndbtoolsdir)!g' \
+ $< > $@-t
+ @CHMOD@ +x $@-t
+ @MV@ $@-t $@
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/mysql-test/ndb/install_ndbcluster b/mysql-test/ndb/ndbcluster.sh
index 6cb3985b831..5334604db33 100755
--- a/mysql-test/ndb/install_ndbcluster
+++ b/mysql-test/ndb/ndbcluster.sh
@@ -9,13 +9,44 @@ port_base="22" # using ports port_base{"00","01", etc}
fsdir=`pwd`
# end configurable parameters
-libdir=`pwd`/../ndb/lib
-bindir=`pwd`/../ndb/bin
+#BASEDIR is always one above mysql-test directory
+CWD=`pwd`
+cd ..
+BASEDIR=`pwd`
+cd $CWD
+
+# Are we using a source or a binary distribution?
+if [ -d ../sql ] ; then
+ SOURCE_DIST=1
+ ndbtop=$BASEDIR/ndb
+ exec_ndb=$ndbtop/src/kernel/ndbd
+ exec_mgmtsrvr=$ndbtop/src/mgmsrv/ndb_mgmd
+ exec_waiter=$ndbtop/tools/ndb_waiter
+ exec_mgmtclient=$ndbtop/src/mgmclient/ndb_mgm
+else
+ BINARY_DIST=1
+ if test -x "$BASEDIR/libexec/ndbd"
+ then
+ exec_ndb=$BASEDIR/libexec/ndbd
+ exec_mgmtsrvr=$BASEDIR/libexec/ndb_mgmd
+ else
+ exec_ndb=$BASEDIR/bin/ndbd
+ exec_mgmtsrvr=$BASEDIR/bin/ndb_mgmd
+ fi
+ exec_waiter=$BASEDIR/bin/ndb_waiter
+ exec_mgmtclient=$BASEDIR/bin/ndb_mgm
+fi
pidfile=ndbcluster.pid
+cfgfile=Ndb.cfg
+stop_ndb=
+initial_ndb=
while test $# -gt 0; do
case "$1" in
+ --stop)
+ stop_ndb=1
+ ;;
--initial)
flags_ndb=$flags_ndb" -i"
initial_ndb=1
@@ -33,8 +64,6 @@ while test $# -gt 0; do
shift
done
-exec_ndb=$bindir/ndb
-exec_mgmtsrvr=$bindir/mgmtsrvr
fs_ndb=$fsdir/ndbcluster
fs_mgm_1=$fs_ndb/1.ndb_mgm
fs_ndb_2=$fs_ndb/2.ndb_db
@@ -100,7 +129,7 @@ sed \
> "$fs_mgm_1/config.ini"
fi
-if ( cd $fs_mgm_1 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else
+if ( cd $fs_mgm_1 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1
fi
@@ -111,7 +140,7 @@ cat `find $fs_ndb -name 'node*.pid'` > $pidfile
NDB_ID="2"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
-( cd $fs_ndb_2 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & )
+( cd $fs_ndb_2 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_ndb -d $flags_ndb & )
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
@@ -119,30 +148,63 @@ cat `find $fs_ndb -name 'node*.pid'` > $pidfile
NDB_ID="3"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
-( cd $fs_ndb_3 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & )
+( cd $fs_ndb_3 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_ndb -d $flags_ndb & )
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
# Start management client
-sleep 5
-echo "show" | $bindir/mgmtclient $ndb_host $ndb_port
+sleep 10
+echo "show" | $exec_mgmtclient $ndb_host $ndb_port
# test if Ndb Cluster starts properly
NDB_ID="11"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
-#if ( export LD_LIBRARY_PATH=$libdir ; $bindir/list_tables ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
-if ( export LD_LIBRARY_PATH=$libdir ; $bindir/waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
+if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
echo "Ndbcluster startup failed"
exit 1
fi
-echo $NDB_CONNECTSTRING > Ndb.cfg
+echo $NDB_CONNECTSTRING > $cfgfile
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
}
-start_default_ndbcluster
+stop_default_ndbcluster() {
+
+#if [ ! -f $pidfile ] ; then
+# exit 0
+#fi
+
+if [ ! -f $cfgfile ] ; then
+ echo "$cfgfile missing"
+ exit 1
+fi
+
+ndb_host=`cat $cfgfile | sed -e "s,.*host=\(.*\)\:.*,\1,1"`
+ndb_port=`cat $cfgfile | sed -e "s,.*host=$ndb_host\:\([0-9]*\).*,\1,1"`
+
+# Start management client
+
+exec_mgmtclient="$exec_mgmtclient --try-reconnect=1 $ndb_host $ndb_port"
+
+echo "$exec_mgmtclient"
+echo "all stop" | $exec_mgmtclient
+
+sleep 5
+
+if [ -f $pidfile ] ; then
+ kill `cat $pidfile`
+ rm $pidfile
+fi
+
+}
+
+if [ $stop_ndb ] ; then
+ stop_default_ndbcluster
+else
+ start_default_ndbcluster
+fi
exit 0
diff --git a/mysql-test/ndb/stop_ndbcluster b/mysql-test/ndb/stop_ndbcluster
deleted file mode 100755
index e1a98f1de07..00000000000
--- a/mysql-test/ndb/stop_ndbcluster
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2004 MySQL AB
-# For a more info consult the file COPYRIGHT distributed with this file
-
-# This scripts stops the table handler ndbcluster
-
-bindir=`pwd`/../ndb/bin
-pidfile=ndbcluster.pid
-cfgfile=Ndb.cfg
-
-while test $# -gt 0; do
- case "$1" in
- --port-base=*)
- port_base=`echo "$1" | sed -e "s;--port-base=;;"`
- ;;
- -- ) shift; break ;;
- --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
- * ) break ;;
- esac
- shift
-done
-
-stop_default_ndbcluster() {
-
-#if [ ! -f $pidfile ] ; then
-# exit 0
-#fi
-
-if [ ! -f $cfgfile ] ; then
- echo "$cfgfile missing"
- exit 1
-fi
-
-ndb_host=`cat $cfgfile | sed -e "s,.*host=\(.*\)\:.*,\1,1"`
-ndb_port=`cat $cfgfile | sed -e "s,.*host=$ndb_host\:\([0-9]*\).*,\1,1"`
-
-# Start management client
-
-exec_mgmtclient="$bindir/mgmtclient --try-reconnect=1 $ndb_host $ndb_port"
-
-echo "$exec_mgmtclient"
-echo "all stop" | $exec_mgmtclient
-
-sleep 5
-
-if [ -f $pidfile ] ; then
- kill `cat $pidfile`
- rm $pidfile
-fi
-
-}
-
-stop_default_ndbcluster
-
-exit 0
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 60a28e5018f..43bcf94d6d9 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -172,7 +172,7 @@ create table t1 ( URL_ID int(11), URL varchar(80));
create table t2 ( REQ_ID int(11), URL_ID int(11));
insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
insert into t2 values (1,4), (5,4), (5,5);
-select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
+select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
t2.URL_ID = t1.URL_ID group by REQ_ID;
REQ_ID URL
1 X
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index b66ef6d6a31..3fb1a5dd31c 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -167,12 +167,10 @@ count(*)
150
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range g g 32 NULL 4 Using where
+1 SIMPLE t1 range g g 32 NULL 7 Using where
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
fid AsText(g)
1 LINESTRING(150 150,150 150)
-11 LINESTRING(140 140,160 160)
-2 LINESTRING(149 149,151 151)
3 LINESTRING(148 148,152 152)
4 LINESTRING(147 147,153 153)
5 LINESTRING(146 146,154 154)
@@ -181,6 +179,8 @@ fid AsText(g)
8 LINESTRING(143 143,157 157)
9 LINESTRING(142 142,158 158)
10 LINESTRING(141 141,159 159)
+11 LINESTRING(140 140,160 160)
+2 LINESTRING(149 149,151 151)
DROP TABLE t1;
CREATE TABLE t2 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -305,10 +305,10 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
+46 LINESTRING(51 41,60 50)
+56 LINESTRING(41 41,50 50)
45 LINESTRING(51 51,60 60)
55 LINESTRING(41 51,50 60)
-56 LINESTRING(41 41,50 50)
-46 LINESTRING(51 41,60 50)
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
diff --git a/mysql-test/r/have_geometry.require b/mysql-test/r/have_geometry.require
new file mode 100644
index 00000000000..ba515a4bbb6
--- /dev/null
+++ b/mysql-test/r/have_geometry.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_geometry YES
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index 23a39a242a1..470a3e8439f 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -226,3 +226,20 @@ WHERE ( r = 1 AND a IN ( 1, 2 ) AND ( u = 'w' OR u LIKE 'w/%' ) )
OR ( r = 1 AND a IN ( 3 ) AND ( u = 'w/U' OR u LIKE 'w/U/%' ) )
OR ( r = 1 AND a IN ( 1, 2, 3 ) AND ( u = 'w' ) );
drop table t1;
+CREATE TABLE t1 (a VARCHAR(16), UNIQUE(a));
+INSERT INTO t1 VALUES ('1'), ('2'), ('3');
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = '2' LIMIT 0, 1;
+a
+2
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (0), (1), (2);
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = 0 GROUP BY a HAVING a > 10;
+a
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+0
+DROP TABLE t1;
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index aede2220466..2448a1d3209 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -83,7 +83,7 @@ insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com'
insert into t2 values (1,4), (5,4), (5,5);
# Make this order independent
--replace_result www.help.com X www.host.com X www.google.com X
-select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
+select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
t2.URL_ID = t1.URL_ID group by REQ_ID;
# check min/max function
--replace_result www.help.com X www.host.com X www.google.com X
@@ -132,7 +132,7 @@ drop table t1, t2;
CREATE TABLE t1 (id1 tinyint(4) NOT NULL, id2 tinyint(4) NOT NULL);
INSERT INTO t1 VALUES (1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(2, 1),(2, 2),(2, 3);
-CREATE TABLE t2 (id1 tinyint(4) NOT NULL);
+CREATE TABLE t2 (id1 tinyint(4) NOT NULL);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 AND t1.id1=1 GROUP BY t1.id1;
SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
@@ -163,7 +163,7 @@ drop table t1;
# Test with subqueries (Bug #3319)
#
-create table t1 (a int, c int);
+create table t1 (a int, c int);
insert into t1 values (1, 2), (2, 3), (2, 4), (3, 5);
create table t2 (a int, c int);
insert into t2 values (1, 5), (2, 4), (3, 3), (3,3);
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
index 8e91e5891b8..817249b7e4c 100644
--- a/mysql-test/t/gis-rtree.test
+++ b/mysql-test/t/gis-rtree.test
@@ -1,3 +1,5 @@
+-- source include/have_geometry.inc
+
#
# test of rtree (using with spatial data)
#
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index ea460d5f7b0..590007caba1 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -1,3 +1,5 @@
+-- source include/have_geometry.inc
+
#
# Spatial objects
#
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
index e63e894c1cf..c20b6e9ab6c 100644
--- a/mysql-test/t/select_found.test
+++ b/mysql-test/t/select_found.test
@@ -137,3 +137,22 @@ WHERE ( r = 1 AND a IN ( 1, 2 ) AND ( u = 'w' OR u LIKE 'w/%' ) )
OR ( r = 1 AND a IN ( 1, 2, 3 ) AND ( u = 'w' ) );
drop table t1;
+#
+# Bug #3738: we have a ref key
+#
+
+CREATE TABLE t1 (a VARCHAR(16), UNIQUE(a));
+INSERT INTO t1 VALUES ('1'), ('2'), ('3');
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = '2' LIMIT 0, 1;
+SELECT FOUND_ROWS();
+DROP TABLE t1;
+
+#
+# Bug #3845: group by, having and empty result
+#
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (0), (1), (2);
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = 0 GROUP BY a HAVING a > 10;
+SELECT FOUND_ROWS();
+DROP TABLE t1;