mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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"
This commit is contained in:
@ -740,4 +740,9 @@ select 1;
|
||||
1
|
||||
-- a comment for the server;
|
||||
mysqltest: At line 1: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
|
||||
con1
|
||||
default
|
||||
con1
|
||||
default
|
||||
con1
|
||||
End of tests
|
||||
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user