Commit b7e61a3a authored by Bjorn Munch's avatar Bjorn Munch

Some if simplifications in tests

parents 209df51c 63728717
......@@ -9,7 +9,7 @@
# --source extra/rpl_tests/rpl_stop_slave.test
#
if (`SELECT "$tmp_table_stm" = ''`)
if (!$tmp_table_stm)
{
--echo \$tmp_table_stm is NULL
--die $tmp_table_stm is NULL
......
......@@ -34,7 +34,7 @@ if (!$err)
{
--echo Success: Was able to run '$statement' under FTWRL.
unlock tables;
if (`SELECT "$cleanup_stmt" <> ""`)
if ($cleanup_stmt)
{
--eval $cleanup_stmt;
}
......@@ -91,12 +91,12 @@ connection default;
--reap
}
if (`SELECT "$cleanup_stmt" <> ""`)
if ($cleanup_stmt)
{
--eval $cleanup_stmt;
}
if (`SELECT "$skip_3rd_check" = ""`)
if (!$skip_3rd_check)
{
#
# Finally, let us check that FTWRL will succeed if this statement
......@@ -147,7 +147,7 @@ connection default;
}
set debug_sync= "RESET";
if (`SELECT "$cleanup_stmt" <> ""`)
if ($cleanup_stmt)
{
--eval $cleanup_stmt;
}
......
......@@ -41,11 +41,11 @@ if (!$err)
{
--echo Error: Was able to run '$statement' under FTWRL!
unlock tables;
if (`SELECT "$cleanup_stmt1" <> ""`)
if ($cleanup_stmt1)
{
--eval $cleanup_stmt1;
}
if (`SELECT "$cleanup_stmt2" <> ""`)
if ($cleanup_stmt2)
{
--eval $cleanup_stmt2;
}
......@@ -88,16 +88,16 @@ unlock tables;
connection default;
--reap
if (`SELECT "$cleanup_stmt1" <> ""`)
if ($cleanup_stmt1)
{
--eval $cleanup_stmt1;
}
if (`SELECT "$cleanup_stmt2" <> ""`)
if ($cleanup_stmt2)
{
--eval $cleanup_stmt2;
}
if (`SELECT "$skip_3rd_check" = ""`)
if (!$skip_3rd_check)
{
#
# Finally, let us check that FTWRL will not succeed if this
......@@ -141,11 +141,11 @@ connection default;
set debug_sync= "RESET";
if (`SELECT "$cleanup_stmt1" <> ""`)
if ($cleanup_stmt1)
{
--eval $cleanup_stmt1;
}
if (`SELECT "$cleanup_stmt2" <> ""`)
if ($cleanup_stmt2)
{
--eval $cleanup_stmt2;
}
......
......@@ -25,7 +25,7 @@
--let $_param_value= query_get_value(SHOW SLAVE STATUS, $slave_param, 1)
if (`SELECT '$_param_value' != '$slave_param_value'`) {
if ($_param_value != $slave_param_value) {
--source include/show_rpl_debug_info.inc
--echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value'
--die Wrong value for slave parameter
......
......@@ -81,7 +81,7 @@ if (`SELECT LOCATE(',', '$diff_tables') = 0`)
# Iterate over all tables
--let $_dt_outfile=
--let $_dt_prev_outfile=
while (`SELECT '$_dt_tables' != ''`)
while ($_dt_tables)
{
--let $_dt_table= `SELECT SUBSTRING_INDEX('$_dt_tables', ',', 1)`
--let $_dt_tables= `SELECT SUBSTRING('$_dt_tables', LENGTH('$_dt_table') + 2)`
......
......@@ -111,11 +111,11 @@ if (`SELECT '$rpl_topology' = '' OR '$rpl_server_count' = ''`)
--die You must set $rpl_topology and $rpl_server_count before you source rpl_change_topology.inc. If you really want to change to the empty topology, set $rpl_topology= none
}
--let $_rpl_topology= $rpl_topology
if (`SELECT '$_rpl_topology' = 'none'`)
if ($_rpl_topology == 'none')
{
--let $_rpl_topology=
}
if (`SELECT '!$rpl_master_list!' = '!!'`)
if ($rpl_master_list == '')
{
--die You must source include/rpl_init.inc before you source include/rpl_change_topology.inc
}
......@@ -227,16 +227,13 @@ if (!$rpl_skip_change_master)
}
eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_LOG_FILE = '$_rpl_master_log_file'$_rpl_master_log_pos, MASTER_CONNECT_RETRY = 1;
}
if (!$_rpl_master)
if ($_rpl_master == '')
{
if (`SELECT '$_rpl_master' = ''`)
{
# This un-configures the server so that it's not a slave.
# After BUG#28796, such configuration is not possible any more.
#--let $rpl_connection_name= server_$_rpl_server
#--source include/rpl_connection.inc
#CHANGE MASTER TO MASTER_HOST = '';
}
}
--dec $_rpl_server
}
......
......@@ -33,7 +33,7 @@ if (!$rpl_server_number)
{
--die ERROR IN TEST: You must set $rpl_server_number before sourcing include/rpl_connect.inc
}
if (`SELECT '$rpl_connection_name' = ''`)
if (!$rpl_connection_name)
{
--die ERROR IN TEST: You must set $rpl_connection_name before sourcing include/rpl_connect.inc
}
......
......@@ -46,7 +46,7 @@ if (!$rpl_diff_statement)
# Get database name.
--let $_rpl_diff_database= $rpl_diff_database
if (`SELECT '$_rpl_diff_database' = ''`)
if (!$_rpl_diff_database)
{
--let $_rpl_diff_database= test
}
......
......@@ -68,7 +68,7 @@ while ($_rpl_server)
# Only check slave threads for error on hosts that were at some
# point configured as slave.
--let $_tmp= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
if (`SELECT '$_tmp' != 'No such row'`)
if ($_tmp != 'No such row')
{
--source include/check_slave_no_error.inc
}
......
......@@ -116,24 +116,24 @@ if ($rpl_debug)
}
# Allow $MASTER_MYPORT as alias for $SERVER_MYPORT_1
if (`SELECT '$SERVER_MYPORT_1' = ''`)
if (!$SERVER_MYPORT_1)
{
--let SERVER_MYPORT_1= $MASTER_MYPORT
}
# Allow $SLAVE_MYPORT as alias for $SERVER_MYPORT_2
if (`SELECT '$SERVER_MYPORT_2' = ''`)
if (!$SERVER_MYPORT_2)
{
--let SERVER_MYPORT_2= $SLAVE_MYPORT
}
# Allow $MASTER_MYPORT1 as alias for $SERVER_MYPORT_3
# (this alias is used by rpl_ndb tests)
if (`SELECT '$SERVER_MYPORT_3' = ''`)
if (!$SERVER_MYPORT_3)
{
--let SERVER_MYPORT_3= $MASTER_MYPORT1
}
# Allow $SLAVE_MYPORT1 as alias for $SERVER_MYPORT_4
# (this alias is used by rpl_ndb tests)
if (`SELECT '$SERVER_MYPORT_4' = ''`)
if (!$SERVER_MYPORT_4)
{
--let SERVER_MYPORT_4= $SLAVE_MYPORT1
}
......
......@@ -58,13 +58,13 @@
--let $_show_slave_status_items=$status_items
if (`SELECT "XX$status_items" = "XX"`)
if (!$status_items)
{
--die Bug in test case: The mysqltest variable $status_items is not set.
}
while (`SELECT "XX$_show_slave_status_items" <> "XX"`)
while ($_show_slave_status_items)
{
--let $_show_slave_status_name= `SELECT SUBSTRING_INDEX('$_show_slave_status_items', ',', 1)`
--let $_show_slave_status_items= `SELECT LTRIM(SUBSTRING('$_show_slave_status_items', LENGTH('$_show_slave_status_name') + 2))`
......
......@@ -36,7 +36,7 @@
--source include/save_master_pos.inc
--let $rpl_connection_name= slave
if (`SELECT '$sync_slave_connection' != ''`)
if ($sync_slave_connection)
{
--let $rpl_connection_name= $sync_slave_connection
}
......
......@@ -24,7 +24,7 @@ while (`SELECT INSTR("$_last_event","$wait_binlog_event") = 0`)
real_sleep 0.1;
let $_event= query_get_value(SHOW BINLOG EVENTS, Info, $_event_pos);
let $_last_event= $_event;
while (`SELECT "$_event" != "No such row"`)
while ($_event != "No such row")
{
inc $_event_pos;
let $_last_event= $_event;
......
......@@ -52,7 +52,7 @@ if (!$_slave_timeout)
let $_slave_timeout= 300;
}
if (`SELECT '$slave_error_param' = ''`)
if ($slave_error_param == '')
{
--let $slave_error_param= 1
}
......@@ -70,7 +70,7 @@ if ($rpl_debug)
--let $_slave_check_configured= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1)
if (`SELECT '$_slave_check_configured' = 'No such row'`)
if ($_slave_check_configured == 'No such row')
{
--echo **** ERROR: SHOW SLAVE STATUS returned empty result set. Slave not configured. ****
--source include/show_rpl_debug_info.inc
......
......@@ -27,12 +27,12 @@
# @@secure_file_priv. That makes this more complex than you might
# expect.
if (`SELECT '$write_to_file' = ''`)
if (!$write_to_file)
{
--die You must set the mysqltest variable \$write_to_file before you source include/write_var_to_file.inc
}
if (`SELECT '$write_to_file' = 'GENERATE'`)
if ($write_to_file == 'GENERATE')
{
--let $_wvtf_suffix= `SELECT UUID()`
--let $write_to_file= $MYSQLTEST_VARDIR/tmp/_var_file_$_wvtf_suffix.inc
......
......@@ -7,7 +7,7 @@
--source include/have_innodb.inc
let $innodb_lock_wait_timeout= query_get_value(SHOW VARIABLES LIKE 'innodb_lock_wait_timeout%', Value, 1);
if (`SELECT $innodb_lock_wait_timeout < 10`)
if ($innodb_lock_wait_timeout < 10)
{
--echo # innodb_lock_wait_timeout must be >= 10 seconds
--echo # so that this test can work all time fine on an overloaded testing box
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment