Commit 0455ff8f authored by Bjorn Munch's avatar Bjorn Munch

Follow-up to Bug #55582 which allows chaecking strings in if

Simplified cases where a select was used to compare variable against ''
parent 05062d57
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
# #
connection slave; connection slave;
if (`SELECT $debug_sync_action = ''`) if (!$debug_sync_action)
{ {
--die Cannot continue. Please set value for debug_sync_action. --die Cannot continue. Please set value for debug_sync_action.
} }
......
...@@ -24,7 +24,7 @@ connection master; ...@@ -24,7 +24,7 @@ connection master;
# MTR is not case-sensitive. # MTR is not case-sensitive.
let $lower_stmt_head= load data; let $lower_stmt_head= load data;
let $UPPER_STMT_HEAD= LOAD DATA; let $UPPER_STMT_HEAD= LOAD DATA;
if (`SELECT '$lock_option' <> ''`) if ($lock_option)
{ {
#if $lock_option is null, an extra blank is added into the statement, #if $lock_option is null, an extra blank is added into the statement,
#this will change the result of rpl_loaddata test case. so $lock_option #this will change the result of rpl_loaddata test case. so $lock_option
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# Reset DEBUG_SYNC facility for safety. # Reset DEBUG_SYNC facility for safety.
set debug_sync= "RESET"; set debug_sync= "RESET";
if (`SELECT '$restore_table' <> ''`) if ($restore_table)
{ {
--eval create temporary table t_backup select * from $restore_table; --eval create temporary table t_backup select * from $restore_table;
} }
...@@ -82,7 +82,7 @@ connection default; ...@@ -82,7 +82,7 @@ connection default;
--eval delete from $table where i = 0; --eval delete from $table where i = 0;
if (`SELECT '$restore_table' <> ''`) if ($restore_table)
{ {
--eval truncate table $restore_table; --eval truncate table $restore_table;
--eval insert into $restore_table select * from t_backup; --eval insert into $restore_table select * from t_backup;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# Reset DEBUG_SYNC facility for safety. # Reset DEBUG_SYNC facility for safety.
set debug_sync= "RESET"; set debug_sync= "RESET";
if (`SELECT '$restore_table' <> ''`) if ($restore_table)
{ {
--eval create temporary table t_backup select * from $restore_table; --eval create temporary table t_backup select * from $restore_table;
} }
...@@ -67,7 +67,7 @@ if (!$success) ...@@ -67,7 +67,7 @@ if (!$success)
--eval delete from $table where i = 0; --eval delete from $table where i = 0;
if (`SELECT '$restore_table' <> ''`) if ($restore_table)
{ {
--eval truncate table $restore_table; --eval truncate table $restore_table;
--eval insert into $restore_table select * from t_backup; --eval insert into $restore_table select * from t_backup;
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
# # at this point, get_relay_log_pos.inc sets $relay_log_pos. echo position # # at this point, get_relay_log_pos.inc sets $relay_log_pos. echo position
# # in $relay_log_file: $relay_log_pos. # # in $relay_log_file: $relay_log_pos.
if (`SELECT '$relay_log_file' = ''`) if (!$relay_log_file)
{ {
--die 'variable $relay_log_file is null' --die 'variable $relay_log_file is null'
} }
if (`SELECT '$master_log_pos' = ''`) if (!$master_log_pos)
{ {
--die 'variable $master_log_pos is null' --die 'variable $master_log_pos is null'
} }
......
...@@ -44,7 +44,7 @@ connection master; ...@@ -44,7 +44,7 @@ connection master;
# kill the query that is waiting # kill the query that is waiting
eval kill query $connection_id; eval kill query $connection_id;
if (`SELECT '$debug_lock' != ''`) if ($debug_lock)
{ {
# release the lock to allow binlog continue # release the lock to allow binlog continue
eval SELECT RELEASE_LOCK($debug_lock); eval SELECT RELEASE_LOCK($debug_lock);
...@@ -57,7 +57,7 @@ reap; ...@@ -57,7 +57,7 @@ reap;
connection master; connection master;
if (`SELECT '$debug_lock' != ''`) if ($debug_lock)
{ {
# get lock again to make the next query wait # get lock again to make the next query wait
eval SELECT GET_LOCK($debug_lock, 10); eval SELECT GET_LOCK($debug_lock, 10);
......
...@@ -25,7 +25,7 @@ source include/kill_query.inc; ...@@ -25,7 +25,7 @@ source include/kill_query.inc;
connection master; connection master;
disable_query_log; disable_query_log;
disable_result_log; disable_result_log;
if (`SELECT '$debug_lock' != ''`) if ($debug_lock)
{ {
eval SELECT RELEASE_LOCK($debug_lock); eval SELECT RELEASE_LOCK($debug_lock);
} }
...@@ -36,8 +36,8 @@ source include/diff_master_slave.inc; ...@@ -36,8 +36,8 @@ source include/diff_master_slave.inc;
# Acquire the debug lock again if used # Acquire the debug lock again if used
connection master; connection master;
disable_query_log; disable_result_log; if (`SELECT '$debug_lock' != disable_query_log; disable_result_log;
''`) { eval SELECT GET_LOCK($debug_lock, 10); } enable_result_log; if ($debug_lock) { eval SELECT GET_LOCK($debug_lock, 10); }
enable_query_log; enable_result_log; enable_query_log;
connection $connection_name; connection $connection_name;
...@@ -56,7 +56,7 @@ if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) { ...@@ -56,7 +56,7 @@ if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) {
# Read server variables. # Read server variables.
let $MYSQLD_DATADIR= `SELECT @@datadir`; let $MYSQLD_DATADIR= `SELECT @@datadir`;
let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1); let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1);
if (`SELECT '$_fake_filename' = ''`) { if (!$_fake_filename) {
--echo Badly written test case: relay_log variable is empty. Please use the --echo Badly written test case: relay_log variable is empty. Please use the
--echo server option --relay-log=FILE. --echo server option --relay-log=FILE.
} }
......
...@@ -27,14 +27,14 @@ if (!$binlog_start) ...@@ -27,14 +27,14 @@ if (!$binlog_start)
} }
--let $_statement=show binlog events --let $_statement=show binlog events
if (`SELECT '$binlog_file' <> ''`) if ($binlog_file)
{ {
--let $_statement= $_statement in '$binlog_file' --let $_statement= $_statement in '$binlog_file'
} }
--let $_statement= $_statement from $binlog_start --let $_statement= $_statement from $binlog_start
if (`SELECT '$binlog_limit' <> ''`) if ($binlog_limit)
{ {
--let $_statement= $_statement limit $binlog_limit --let $_statement= $_statement limit $binlog_limit
} }
......
...@@ -48,13 +48,13 @@ let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1); ...@@ -48,13 +48,13 @@ let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1);
eval SHOW BINLOG EVENTS IN '$binlog_name'; eval SHOW BINLOG EVENTS IN '$binlog_name';
let $_master_con= $master_connection; let $_master_con= $master_connection;
if (`SELECT '$_master_con' = ''`) if (!$_master_con)
{ {
if (`SELECT '$_con' = 'slave'`) if (`SELECT '$_con' = 'slave'`)
{ {
let $_master_con= master; let $_master_con= master;
} }
if (`SELECT '$_master_con' = ''`) if (!$_master_con)
{ {
--echo Unable to determine master connection. No debug info printed for master. --echo Unable to determine master connection. No debug info printed for master.
--echo Please fix the test case by setting $master_connection before sourcing --echo Please fix the test case by setting $master_connection before sourcing
...@@ -62,7 +62,7 @@ if (`SELECT '$_master_con' = ''`) ...@@ -62,7 +62,7 @@ if (`SELECT '$_master_con' = ''`)
} }
} }
if (`SELECT '$_master_con' != ''`) if ($_master_con)
{ {
let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1); let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
# $master_connection # $master_connection
# See wait_for_slave_param.inc for description. # See wait_for_slave_param.inc for description.
if (`SELECT '$slave_io_errno' = ''`) { if (!$slave_io_errno) {
--die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc --die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc
} }
......
...@@ -51,7 +51,7 @@ if (!$_slave_timeout_counter) ...@@ -51,7 +51,7 @@ if (!$_slave_timeout_counter)
} }
let $_slave_param_comparison= $slave_param_comparison; let $_slave_param_comparison= $slave_param_comparison;
if (`SELECT '$_slave_param_comparison' = ''`) if (!$_slave_param_comparison)
{ {
let $_slave_param_comparison= =; let $_slave_param_comparison= =;
} }
...@@ -71,7 +71,7 @@ while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_ ...@@ -71,7 +71,7 @@ while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_
if (!$_slave_timeout_counter) if (!$_slave_timeout_counter)
{ {
--echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** --echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value ****
if (`SELECT '$slave_error_message' != ''`) if ($slave_error_message)
{ {
--echo Message: $slave_error_message --echo Message: $slave_error_message
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
# $master_connection # $master_connection
# See wait_for_slave_param.inc for description. # See wait_for_slave_param.inc for description.
if (`SELECT '$slave_sql_errno' = ''`) { if (!$slave_sql_errno) {
--die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc --die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc
} }
......
...@@ -45,7 +45,7 @@ if (!$_status_timeout_counter) ...@@ -45,7 +45,7 @@ if (!$_status_timeout_counter)
} }
let $_status_var_comparsion= $status_var_comparsion; let $_status_var_comparsion= $status_var_comparsion;
if (`SELECT '$_status_var_comparsion' = ''`) if (!$_status_var_comparsion)
{ {
let $_status_var_comparsion= =; let $_status_var_comparsion= =;
} }
......
...@@ -119,7 +119,7 @@ echo [on master]; ...@@ -119,7 +119,7 @@ echo [on master];
# This will block the execution of a statement at the DBUG_SYNC_POINT # This will block the execution of a statement at the DBUG_SYNC_POINT
# with given lock name # with given lock name
if (`SELECT '$debug_lock' != ''`) if ($debug_lock)
{ {
disable_query_log; disable_query_log;
disable_result_log; disable_result_log;
......
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