summaryrefslogtreecommitdiff
path: root/mysql-test/t/mysqltest.test
diff options
context:
space:
mode:
authorSven Sandberg <sven@mysql.com>2008-10-23 16:23:13 +0200
committerSven Sandberg <sven@mysql.com>2008-10-23 16:23:13 +0200
commitc7f8ffe7a7d0ef7d046a5f67c1278faf6c0f7e5d (patch)
tree8af8b0d3058011dedc248622d77525d46d0bb661 /mysql-test/t/mysqltest.test
parent3be6d967c5d04fa6dbeab1c25f28673d3abf8433 (diff)
downloadmariadb-git-c7f8ffe7a7d0ef7d046a5f67c1278faf6c0f7e5d.tar.gz
BUG#35701: please allow test language variables in connection and sync_slave_with_master
Problem: In the mysqltest language, it was not possible to set the current connection from a variable, and it was not possible to read the current connection. Fix: Allow setting the connection from a variable, like: connection $variable; and introduce the mysqltest language variable $CURRENT_CONNECTION, which holds the name of the current connection. client/mysqltest.cc: - Made select_connection use the common argument parser instead of its own home-rolled version. That allows variable expansion, for instance. - Made select_connection_name set the variable $CURRENT_CONNECTION, so that test scripts can use that. - Refactored a bit so that stuff that needs to be done when changing connection is located to one place. mysql-test/t/mysqltest.test: Added test case for $CURRENT_CONNECTION and "connection $variable"
Diffstat (limited to 'mysql-test/t/mysqltest.test')
-rw-r--r--mysql-test/t/mysqltest.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index ccc40072220..ba3f2f5da5e 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -2183,5 +2183,29 @@ select 1;
--exec echo "--select 1;" | $MYSQL_TEST 2>&1
+# ----------------------------------------------------------------------------
+# BUG#35701: please allow test language variables in connection and sync_slave_with_master
+# Test that "connection $variable" works and that $CURRENT_CONNECTION has the right value.
+# ----------------------------------------------------------------------------
+
+connect (con1,localhost,root,,);
+--echo $CURRENT_CONNECTION
+
+connection default;
+--echo $CURRENT_CONNECTION
+
+connection con1;
+--echo $CURRENT_CONNECTION
+
+let $x= default;
+let $y= con1;
+
+connection $x;
+--echo $CURRENT_CONNECTION
+
+connection $y;
+--echo $CURRENT_CONNECTION
+
+
--echo End of tests