From: Bjorn Munch Date: November 19 2010 10:19am Subject: bzr commit into mysql-trunk-mtr branch (bjorn.munch:3359) List-Archive: http://lists.mysql.com/commits/124395 Message-Id: <201011191019.oAJAJTVv016599@khepri15.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///home/bm136801/my/merge-tr/ based on revid:dmitry.lenev@stripped 3359 Bjorn Munch 2010-11-19 [merge] merge from trunk-mtr modified: .bzr-mysql/default.conf client/mysqltest.cc mysql-test/extra/binlog_tests/binlog_truncate.test mysql-test/extra/binlog_tests/blackhole.test mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test mysql-test/extra/rpl_tests/create_recursive_construct.inc mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test mysql-test/extra/rpl_tests/rpl_insert_delayed.test mysql-test/extra/rpl_tests/rpl_not_null.test mysql-test/extra/rpl_tests/rpl_row_empty_imgs.test mysql-test/extra/rpl_tests/rpl_row_img.test mysql-test/extra/rpl_tests/rpl_row_img_blobs.test mysql-test/extra/rpl_tests/rpl_row_img_diff_indexes.test mysql-test/extra/rpl_tests/rpl_stop_slave.test mysql-test/include/check_slave_is_running.inc mysql-test/include/check_slave_param.inc mysql-test/include/diff_tables.inc mysql-test/include/have_example_plugin.inc mysql-test/include/have_semisync_plugin.inc mysql-test/include/have_simple_parser.inc mysql-test/include/have_udf.inc mysql-test/include/mtr_warnings.sql mysql-test/include/mysql_upgrade_preparation.inc mysql-test/include/no_valgrind_without_big.inc mysql-test/include/not_parallel.inc mysql-test/include/rpl_assert.inc mysql-test/include/rpl_chained_3_hosts.inc mysql-test/include/rpl_diff_tables.inc mysql-test/include/rpl_row_img_set.inc mysql-test/include/setup_fake_relay_log.inc mysql-test/include/show_rpl_debug_info.inc mysql-test/include/show_slave_status.inc mysql-test/include/truncate_file.inc mysql-test/include/wait_for_binlog_event.inc mysql-test/include/wait_for_slave_io_to_stop.inc mysql-test/include/wait_for_slave_sql_to_stop.inc mysql-test/include/wait_for_slave_to_stop.inc mysql-test/include/wait_show_condition.inc mysql-test/mysql-test-run.pl mysql-test/r/mysqltest.result mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test mysql-test/suite/binlog/t/binlog_unsafe.test mysql-test/suite/federated/federated_bug_25714.test mysql-test/suite/perfschema/t/setup_actors.test mysql-test/suite/perfschema_stress/t/modify.test mysql-test/suite/perfschema_stress/t/setup.test mysql-test/suite/perfschema_stress/t/work.test mysql-test/suite/rpl/t/rpl_change_master.test mysql-test/suite/rpl/t/rpl_concurrency_error.test mysql-test/suite/rpl/t/rpl_delayed_slave.test mysql-test/suite/rpl/t/rpl_heartbeat.test mysql-test/suite/rpl/t/rpl_mysql_upgrade.test mysql-test/suite/rpl/t/rpl_packet.test mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test mysql-test/suite/rpl/t/rpl_seconds_behind_master.test mysql-test/suite/rpl/t/rpl_semi_sync.test mysql-test/suite/rpl/t/rpl_semi_sync_event.test mysql-test/suite/rpl/t/rpl_server_uuid.test mysql-test/suite/rpl/t/rpl_slow_query_log.test mysql-test/suite/rpl/t/rpl_ssl.test mysql-test/suite/sys_vars/t/slow_launch_time_func.test mysql-test/t/change_user.test mysql-test/t/execution_constants.test mysql-test/t/fix_priv_tables.test mysql-test/t/mysqltest.test mysql-test/t/named_pipe.test mysql-test/t/server_uuid.test mysql-test/t/shm.test mysql-test/t/system_mysql_db_fix40123.test mysql-test/t/system_mysql_db_fix50030.test mysql-test/t/system_mysql_db_fix50117.test unittest/unit.pl === modified file '.bzr-mysql/default.conf' --- a/.bzr-mysql/default.conf 2010-11-19 09:15:30 +0000 +++ b/.bzr-mysql/default.conf 2010-11-19 10:19:07 +0000 @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@stripped" post_push_to = "commits@stripped" -tree_name = "mysql-trunk" +tree_name = "mysql-trunk-mtr" === modified file 'client/mysqltest.cc' --- a/client/mysqltest.cc 2010-10-27 14:46:44 +0000 +++ b/client/mysqltest.cc 2010-11-18 17:03:16 +0000 @@ -490,7 +490,8 @@ VAR* var_init(VAR* v, const char *name, int val_len); VAR* var_get(const char *var_name, const char** var_name_end, my_bool raw, my_bool ignore_not_existing); -void eval_expr(VAR* v, const char *p, const char** p_end); +void eval_expr(VAR* v, const char *p, const char** p_end, + bool open_end=false, bool backtick=true); my_bool match_delimiter(int c, const char *delim, uint length); void dump_result_to_reject_file(char *buf, int size); void dump_warning_messages(); @@ -2048,9 +2049,11 @@ static void var_free(void *v) C_MODE_END -void var_set_int(VAR *v, const char *str) +void var_check_int(VAR *v) { char *endptr; + char *str= v->str_val; + /* Initially assume not a number */ v->int_val= 0; v->is_int= false; @@ -2097,7 +2100,7 @@ VAR *var_init(VAR *v, const char *name, memcpy(tmp_var->str_val, val, val_len); tmp_var->str_val[val_len]= 0; } - var_set_int(tmp_var, val); + var_check_int(tmp_var); tmp_var->name_len = name_len; tmp_var->str_val_len = val_len; tmp_var->alloced_len = val_alloc_len; @@ -2338,7 +2341,8 @@ void var_query_set(VAR *var, const char dynstr_append_mem(&result, "\t", 1); } end= result.str + result.length-1; - eval_expr(var, result.str, (const char**) &end); + /* Evaluation should not recurse via backtick */ + eval_expr(var, result.str, (const char**) &end, false, false); dynstr_free(&result); } else @@ -2548,7 +2552,8 @@ void var_copy(VAR *dest, VAR *src) } -void eval_expr(VAR *v, const char *p, const char **p_end) +void eval_expr(VAR *v, const char *p, const char **p_end, + bool open_end, bool backtick) { DBUG_ENTER("eval_expr"); @@ -2566,14 +2571,14 @@ void eval_expr(VAR *v, const char *p, co /* Make sure there was just a $variable and nothing else */ const char* end= *p_end + 1; - if (end < expected_end) + if (end < expected_end && !open_end) die("Found junk '%.*s' after $variable in expression", (int)(expected_end - end - 1), end); DBUG_VOID_RETURN; } - if (*p == '`') + if (*p == '`' && backtick) { var_query_set(v, p, p_end); DBUG_VOID_RETURN; @@ -2613,7 +2618,7 @@ void eval_expr(VAR *v, const char *p, co v->str_val_len = new_val_len; memcpy(v->str_val, p, new_val_len); v->str_val[new_val_len] = 0; - var_set_int(v, p); + var_check_int(v); } DBUG_VOID_RETURN; } @@ -4243,7 +4248,7 @@ int do_save_master_pos() const char latest_applied_binlog_epoch_str[]= "latest_applied_binlog_epoch="; if (count) - sleep(1); + my_sleep(100*1000); /* 100ms */ if (mysql_query(mysql, query= "show engine ndb status")) die("failed in '%s': %d %s", query, mysql_errno(mysql), mysql_error(mysql)); @@ -4332,7 +4337,7 @@ int do_save_master_pos() count++; if (latest_handled_binlog_epoch >= start_epoch) do_continue= 0; - else if (count > 30) + else if (count > 300) /* 30s */ { break; } @@ -5526,6 +5531,40 @@ int do_done(struct st_command *command) return 0; } +/* Operands available in if or while conditions */ + +enum block_op { + EQ_OP, + NE_OP, + GT_OP, + GE_OP, + LT_OP, + LE_OP, + ILLEG_OP +}; + + +enum block_op find_operand(const char *start) +{ + char first= *start; + char next= *(start+1); + + if (first == '=' && next == '=') + return EQ_OP; + if (first == '!' && next == '=') + return NE_OP; + if (first == '>' && next == '=') + return GE_OP; + if (first == '>') + return GT_OP; + if (first == '<' && next == '=') + return LE_OP; + if (first == '<') + return LT_OP; + + return ILLEG_OP; +} + /* Process start of a "if" or "while" statement @@ -5551,6 +5590,13 @@ int do_done(struct st_command *command) A '!' can be used before the to indicate it should be executed if it evaluates to zero. + can also be a simple comparison condition: + + + + The left hand side must be a variable, the right hand side can be a + variable, number, string or `query`. Operands are ==, !=, <, <=, >, >=. + == and != can be used for strings, all can be used for numerical values. */ void do_block(enum block_cmd cmd, struct st_command* command) @@ -5586,11 +5632,16 @@ void do_block(enum block_cmd cmd, struct if (!expr_start++) die("missing '(' in %s", cmd_name); + while (my_isspace(charset_info, *expr_start)) + expr_start++; + /* Check for ! */ if (*expr_start == '!') { not_expr= TRUE; - expr_start++; /* Step past the '!' */ + expr_start++; /* Step past the '!', then any whitespace */ + while (*expr_start && my_isspace(charset_info, *expr_start)) + expr_start++; } /* Find ending ')' */ expr_end= strrchr(expr_start, ')'); @@ -5604,14 +5655,94 @@ void do_block(enum block_cmd cmd, struct die("Missing '{' after %s. Found \"%s\"", cmd_name, p); var_init(&v,0,0,0,0); - eval_expr(&v, expr_start, &expr_end); + /* If expression starts with a variable, it may be a compare condition */ + + if (*expr_start == '$') + { + const char *curr_ptr= expr_end; + eval_expr(&v, expr_start, &curr_ptr, true); + while (my_isspace(charset_info, *++curr_ptr)) + {} + /* If there was nothing past the variable, skip condition part */ + if (curr_ptr == expr_end) + goto NO_COMPARE; + + enum block_op operand= find_operand(curr_ptr); + if (operand == ILLEG_OP) + die("Found junk '%.*s' after $variable in condition", + (int)(expr_end - curr_ptr), curr_ptr); + + /* We could silently allow this, but may be confusing */ + if (not_expr) + die("Negation and comparison should not be combined, please rewrite"); + + /* Skip the 1 or 2 chars of the operand, then white space */ + if (operand == LT_OP || operand == GT_OP) + { + curr_ptr++; + } + else + { + curr_ptr+= 2; + } + while (my_isspace(charset_info, *curr_ptr)) + curr_ptr++; + + VAR v2; + var_init(&v2,0,0,0,0); + eval_expr(&v2, curr_ptr, &expr_end); + + if ((operand!=EQ_OP && operand!=NE_OP) && ! (v.is_int && v2.is_int)) + die ("Only == and != are supported for string values"); + + /* Now we overwrite the first variable with 0 or 1 (for false or true) */ + + switch (operand) + { + case EQ_OP: + if (v.is_int) + v.int_val= (v2.is_int && v2.int_val == v.int_val); + else + v.int_val= !strcmp (v.str_val, v2.str_val); + break; + + case NE_OP: + if (v.is_int) + v.int_val= ! (v2.is_int && v2.int_val == v.int_val); + else + v.int_val= (strcmp (v.str_val, v2.str_val) != 0); + break; + + case LT_OP: + v.int_val= (v.int_val < v2.int_val); + break; + case LE_OP: + v.int_val= (v.int_val <= v2.int_val); + break; + case GT_OP: + v.int_val= (v.int_val > v2.int_val); + break; + case GE_OP: + v.int_val= (v.int_val >= v2.int_val); + break; + } + + v.is_int= TRUE; + } else + { + if (*expr_start != '`' && ! my_isdigit(charset_info, *expr_start)) + die("Expression in if/while must beging with $, ` or a number"); + eval_expr(&v, expr_start, &expr_end); + } + + NO_COMPARE: /* Define inner block */ cur_block++; cur_block->cmd= cmd; - if (v.int_val) + if (v.is_int) { - cur_block->ok= TRUE; + cur_block->ok= (v.int_val != 0); } else /* Any non-empty string which does not begin with 0 is also TRUE */ { === modified file 'mysql-test/extra/binlog_tests/binlog_truncate.test' --- a/mysql-test/extra/binlog_tests/binlog_truncate.test 2010-05-25 20:01:38 +0000 +++ b/mysql-test/extra/binlog_tests/binlog_truncate.test 2010-11-17 10:16:13 +0000 @@ -12,13 +12,13 @@ eval CREATE TABLE t1 (a INT) ENGINE=$eng eval CREATE TABLE t2 (a INT) ENGINE=$engine; INSERT INTO t2 VALUES (1),(2),(3); let $binlog_start = query_get_value("SHOW MASTER STATUS", Position, 1); -if (`select length('$before_truncate') > 0`) { +if ($before_truncate) { eval $before_truncate; } --echo **** Truncate of empty table shall be logged TRUNCATE TABLE t1; -if (`select length('$before_truncate') > 0`) { +if ($before_truncate) { eval $before_truncate; } TRUNCATE TABLE t2; @@ -35,7 +35,7 @@ eval CREATE TABLE t2 (a INT) ENGINE=$eng INSERT INTO t1 VALUES (1),(2); let $binlog_start = query_get_value("SHOW MASTER STATUS", Position, 1); -if (`select length('$before_truncate') > 0`) { +if ($before_truncate) { eval $before_truncate; } === modified file 'mysql-test/extra/binlog_tests/blackhole.test' --- a/mysql-test/extra/binlog_tests/blackhole.test 2010-05-26 14:34:25 +0000 +++ b/mysql-test/extra/binlog_tests/blackhole.test 2010-11-17 10:16:13 +0000 @@ -173,7 +173,7 @@ insert into t1 values(2); rollback; let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1); -if (`SELECT $master_log_pos_2 <> $master_log_pos_1`) +if ($master_log_pos_2 != $master_log_pos_1) { echo $master_log_pos_1 $master_log_pos_2; die Rollbacked transaction has been binlogged; === modified file 'mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test' --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test 2010-09-01 02:51:08 +0000 +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test 2010-11-17 10:23:22 +0000 @@ -319,7 +319,7 @@ if (`select @@binlog_format = 'STATEMENT { --let $binlog_rollback= query_get_value(SHOW BINLOG EVENTS, Pos, 7) --let $binlog_query= query_get_value(SHOW BINLOG EVENTS, Info, 7) - if (`SELECT 'ROLLBACK' != '$binlog_query'`) { + if ($binlog_query != ROLLBACK) { --echo Wrong query from SHOW BINLOG EVENTS. Expected ROLLBACK, got '$binlog_query' --source include/show_rpl_debug_info.inc --die Wrong value for slave parameter === modified file 'mysql-test/extra/rpl_tests/create_recursive_construct.inc' --- a/mysql-test/extra/rpl_tests/create_recursive_construct.inc 2010-10-27 10:28:09 +0000 +++ b/mysql-test/extra/rpl_tests/create_recursive_construct.inc 2010-11-17 10:23:22 +0000 @@ -167,7 +167,9 @@ --let $CRC_create= ######## func_retval ######## -if (`SELECT $CRC_ARG_type = 0 AND '$CRC_ARG_value' != ''`) { +# if inside if in lieu of AND operand +if ($CRC_ARG_type == 0) { + if ($CRC_ARG_value) { # It will be safe to call this function and discard the return # value, but it will be unsafe to use return value (e.g., in # INSERT...SELECT). @@ -180,10 +182,11 @@ if (`SELECT $CRC_ARG_type = 0 AND '$CRC_ --let $CRC_RET_drop= DROP FUNCTION $CRC_name --let $CRC_RET_is_toplevel= 0 --let $CRC_RET_desc= function $CRC_name returning value from $CRC_ARG_desc + } } ######## func_sidef ######## -if (`SELECT $CRC_ARG_type = 1`) { +if ($CRC_ARG_type == 1) { # It will be unsafe to call func even if you discard return value. --let $CRC_name= func_sidef_$CRC_ARG_level --let $CRC_create= CREATE FUNCTION $CRC_name() RETURNS VARCHAR(100) BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; RETURN 0; END @@ -197,7 +200,7 @@ if (`SELECT $CRC_ARG_type = 1`) { } ######## proc ######## -if (`SELECT $CRC_ARG_type = 2`) { +if ($CRC_ARG_type == 2) { # It will be unsafe to call this procedure. --let $CRC_name= proc_$CRC_ARG_level --let $CRC_create= CREATE PROCEDURE $CRC_name() BEGIN $CRC_ARG_stmt_sidef; INSERT INTO ta$CRC_ARG_level VALUES (47); END @@ -211,7 +214,7 @@ if (`SELECT $CRC_ARG_type = 2`) { } ######## trig ######## -if (`SELECT $CRC_ARG_type = 3`) { +if ($CRC_ARG_type == 3) { # It will be unsafe to invoke this trigger. --let $CRC_name= trig_$CRC_ARG_level --let $CRC_create= CREATE TRIGGER $CRC_name BEFORE INSERT ON trigger_table_$CRC_ARG_level FOR EACH ROW BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; END @@ -225,7 +228,8 @@ if (`SELECT $CRC_ARG_type = 3`) { } ######## view_retval ######## -if (`SELECT $CRC_ARG_type = 4 AND '$CRC_ARG_sel_retval' != ''`) { +if ($CRC_ARG_type == 4) { + if ($CRC_ARG_sel_retval) { # It will be safe to select from this view if you discard the result # set, but unsafe to use result set (e.g., in INSERT..SELECT). --let $CRC_name= view_retval_$CRC_ARG_level @@ -237,10 +241,12 @@ if (`SELECT $CRC_ARG_type = 4 AND '$CRC_ --let $CRC_RET_drop= DROP VIEW $CRC_name --let $CRC_RET_is_toplevel= 0 --let $CRC_RET_desc= view $CRC_name returning value from $CRC_ARG_desc + } } ######## view_sidef ######## -if (`SELECT $CRC_ARG_type = 5 AND '$CRC_ARG_sel_sidef' != ''`) { +if ($CRC_ARG_type == 5) { + if ($CRC_ARG_sel_sidef) { # It will be unsafe to select from this view, even if you discard # the return value. --let $CRC_name= view_sidef_$CRC_ARG_level @@ -252,10 +258,11 @@ if (`SELECT $CRC_ARG_type = 5 AND '$CRC_ --let $CRC_RET_drop= DROP VIEW $CRC_name --let $CRC_RET_is_toplevel= 0 --let $CRC_RET_desc= view $CRC_name invoking $CRC_ARG_desc + } } ######## prep ######## -if (`SELECT $CRC_ARG_type = 6`) { +if ($CRC_ARG_type == 6) { # It will be unsafe to execute this prepared statement --let $CRC_name= prep_$CRC_ARG_level --let $CRC_create= PREPARE $CRC_name FROM "$CRC_ARG_stmt_sidef" @@ -269,7 +276,7 @@ if (`SELECT $CRC_ARG_type = 6`) { } ######## no recursive construct: just return the given statement ######## -if (`SELECT $CRC_ARG_type = 7`) { +if ($CRC_ARG_type == 7) { # CRC_ARG_type=7 is a special case. We just set $CRC_RET_x = # $CRC_ARG_x. This way, the $CRC_ARG_stmt gets executed directly # (below). In binlog_unsafe.test, it is used to invoke the unsafe @@ -295,7 +302,7 @@ if ($CRC_RET_stmt_sidef) { --echo * binlog_format = STATEMENT: expect $CRC_ARG_expected_number_of_warnings warnings. --eval $CRC_RET_stmt_sidef --let $n_warnings= `SHOW COUNT(*) WARNINGS` - if (`SELECT '$n_warnings' != '$CRC_ARG_expected_number_of_warnings'`) { + if ($n_warnings != $CRC_ARG_expected_number_of_warnings) { --echo ******** Failure! Expected $CRC_ARG_expected_number_of_warnings warnings, got $n_warnings warnings. ******** SHOW WARNINGS; SHOW BINLOG EVENTS; @@ -312,14 +319,14 @@ if ($CRC_RET_stmt_sidef) { RESET MASTER; --eval $CRC_RET_stmt_sidef --let $n_warnings= `SHOW COUNT(*) WARNINGS` - if (`SELECT '$n_warnings' != '0'`) { + if ($n_warnings) { --echo ******** Failure! Expected 0 warnings, got $n_warnings warnings. ******** SHOW WARNINGS; SHOW BINLOG EVENTS; --die Wrong number of warnings. } --let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 2) - if (`SELECT '$binlog_event' != 'No such row'`) { + if ($binlog_event != No such row) { --enable_query_log --echo ******** Failure! Something was written to the binlog despite SQL_LOG_BIN=0 ******** SHOW BINLOG EVENTS; @@ -332,7 +339,7 @@ if ($CRC_RET_stmt_sidef) { RESET MASTER; --eval $CRC_RET_stmt_sidef --let $n_warnings= `SHOW COUNT(*) WARNINGS` - if (`SELECT '$n_warnings' != '0'`) { + if ($n_warnings) { --echo ******** Failure! Expected 0 warnings, got $n_warnings warnings. ******** SHOW WARNINGS; SHOW BINLOG EVENTS; @@ -376,7 +383,7 @@ if ($CRC_RET_sel_retval) { # fail. When the bug is fixed, we should execute the following. #--let $n_warnings= `SHOW COUNT(*) WARNINGS` - #if (`SELECT '$n_warnings' != '0'`) { + #if ($n_warnings) { # --enable_query_log # --echo Failure! Expected 0 warnings, got $n_warnings warnings. # SHOW WARNINGS; === modified file 'mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc' --- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc 2010-08-20 02:59:58 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc 2010-11-17 10:16:13 +0000 @@ -35,7 +35,7 @@ if (`SELECT HEX(@commands) = HEX('config # when a command ends. # --let $n= $tot_table - while (`SELECT $n != 0`) + while ($n) { --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n --eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam @@ -62,7 +62,7 @@ if (`SELECT HEX(@commands) = HEX('config # when a command ends. # --let $n= $tot_table - while (`SELECT $n != 0`) + while ($n) { --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n --eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb @@ -89,7 +89,7 @@ if (`SELECT HEX(@commands) = HEX('config # when a command ends. # --let $n= $tot_table - while (`SELECT $n != 0`) + while ($n) { --eval DROP TABLE IF EXISTS nt_$n --eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam @@ -116,7 +116,7 @@ if (`SELECT HEX(@commands) = HEX('config # when a command ends. # --let $n= $tot_table - while (`SELECT $n != 0`) + while ($n) { --eval DROP TABLE IF EXISTS tt_$n --eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb @@ -163,14 +163,14 @@ if (`SELECT HEX(@commands) = HEX('clean' DROP TABLE IF EXISTS nt_xx_1; --let $n= $tot_table - while (`SELECT $n != 0`) + while ($n) { --eval DROP TABLE IF EXISTS nt_$n --dec $n } --let $n= $tot_table - while (`SELECT $n != 0`) + while ($n) { --eval DROP TABLE IF EXISTS tt_$n --dec $n @@ -634,11 +634,11 @@ while (`SELECT HEX(@commands) != HEX('') { --let $dropped_temp= $table } - if (`SELECT $n = 1`) + if ($n == 1) { --let $table_1= $table } - if (`SELECT $n = 2`) + if ($n == 2) { --let $table_2= $table } @@ -886,7 +886,7 @@ while (`SELECT HEX(@commands) != HEX('') --let $available_n_temp= --let $dropped_n_temp= --let $n= $tot_table - while (`SELECT $n != 0`) + while ($n) { --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n --eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam @@ -905,7 +905,7 @@ while (`SELECT HEX(@commands) != HEX('') --let $available_t_temp= --let $dropped_t_temp= --let $n= $tot_table - while (`SELECT $n != 0`) + while ($n) { --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n --eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb @@ -924,7 +924,7 @@ while (`SELECT HEX(@commands) != HEX('') --let $available_t= --let $dropped_t= --let $n= $tot_table - while (`SELECT $n != 0`) + while ($n) { --eval DROP TABLE IF EXISTS tt_$n --eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb @@ -943,7 +943,7 @@ while (`SELECT HEX(@commands) != HEX('') --let $available_n= --let $dropped_n= --let $n= $tot_table - while (`SELECT $n != 0`) + while ($n) { --eval DROP TABLE IF EXISTS nt_$n --eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam === modified file 'mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test' --- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test 2010-08-30 06:38:09 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test 2010-11-17 10:23:22 +0000 @@ -406,7 +406,7 @@ sync_slave_with_master; # Error reaction is up to sql_mode of the slave sql (bug#38173) #--echo *** Create t9 on slave *** # Please, check BUG#47741 to see why you are not testing NDB. -if (`SELECT $engine_type != 'NDB'`) +if ($engine_type != NDB) { STOP SLAVE; RESET SLAVE; === modified file 'mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test' --- a/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test 2010-04-20 11:58:28 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test 2010-11-17 10:23:22 +0000 @@ -33,7 +33,7 @@ INSERT INTO tt_2(ddl_case) VALUES(0); --echo ######################################################################### SET AUTOCOMMIT= 0; let $ddl_cases= 41; -while (`SELECT $ddl_cases >= 1`) +while ($ddl_cases >= 1) { --echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- let $in_temporary= "no"; @@ -76,7 +76,7 @@ while (`SELECT $ddl_cases >= 1`) # 6: ROW EVENT # 7: COMMIT # - if (`select '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 7; } @@ -84,10 +84,10 @@ while (`SELECT $ddl_cases >= 1`) let $first_binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1); --enable_query_log eval INSERT INTO tt_1(ddl_case) VALUES ($ddl_cases); - if (`SELECT $ddl_cases = 41`) + if ($ddl_cases == 41) { let $cmd= LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { # This seems to be related to epochs. # We need to check this against an updated version or avoid it. @@ -95,7 +95,7 @@ while (`SELECT $ddl_cases >= 1`) let $commit_event_row_number= 6; } } - if (`SELECT $ddl_cases = 40`) + if ($ddl_cases == 40) { let $cmd= LOAD INDEX INTO CACHE tt_1, tt_2 IGNORE LEAVES; # @@ -109,16 +109,16 @@ while (`SELECT $ddl_cases >= 1`) # 5: ROW EVENT # 6: COMMIT # - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 6; } } - if (`SELECT $ddl_cases = 39`) + if ($ddl_cases == 39) { let $cmd= ANALYZE TABLE nt_1; } - if (`SELECT $ddl_cases = 38`) + if ($ddl_cases == 38) { let $cmd= CHECK TABLE nt_1; # @@ -132,20 +132,20 @@ while (`SELECT $ddl_cases >= 1`) # 5: ROW EVENT # 6: COMMIT # - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 6; } } - if (`SELECT $ddl_cases = 37`) + if ($ddl_cases == 37) { let $cmd= OPTIMIZE TABLE nt_1; } - if (`SELECT $ddl_cases = 36`) + if ($ddl_cases == 36) { let $cmd= REPAIR TABLE nt_1; } - if (`SELECT $ddl_cases = 35`) + if ($ddl_cases == 35) { let $cmd= LOCK TABLES tt_1 WRITE; # @@ -159,12 +159,12 @@ while (`SELECT $ddl_cases >= 1`) # 5: ROW EVENT # 6: COMMIT # - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 6; } } - if (`SELECT $ddl_cases = 34`) + if ($ddl_cases == 34) { let $cmd= UNLOCK TABLES; # @@ -178,20 +178,20 @@ while (`SELECT $ddl_cases >= 1`) # 5: ROW EVENT # 6: COMMIT # - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 6; } } - if (`SELECT $ddl_cases = 33`) + if ($ddl_cases == 33) { let $cmd= CREATE USER 'user'@'localhost'; } - if (`SELECT $ddl_cases = 32`) + if ($ddl_cases == 32) { let $cmd= GRANT ALL ON *.* TO 'user'@'localhost'; } - if (`SELECT $ddl_cases = 31`) + if ($ddl_cases == 31) { let $cmd= SET PASSWORD FOR 'user'@'localhost' = PASSWORD('newpass'); # @@ -231,35 +231,35 @@ while (`SELECT $ddl_cases >= 1`) let $commit_event_row_number= 7; } } - if (`SELECT $ddl_cases = 30`) + if ($ddl_cases == 30) { let $cmd= REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'localhost'; } - if (`SELECT $ddl_cases = 29`) + if ($ddl_cases == 29) { let $cmd= RENAME USER 'user'@'localhost' TO 'user_new'@'localhost'; } - if (`SELECT $ddl_cases = 28`) + if ($ddl_cases == 28) { let $cmd= DROP USER 'user_new'@'localhost'; } - if (`SELECT $ddl_cases = 27`) + if ($ddl_cases == 27) { let $cmd= CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1; } - if (`SELECT $ddl_cases = 26`) + if ($ddl_cases == 26) { let $cmd= ALTER EVENT evt COMMENT 'evt'; } - if (`SELECT $ddl_cases = 25`) + if ($ddl_cases == 25) { let $cmd= DROP EVENT evt; } - if (`SELECT $ddl_cases = 24`) + if ($ddl_cases == 24) { let $cmd= CREATE TRIGGER tr AFTER INSERT ON tt_1 FOR EACH ROW UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case; } - if (`SELECT $ddl_cases = 23`) + if ($ddl_cases == 23) { let $cmd= DROP TRIGGER tr; # @@ -277,43 +277,43 @@ while (`SELECT $ddl_cases >= 1`) let $commit_event_row_number= 5; } } - if (`SELECT $ddl_cases = 22`) + if ($ddl_cases == 22) { let $cmd= CREATE FUNCTION fc () RETURNS VARCHAR(64) RETURN "fc"; } - if (`SELECT $ddl_cases = 21`) + if ($ddl_cases == 21) { let $cmd= ALTER FUNCTION fc COMMENT 'fc'; } - if (`SELECT $ddl_cases = 20`) + if ($ddl_cases == 20) { let $cmd= DROP FUNCTION fc; } - if (`SELECT $ddl_cases = 19`) + if ($ddl_cases == 19) { let $cmd= CREATE PROCEDURE pc () UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case; } - if (`SELECT $ddl_cases = 18`) + if ($ddl_cases == 18) { let $cmd= ALTER PROCEDURE pc COMMENT 'pc'; } - if (`SELECT $ddl_cases = 17`) + if ($ddl_cases == 17) { let $cmd= DROP PROCEDURE pc; } - if (`SELECT $ddl_cases = 16`) + if ($ddl_cases == 16) { let $cmd= CREATE VIEW v AS SELECT * FROM tt_1; } - if (`SELECT $ddl_cases = 15`) + if ($ddl_cases == 15) { let $cmd= ALTER VIEW v AS SELECT * FROM tt_1; } - if (`SELECT $ddl_cases = 14`) + if ($ddl_cases == 14) { let $cmd= DROP VIEW v; } - if (`SELECT $ddl_cases = 13`) + if ($ddl_cases == 13) { let $cmd= CREATE INDEX ix ON tt_1(ddl_case); # @@ -328,12 +328,12 @@ while (`SELECT $ddl_cases >= 1`) # 6: COMMIT # 7: DDL EVENT which triggered the previous commmit. # - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 6; } } - if (`SELECT $ddl_cases = 12`) + if ($ddl_cases == 12) { let $cmd= DROP INDEX ix ON tt_1; # @@ -348,12 +348,12 @@ while (`SELECT $ddl_cases >= 1`) # 6: COMMIT # 7: DDL EVENT which triggered the previous commmit. # - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 6; } } - if (`SELECT $ddl_cases = 11`) + if ($ddl_cases == 11) { let $cmd= CREATE TEMPORARY TABLE tt_xx (a int); let $in_temporary= "yes"; @@ -411,7 +411,7 @@ while (`SELECT $ddl_cases >= 1`) let $commit_event_row_number= 9; } } - if (`SELECT $ddl_cases = 10`) + if ($ddl_cases == 10) { let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int); # @@ -438,12 +438,12 @@ while (`SELECT $ddl_cases >= 1`) # 5: ROW EVENT # 6: COMMIT # - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 6; } } - if (`SELECT $ddl_cases = 9`) + if ($ddl_cases == 9) { let $cmd= ALTER TABLE tt_xx RENAME new_tt_xx; # @@ -470,12 +470,12 @@ while (`SELECT $ddl_cases >= 1`) # 5: ROW EVENT # 6: COMMIT # - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 6; } } - if (`SELECT $ddl_cases = 8`) + if ($ddl_cases == 8) { let $cmd= DROP TEMPORARY TABLE IF EXISTS new_tt_xx; let $in_temporary= "yes"; @@ -528,7 +528,7 @@ while (`SELECT $ddl_cases >= 1`) # 8: ROW EVENT # 9: COMMIT # - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 9; } @@ -551,27 +551,27 @@ while (`SELECT $ddl_cases >= 1`) let $commit_event_row_number= 9; } } - if (`SELECT $ddl_cases = 7`) + if ($ddl_cases == 7) { let $cmd= CREATE TABLE tt_xx (a int); } - if (`SELECT $ddl_cases = 6`) + if ($ddl_cases == 6) { let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int); } - if (`SELECT $ddl_cases = 5`) + if ($ddl_cases == 5) { let $cmd= RENAME TABLE tt_xx TO new_tt_xx; } - if (`SELECT $ddl_cases = 4`) + if ($ddl_cases == 4) { let $cmd= TRUNCATE TABLE new_tt_xx; } - if (`SELECT $ddl_cases = 3`) + if ($ddl_cases == 3) { let $cmd= DROP TABLE IF EXISTS tt_xx, new_tt_xx; } - if (`SELECT $ddl_cases = 2`) + if ($ddl_cases == 2) { let $cmd= CREATE DATABASE db; # @@ -586,12 +586,12 @@ while (`SELECT $ddl_cases >= 1`) # 6: COMMIT # 7: DDL EVENT which triggered the previous commmit. # - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 6; } } - if (`SELECT $ddl_cases = 1`) + if ($ddl_cases == 1) { let $cmd= DROP DATABASE IF EXISTS db; # @@ -606,7 +606,7 @@ while (`SELECT $ddl_cases >= 1`) # 6: COMMIT # 7: DDL EVENT which triggered the previous commmit. # - if (`SELECT '$engine' = 'NDB'`) + if ($engine == NDB) { let $commit_event_row_number= 6; } @@ -618,14 +618,14 @@ while (`SELECT $ddl_cases >= 1`) # commit. The flag in_temporary is used to avoid aborting the test in such # cases. Thus we force the commit. # - if (`SELECT $in_temporary = "yes"`) + if ($in_temporary == "yes") { --eval COMMIT } let $event_commit= query_get_value("SHOW BINLOG EVENTS FROM $first_binlog_position", Info, $commit_event_row_number); if (`SELECT SUBSTRING("$event_commit",1,6) != "COMMIT"`) { - if (`SELECT $ok = "yes"`) + if ($ok == "yes") { --echo it *does not* commit the current transaction. --echo $cmd === modified file 'mysql-test/extra/rpl_tests/rpl_insert_delayed.test' --- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test 2010-06-19 09:24:34 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test 2010-11-17 10:23:22 +0000 @@ -121,7 +121,7 @@ if (`SELECT @@global.binlog_format = 'S # The second INSERT DELAYED statement is the 5 item if two INSERT DELAYED are # handled separately - if (`SELECT '$stmt' = 'COMMIT'`) + if ($stmt == COMMIT) { --let $stmt= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $_start, Info, 5) } === modified file 'mysql-test/extra/rpl_tests/rpl_not_null.test' --- a/mysql-test/extra/rpl_tests/rpl_not_null.test 2010-01-07 15:39:11 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_not_null.test 2010-11-17 10:16:13 +0000 @@ -177,7 +177,7 @@ sync_slave_with_master; #--source include/wait_for_slave_to_start.inc # #let $y=0; -#while (`select $y < 6`) +#while ($y < 6) #{ # connection master; # @@ -202,21 +202,21 @@ sync_slave_with_master; # `c` INT DEFAULT 500, # PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; # -# if (`select $y=0`) +# if ($y==0) # { # --echo ************* EXECUTION WITH INSERTS ************* # connection master; # INSERT INTO t1(a) VALUES (1); # } # -# if (`select $y=1`) +# if ($y==1) # { # --echo ************* EXECUTION WITH INSERTS ************* # connection master; # INSERT INTO t1(a, b) VALUES (1, NULL); # } # -# if (`select $y=2`) +# if ($y==2) # { # --echo ************* EXECUTION WITH UPDATES ************* # connection master; @@ -225,14 +225,14 @@ sync_slave_with_master; # UPDATE t3 SET b = NULL where a= 1; # } # -# if (`select $y=3`) +# if ($y==3) # { # --echo ************* EXECUTION WITH INSERTS/REPLACES ************* # connection master; # REPLACE INTO t3(a, b) VALUES (1, null); # } # -# if (`select $y=4`) +# if ($y==4) # { # --echo ************* EXECUTION WITH UPDATES/REPLACES ************* # connection master; @@ -240,7 +240,7 @@ sync_slave_with_master; # REPLACE INTO t3(a, b) VALUES (1, null); # } # -# if (`select $y=5`) +# if ($y==5) # { # --echo ************* EXECUTION WITH MULTI-ROW INSERTS ************* # connection master; === modified file 'mysql-test/extra/rpl_tests/rpl_row_empty_imgs.test' --- a/mysql-test/extra/rpl_tests/rpl_row_empty_imgs.test 2010-05-10 23:33:42 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_row_empty_imgs.test 2010-11-17 12:21:45 +0000 @@ -278,7 +278,7 @@ SELECT * FROM t1; -- connection mysqld_b -- let $lower_engine= `SELECT LOWER('$engine')` -if (`SELECT '$lower_engine' = 'ndb'`) +if ($lower_engine == ndb) { if ($verbose) { @@ -298,7 +298,7 @@ SET SQL_LOG_BIN=1; # wait forever. -- source include/wait_for_slave_sql_to_stop.inc -- let $errno=query_get_value("show slave status", Last_SQL_Errno, 1) -if (`SELECT $errno <> 1032`) +if ($errno != 1032) { -- echo ### UNEXPECTED ERROR AT THE SLAVE: $errno SHOW SLAVE STATUS; === modified file 'mysql-test/extra/rpl_tests/rpl_row_img.test' --- a/mysql-test/extra/rpl_tests/rpl_row_img.test 2010-03-30 16:06:36 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_row_img.test 2010-11-17 12:21:45 +0000 @@ -48,7 +48,7 @@ while($i) -- connection mysqld_c SET SQL_LOG_BIN=0; - if (`SELECT $i=1`) { + if ($i == 1) { let $step= No keys; --echo ******* TEST: $step -- connection mysqld_a @@ -59,7 +59,7 @@ while($i) --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $mysqld_c_engine; } - if (`SELECT $i=2`) + if ($i == 2) { let $step= One key; --echo ******* TEST: $step @@ -71,7 +71,7 @@ while($i) --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=3`) + if ($i == 3) { let $step= One Composite key; --echo ****** TEST: $step @@ -82,7 +82,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $mysqld_c_engine; } - if (`SELECT $i=4`) + if ($i == 4) { let $step= One Unique key; --echo ****** TEST: $step @@ -94,7 +94,7 @@ while($i) --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=5`) + if ($i == 5) { let $step= One Composite Unique key; --echo ****** TEST: $step @@ -106,7 +106,7 @@ while($i) --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $mysqld_c_engine; } - if (`SELECT $i=6`) + if ($i == 6) { let $step= One Primary key; --echo ****** TEST: $step @@ -117,7 +117,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=7`) + if ($i == 7) { let $step= One Composite Primary Key; --echo ****** TEST: $step @@ -128,7 +128,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $mysqld_c_engine; } - if (`SELECT $i=8`) + if ($i == 8) { let $step= One Composite key with holes; --echo ****** TEST: $step @@ -139,7 +139,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $mysqld_c_engine; } - if (`SELECT $i=9`) + if ($i == 9) { let $step= One Composite Unique key with holes; --echo ****** TEST: $step @@ -150,7 +150,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $mysqld_c_engine; } - if (`SELECT $i=10`) + if ($i == 10) { let $step= One Composite Primary Key with holes; --echo ****** TEST: $step @@ -161,7 +161,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $mysqld_c_engine; } - if (`SELECT $i=11`) + if ($i == 11) { let $step= One Composite NOT NULL Unique key with holes; --echo ****** TEST: $step @@ -172,7 +172,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $mysqld_c_engine; } - if (`SELECT $i=12`) + if ($i == 12) { let $step= One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave; --echo ****** TEST: $step === modified file 'mysql-test/extra/rpl_tests/rpl_row_img_blobs.test' --- a/mysql-test/extra/rpl_tests/rpl_row_img_blobs.test 2010-03-30 16:06:36 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_row_img_blobs.test 2010-11-17 12:21:45 +0000 @@ -57,7 +57,7 @@ while($i) # binlog_row_image configured as NOBLOB. # - if (`SELECT $i=1`) { + if ($i == 1) { -- echo ### Asserts that declaring a blob as part of a primary key does not break replication -- connection mysqld_a --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $mysqld_a_engine; @@ -66,7 +66,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $mysqld_c_engine; } - if (`SELECT $i=2`) + if ($i == 2) { -- echo ### Asserts that declaring a blob as part of a unique (not null) key does not break replication -- connection mysqld_a @@ -76,7 +76,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $mysqld_c_engine; } - if (`SELECT $i=3`) + if ($i == 3) { -- echo ### Asserts that declaring a blob in a key does not break replication -- connection mysqld_a @@ -87,7 +87,7 @@ while($i) --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $mysqld_c_engine; } - if (`SELECT $i=4`) { + if ($i == 4) { -- echo ### Asserts that updates without blobs in the BI (PK exists int the table) -- echo ### will not break replication -- connection mysqld_a @@ -98,7 +98,7 @@ while($i) --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=5`) + if ($i == 5) { -- echo ### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) -- echo ### will not break replication @@ -110,7 +110,7 @@ while($i) --eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=6`) + if ($i == 6) { -- echo ### Asserts that updates without blobs in the AI (they are not updated) -- echo ### will not break replication (check even if there is a key in the table) @@ -122,7 +122,7 @@ while($i) --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=7`) + if ($i == 7) { -- echo ### Asserts that updates without blobs in the AI (they are not updated) -- echo ### will not break replication (check when there is no key in the table) === modified file 'mysql-test/extra/rpl_tests/rpl_row_img_diff_indexes.test' --- a/mysql-test/extra/rpl_tests/rpl_row_img_diff_indexes.test 2010-03-30 16:06:36 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_row_img_diff_indexes.test 2010-11-17 12:21:45 +0000 @@ -47,7 +47,7 @@ while($i) SET SQL_LOG_BIN=0; - if (`SELECT $i=1`) { + if ($i == 1) { -- echo ### Different PKs on master and first slave -- connection mysqld_a --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $mysqld_a_engine; @@ -56,7 +56,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=2`) + if ($i == 2) { -- echo ### Different PKs on master and first slave (which has unique NOT NULL key instead of PK) -- connection mysqld_a @@ -66,7 +66,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=3`) + if ($i == 3) { -- echo ### Master with PK and first slave with KEY only -- connection mysqld_a @@ -76,7 +76,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $mysqld_c_engine; } - if (`SELECT $i=4`) + if ($i == 4) { -- echo ### Master with PK and no keys on the slaves -- connection mysqld_a @@ -86,7 +86,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $mysqld_c_engine; } - if (`SELECT $i=5`) { + if ($i == 5) { -- echo ### Master with UK NOT NULL and slaves with PK on different fields -- connection mysqld_a --eval CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= $mysqld_a_engine; @@ -95,7 +95,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=6`) + if ($i == 6) { -- echo ### Master with UK NOT NULL, first slave with UK NOT NULL on different field -- connection mysqld_a @@ -105,7 +105,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=7`) + if ($i == 7) { -- echo ### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field @@ -116,7 +116,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $mysqld_c_engine; } - if (`SELECT $i=8`) + if ($i == 8) { -- echo ### Master with UK NULLABLE, slaves with no keys -- connection mysqld_a @@ -126,7 +126,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $mysqld_c_engine; } - if (`SELECT $i=9`) { + if ($i == 9) { -- echo ### Master with Key, slaves with PKs on different fields -- connection mysqld_a --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $mysqld_a_engine; @@ -135,7 +135,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=10`) + if ($i == 10) { -- echo ### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL) -- connection mysqld_a @@ -145,7 +145,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=11`) + if ($i == 11) { -- echo ### Master with Key, first slave with key on different field and second slave with key on yet another different field. -- connection mysqld_a @@ -155,7 +155,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $mysqld_c_engine; } - if (`SELECT $i=12`) + if ($i == 12) { -- echo ### Master with Key, slaves with no keys -- connection mysqld_a @@ -165,7 +165,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $mysqld_c_engine; } - if (`SELECT $i=13`) { + if ($i == 13) { -- echo ### Master with no key, slaves with PKs on different fields -- connection mysqld_a --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $mysqld_a_engine; @@ -174,7 +174,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=14`) + if ($i == 14) { -- echo ### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK) -- connection mysqld_a @@ -184,7 +184,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= $mysqld_c_engine; } - if (`SELECT $i=15`) + if ($i == 15) { -- echo ### Master with no key, slaves with keys -- connection mysqld_a @@ -194,7 +194,7 @@ while($i) -- connection mysqld_c --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $mysqld_c_engine; } - if (`SELECT $i=16`) + if ($i == 16) { -- echo ### Master with no keys slaves with no keys as well -- connection mysqld_a === modified file 'mysql-test/extra/rpl_tests/rpl_stop_slave.test' --- a/mysql-test/extra/rpl_tests/rpl_stop_slave.test 2010-10-16 12:03:44 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_stop_slave.test 2010-11-17 12:21:45 +0000 @@ -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 === modified file 'mysql-test/include/check_slave_is_running.inc' --- a/mysql-test/include/check_slave_is_running.inc 2010-05-26 14:34:25 +0000 +++ b/mysql-test/include/check_slave_is_running.inc 2010-11-17 10:16:13 +0000 @@ -8,10 +8,18 @@ --echo Checking that both slave threads are running. +--let $running= 1 --let $slave_sql_running = query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1) --let $slave_io_running = query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1) -if (`SELECT '$slave_sql_running' != 'Yes' OR '$slave_io_running' != 'Yes'`) { +if ($slave_sql_running != Yes) { + --let $running= 0 +} +if ($slave_io_running != Yes) { + --let $running= 0 +} + +if (!$running) { --echo Slave not running: Slave_SQL_Running = $slave_sql_running Slave_IO_Running = $slave_io_running --source include/show_rpl_debug_info.inc --die Expected slave to be running, but it was not running. === modified file 'mysql-test/include/check_slave_param.inc' --- a/mysql-test/include/check_slave_param.inc 2010-05-26 14:34:25 +0000 +++ b/mysql-test/include/check_slave_param.inc 2010-11-17 10:16:13 +0000 @@ -9,7 +9,7 @@ # --source include/check_slave_param.inc --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) { --echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value' --source include/show_rpl_debug_info.inc --die Wrong value for slave parameter === modified file 'mysql-test/include/diff_tables.inc' --- a/mysql-test/include/diff_tables.inc 2010-09-04 00:46:58 +0000 +++ b/mysql-test/include/diff_tables.inc 2010-11-17 10:23:22 +0000 @@ -68,7 +68,7 @@ while ($_diff_i) { # and connect the appropriate server. let $_pos= `SELECT LOCATE(':', '$_diff_table')`; let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`; - if (`SELECT 'XX$_diff_conn' <> 'XX'`) { + if ($_diff_conn) { let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`; connection $_diff_conn; } === modified file 'mysql-test/include/have_example_plugin.inc' --- a/mysql-test/include/have_example_plugin.inc 2009-11-10 18:45:15 +0000 +++ b/mysql-test/include/have_example_plugin.inc 2010-11-17 10:16:13 +0000 @@ -8,7 +8,7 @@ if (`SELECT @@have_dynamic_loading != 'Y # # Check if the variable EXAMPLE_PLUGIN is set # -if (`SELECT LENGTH('$EXAMPLE_PLUGIN') = 0`) { +if (!$EXAMPLE_PLUGIN) { --skip Example plugin requires the environment variable \$EXAMPLE_PLUGIN to be set (normally done by mtr) } === modified file 'mysql-test/include/have_semisync_plugin.inc' --- a/mysql-test/include/have_semisync_plugin.inc 2009-10-29 07:14:50 +0000 +++ b/mysql-test/include/have_semisync_plugin.inc 2010-11-17 10:16:13 +0000 @@ -8,7 +8,7 @@ if (`SELECT @@have_dynamic_loading != 'Y # # Check if the variable SEMISYNC_MASTER_PLUGIN is set # -if (`select LENGTH('$SEMISYNC_MASTER_PLUGIN') = 0`) +if (!$SEMISYNC_MASTER_PLUGIN) { skip Need semisync plugins; } === modified file 'mysql-test/include/have_simple_parser.inc' --- a/mysql-test/include/have_simple_parser.inc 2009-11-10 18:45:15 +0000 +++ b/mysql-test/include/have_simple_parser.inc 2010-11-17 10:16:13 +0000 @@ -8,7 +8,7 @@ if (`SELECT @@have_dynamic_loading != 'Y # # Check if the variable SIMPLE_PARSER is set # -if (`SELECT LENGTH('$SIMPLE_PARSER') = 0`) { +if (!$SIMPLE_PARSER) { --skip simple parser requires the environment variable \$SIMPLE_PARSER to be set (normally done by mtr) } === modified file 'mysql-test/include/have_udf.inc' --- a/mysql-test/include/have_udf.inc 2009-11-10 18:45:15 +0000 +++ b/mysql-test/include/have_udf.inc 2010-11-17 10:16:13 +0000 @@ -8,7 +8,7 @@ if (`SELECT @@have_dynamic_loading != 'Y # # Check if the variable UDF_EXAMPLE_LIB is set # -if (`SELECT LENGTH('$UDF_EXAMPLE_LIB') = 0`) { +if (!$UDF_EXAMPLE_LIB) { --skip UDF requires the environment variable \$UDF_EXAMPLE_LIB to be set (normally done by mtr) } === modified file 'mysql-test/include/mtr_warnings.sql' --- a/mysql-test/include/mtr_warnings.sql 2010-11-09 20:10:44 +0000 +++ b/mysql-test/include/mtr_warnings.sql 2010-11-18 15:57:46 +0000 @@ -241,9 +241,6 @@ INSERT INTO global_suppressions VALUES */ ("Found lock of type 6 that is write and read locked"), - /* After BUG#57840, we may restart master w/o restarting slave */ - ("The master.s UUID has changed, although this should not happen"), - ("THE_LAST_SUPPRESSION")|| === modified file 'mysql-test/include/mysql_upgrade_preparation.inc' --- a/mysql-test/include/mysql_upgrade_preparation.inc 2010-08-11 17:56:56 +0000 +++ b/mysql-test/include/mysql_upgrade_preparation.inc 2010-11-17 10:16:13 +0000 @@ -17,7 +17,7 @@ select LENGTH("$MYSQL_UPGRADE")>0 as hav # Therefore, truncate the log table in advance and issue a statement # that should be logged. # -if (`SELECT $VALGRIND_TEST`) +if ($VALGRIND_TEST) { --disable_query_log --disable_result_log === modified file 'mysql-test/include/no_valgrind_without_big.inc' --- a/mysql-test/include/no_valgrind_without_big.inc 2009-06-09 14:36:14 +0000 +++ b/mysql-test/include/no_valgrind_without_big.inc 2010-11-17 10:16:13 +0000 @@ -5,8 +5,9 @@ # Therefore we require that the option "--big-test" is also set. # -if (`SELECT $VALGRIND_TEST <> 0 AND '$BIG_TEST' = ''`) -{ - --skip Need "--big-test" when running with Valgrind +if ($VALGRIND_TEST) { + if (!$BIG_TEST) + { + --skip Need "--big-test" when running with Valgrind + } } - === modified file 'mysql-test/include/not_parallel.inc' --- a/mysql-test/include/not_parallel.inc 2010-06-14 09:23:49 +0000 +++ b/mysql-test/include/not_parallel.inc 2010-11-17 10:16:13 +0000 @@ -1,3 +1,3 @@ -if (`SELECT '$MTR_PARALLEL' > 1`) { +if ($MTR_PARALLEL > 1) { --skip test requires --parallel=1 } === modified file 'mysql-test/include/rpl_assert.inc' --- a/mysql-test/include/rpl_assert.inc 2010-09-16 11:00:57 +0000 +++ b/mysql-test/include/rpl_assert.inc 2010-11-17 12:21:45 +0000 @@ -48,9 +48,9 @@ if ($rpl_debug) } # Sanity-check input -if (`SELECT "$assert_text" = ""`) +if (!$assert_text) { - --die ERROR IN TEST: the mysqltest variable rpl_test must be set + --die ERROR IN TEST: the mysqltest variable assert_text must be set } # Evaluate square brackets in cond. === modified file 'mysql-test/include/rpl_chained_3_hosts.inc' --- a/mysql-test/include/rpl_chained_3_hosts.inc 2010-03-30 16:06:36 +0000 +++ b/mysql-test/include/rpl_chained_3_hosts.inc 2010-11-17 12:21:45 +0000 @@ -13,17 +13,17 @@ connect (mysqld_c,127.0.0.1,root,,test,$ while($i) { - if(`SELECT $i= 3`) + if($i == 3) { -- connection mysqld_a } - if(`SELECT $i= 2`) + if($i == 2) { -- connection mysqld_b } - if(`SELECT $i= 1`) + if($i == 1) { -- connection mysqld_c } === modified file 'mysql-test/include/rpl_diff_tables.inc' --- a/mysql-test/include/rpl_diff_tables.inc 2010-08-18 05:58:21 +0000 +++ b/mysql-test/include/rpl_diff_tables.inc 2010-11-17 10:16:13 +0000 @@ -8,13 +8,13 @@ # --source include/rpl_diff_tables.inc # ############################################################################# -if (`SELECT "XX$diff_table" = "XX"`) +if (!$diff_table) { --die diff_table is null. } --let $_servers= master, slave -if (`SELECT "XX$diff_server_list" <> "XX"`) +if ($diff_server_list) { --let $_servers= $diff_server_list } @@ -22,7 +22,7 @@ if (`SELECT "XX$diff_server_list" <> "XX --let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))` connection $_master; -while (`SELECT "XX$_servers" <> "XX"`) +while ($_servers) { --let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))` === modified file 'mysql-test/include/rpl_row_img_set.inc' --- a/mysql-test/include/rpl_row_img_set.inc 2010-03-30 16:06:36 +0000 +++ b/mysql-test/include/rpl_row_img_set.inc 2010-11-17 12:21:45 +0000 @@ -39,7 +39,7 @@ while (`SELECT HEX('$row_img_set') != HE -- eval SET SESSION binlog_row_image= '$rimg' -- eval SET GLOBAL binlog_row_image= '$rimg' - if (`SELECT '$is_slave_restart' = 'Y'`) + if ($is_slave_restart == Y) { -- source include/stop_slave.inc -- source include/start_slave.inc === modified file 'mysql-test/include/setup_fake_relay_log.inc' --- a/mysql-test/include/setup_fake_relay_log.inc 2010-10-21 13:25:40 +0000 +++ b/mysql-test/include/setup_fake_relay_log.inc 2010-11-17 10:23:22 +0000 @@ -40,9 +40,16 @@ let $_fake_relay_log_printable= `SELECT --echo Setting up fake replication from $_fake_relay_log_printable # Sanity check. +let $running= 0; let $_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1); let $_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1); -if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) { +if ($_sql_running == Yes) { + let $running= 1; +} +if ($_io_running == Yes) { + let $running= 1; +} +if ($running) { --echo Error: Slave was running when test case sourced --echo include/setup_fake_replication.inc --echo Slave_IO_Running = $_io_running; Slave_SQL_Running = $_sql_running === modified file 'mysql-test/include/show_rpl_debug_info.inc' --- a/mysql-test/include/show_rpl_debug_info.inc 2010-10-21 13:24:31 +0000 +++ b/mysql-test/include/show_rpl_debug_info.inc 2010-11-17 10:16:13 +0000 @@ -50,7 +50,7 @@ eval SHOW BINLOG EVENTS IN '$binlog_name let $_master_con= $master_connection; if (!$_master_con) { - if (`SELECT '$_con' = 'slave'`) + if ($_con == slave) { let $_master_con= master; } @@ -80,7 +80,7 @@ if ($_master_con) --echo --echo **** SHOW BINLOG EVENTS on $_master_con **** eval SHOW BINLOG EVENTS IN '$master_binlog_name_sql'; - if (`SELECT '$master_binlog_name_io' != '$master_binlog_name_sql'`) + if ($master_binlog_name_io != $master_binlog_name_sql) { eval SHOW BINLOG EVENTS IN '$master_binlog_name_io'; } === modified file 'mysql-test/include/show_slave_status.inc' --- a/mysql-test/include/show_slave_status.inc 2010-08-05 17:45:25 +0000 +++ b/mysql-test/include/show_slave_status.inc 2010-11-17 12:21:45 +0000 @@ -2,7 +2,7 @@ # that varies depending on where the test is executed. --let $_items=$status_items -if (`SELECT "XX$status_items" = "XX"`) +if (!$status_items) { --die 'Variable status_items is NULL' } @@ -10,7 +10,7 @@ if (`SELECT "XX$status_items" = "XX"`) --disable_query_log --vertical_results -while (`SELECT "XX$_items" <> "XX"`) +while ($_items) { --let $_name= `SELECT SUBSTRING_INDEX('$_items', ',', 1)` --let $_items= `SELECT LTRIM(SUBSTRING('$_items', LENGTH('$_name') + 2))` === modified file 'mysql-test/include/truncate_file.inc' --- a/mysql-test/include/truncate_file.inc 2010-01-08 05:42:23 +0000 +++ b/mysql-test/include/truncate_file.inc 2010-11-17 10:16:13 +0000 @@ -1,6 +1,6 @@ # truncate a giving file, all contents of the file are be cleared -if (`SELECT 'x$file' = 'x'`) +if (!$file) { --echo Please assign a file name to $file!! exit; === modified file 'mysql-test/include/wait_for_binlog_event.inc' --- a/mysql-test/include/wait_for_binlog_event.inc 2010-05-24 13:54:08 +0000 +++ b/mysql-test/include/wait_for_binlog_event.inc 2010-11-17 12:21:45 +0000 @@ -24,7 +24,7 @@ while (`SELECT INSTR("$_last_event","$wa 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; === modified file 'mysql-test/include/wait_for_slave_io_to_stop.inc' --- a/mysql-test/include/wait_for_slave_io_to_stop.inc 2009-01-09 14:12:31 +0000 +++ b/mysql-test/include/wait_for_slave_io_to_stop.inc 2010-11-17 10:16:13 +0000 @@ -14,7 +14,7 @@ # if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE # STATUS will return an empty set. let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); -if (`SELECT '$_slave_io_running' != 'No such row'`) +if ($_slave_io_running != No such row) { let $slave_param= Slave_IO_Running; let $slave_param_value= No; === modified file 'mysql-test/include/wait_for_slave_sql_to_stop.inc' --- a/mysql-test/include/wait_for_slave_sql_to_stop.inc 2009-01-09 14:12:31 +0000 +++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc 2010-11-17 10:16:13 +0000 @@ -14,7 +14,7 @@ # if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE # STATUS will return an empty set. let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); -if (`SELECT '$_slave_io_running' != 'No such row'`) +if ($_slave_io_running != No such row) { let $slave_param= Slave_SQL_Running; let $slave_param_value= No; === modified file 'mysql-test/include/wait_for_slave_to_stop.inc' --- a/mysql-test/include/wait_for_slave_to_stop.inc 2009-01-09 14:12:31 +0000 +++ b/mysql-test/include/wait_for_slave_to_stop.inc 2010-11-17 10:16:13 +0000 @@ -14,7 +14,7 @@ # if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE # STATUS will return an empty set. let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); -if (`SELECT '$_slave_io_running' != 'No such row'`) +if ($_slave_io_running != No such row) { let $slave_error_message= Failed while waiting for slave to stop; === modified file 'mysql-test/include/wait_show_condition.inc' --- a/mysql-test/include/wait_show_condition.inc 2010-11-11 17:11:05 +0000 +++ b/mysql-test/include/wait_show_condition.inc 2010-11-19 10:19:07 +0000 @@ -50,7 +50,7 @@ inc $max_run_time; let $found= 0; let $max_end_time= `SELECT UNIX_TIMESTAMP() + $max_run_time`; -if (`SELECT '$wait_for_all' != '1'`) +if ($wait_for_all != 1) { while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`) { @@ -58,24 +58,27 @@ if (`SELECT '$wait_for_all' != '1'`) real_sleep 0.2; let $rowno= 1; let $process_result= 1; - while (`SELECT $process_result = 1 AND $found = 0`) + let $do_loop= 1; + while ($do_loop) { let $field_value= query_get_value($show_statement, $field, $rowno); if (`SELECT '$field_value' $condition`) { let $found= 1; + let $do_loop= 0; } - if (`SELECT '$field_value' = 'No such row'`) + if ($field_value == No such row) { # We are behind the last row of the result set. let $process_result= 0; + let $do_loop= 0; } inc $rowno; } } } -if (`SELECT '$wait_for_all' = '1'`) +if ($wait_for_all == 1) { while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`) { @@ -83,16 +86,19 @@ if (`SELECT '$wait_for_all' = '1'`) real_sleep 0.2; let $rowno= 1; let $process_result= 1; - while (`SELECT $process_result = 1 AND $found = 0`) + let $do_loop= 1; + while ($do_loop) { let $field_value= query_get_value($show_statement, $field, $rowno); - if (`SELECT '$field_value' = 'No such row'`) + if ($field_value == No such row) { let $found= 1; + let $do_loop= 0; } if (`SELECT $found = 0 AND NOT '$field_value' $condition`) { let process_result= 0; + let $do_loop= 0; } inc $rowno; } === modified file 'mysql-test/mysql-test-run.pl' --- a/mysql-test/mysql-test-run.pl 2010-11-09 20:10:44 +0000 +++ b/mysql-test/mysql-test-run.pl 2010-11-18 15:57:46 +0000 @@ -1813,17 +1813,17 @@ sub executable_setup () { if ( ! $opt_skip_ndbcluster ) { $exe_ndbd= - my_find_bin($basedir, + my_find_bin($bindir, ["storage/ndb/src/kernel", "libexec", "sbin", "bin"], "ndbd"); $exe_ndb_mgmd= - my_find_bin($basedir, + my_find_bin($bindir, ["storage/ndb/src/mgmsrv", "libexec", "sbin", "bin"], "ndb_mgmd"); $exe_ndb_waiter= - my_find_bin($basedir, + my_find_bin($bindir, ["storage/ndb/tools/", "bin"], "ndb_waiter"); @@ -2195,12 +2195,12 @@ sub environment_setup { if ( ! $opt_skip_ndbcluster ) { $ENV{'NDB_MGM'}= - my_find_bin($basedir, + my_find_bin($bindir, ["storage/ndb/src/mgmclient", "bin"], "ndb_mgm"); $ENV{'NDB_TOOLS_DIR'}= - my_find_dir($basedir, + my_find_dir($bindir, ["storage/ndb/tools", "bin"]); $ENV{'NDB_EXAMPLES_DIR'}= @@ -2208,7 +2208,7 @@ sub environment_setup { ["storage/ndb/ndbapi-examples", "bin"]); $ENV{'NDB_EXAMPLES_BINARY'}= - my_find_bin($basedir, + my_find_bin($bindir, ["storage/ndb/ndbapi-examples/ndbapi_simple", "bin"], "ndbapi_simple", NOT_REQUIRED); @@ -4721,6 +4721,10 @@ sub stop_all_servers () { sub server_need_restart { my ($tinfo, $server)= @_; + # Mark the tinfo so slaves will restart if server restarts + # This assumes master will be considered first. + my $is_master= $server->option("#!run-master-sh"); + if ( using_extern() ) { mtr_verbose_restart($server, "no restart for --extern server"); @@ -4729,29 +4733,34 @@ sub server_need_restart { if ( $tinfo->{'force_restart'} ) { mtr_verbose_restart($server, "forced in .opt file"); + $tinfo->{master_restart}= 1 if $is_master; return 1; } if ( $opt_force_restart ) { mtr_verbose_restart($server, "forced restart turned on"); + $tinfo->{master_restart}= 1 if $is_master; return 1; } if ( $tinfo->{template_path} ne $current_config_name) { mtr_verbose_restart($server, "using different config file"); + $tinfo->{master_restart}= 1 if $is_master; return 1; } if ( $tinfo->{'master_sh'} || $tinfo->{'slave_sh'} ) { mtr_verbose_restart($server, "sh script to run"); + $tinfo->{master_restart}= 1 if $is_master; return 1; } if ( ! started($server) ) { mtr_verbose_restart($server, "not started"); + $tinfo->{master_restart}= 1 if $is_master; return 1; } @@ -4764,6 +4773,7 @@ sub server_need_restart { if ( timezone($started_tinfo) ne timezone($tinfo) ) { mtr_verbose_restart($server, "different timezone"); + $tinfo->{master_restart}= 1 if $is_master; return 1; } } @@ -4788,6 +4798,7 @@ sub server_need_restart { mtr_verbose_restart($server, "running with different options '" . join(" ", @{$extra_opts}) . "' != '" . join(" ", @{$started_opts}) . "'" ); + $tinfo->{master_restart}= 1 if $is_master; return 1; } @@ -4804,6 +4815,7 @@ sub server_need_restart { mtr_verbose("Restart: running with different options '" . join(" ", @{$extra_opts}) . "' != '" . join(" ", @{$started_opts}) . "'" ); + $tinfo->{master_restart}= 1 if $is_master; return 1; } @@ -4812,6 +4824,11 @@ sub server_need_restart { } } + if ($server->option("#!use-slave-opt") && $tinfo->{master_restart}) { + mtr_verbose_restart($server, "master will be restarted"); + return 1; + } + # Default, no restart return 0; } === modified file 'mysql-test/r/mysqltest.result' --- a/mysql-test/r/mysqltest.result 2010-10-21 12:18:25 +0000 +++ b/mysql-test/r/mysqltest.result 2010-11-18 17:03:16 +0000 @@ -308,6 +308,10 @@ var3 two columns with same name var4 from query that returns NULL var5 from query that returns no row failing query in let +create table t1 (a varchar(100)); +insert into t1 values ('`select 42`'); +`select 42` +drop table t1; mysqltest: At line 1: Error running query 'failing query': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing query' at line 1 mysqltest: At line 1: Missing required argument 'filename' to command 'source' mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2 @@ -399,10 +403,40 @@ true-inner true-inner again true-outer Counter is greater than 0, (counter=10) +Counter should still be 10, is 10 Counter is not 0, (counter=0) +Not space var works Counter is true, (counter=alpha) -Beta is true while with string, only once +5<7 +5<7 again +5<7 still +5<6 +5>=5 +5>=5 again +5>3 +5==5 +5!=8 +5!=five +5==3+2 +5 == 5 +hello == hello +hello == hello +hello != goodbye +two words +two words are two words +right answer +anything goes +0 != string +mysqltest: At line 2: Only == and != are supported for string values +mysqltest: At line 2: Found junk '~= 6' after $variable in condition +mysqltest: At line 2: Expression in if/while must beging with $, ` or a number +counter is 2 +counter is 3 +counter is 4 +counter is 5 +counter is 6 +counter is 7 1 Testing while with not mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": At line 64: Nesting too deeply @@ -813,8 +847,6 @@ dir-list.txt SELECT 'c:\\a.txt' AS col; col z -hej -mysqltest: At line 1: Found junk ' != 143' after $variable in expression select 1; 1 1 === modified file 'mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test' --- a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test 2009-09-30 02:31:25 +0000 +++ b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test 2010-11-17 10:16:13 +0000 @@ -83,17 +83,17 @@ while($i) -- let $flags=--database=b42941 # construct CLI for mysqlbinlog - if(`SELECT $i=3`) + if($i==3) { -- let $flags= $flags --verbose --hexdump } - if(`SELECT $i=2`) + if($i==2) { -- let $flags= $flags --verbose } -# if(`SELECT $i=1`) +# if($i==1) # { # do nothing $flags is already set as it should be # } === modified file 'mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test' --- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test 2010-08-10 11:58:46 +0000 +++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test 2010-11-17 10:23:22 +0000 @@ -117,7 +117,7 @@ DROP TABLE t1; SET GLOBAL log_warnings = @old_log_warnings; let $log_error_= `SELECT @@GLOBAL.log_error`; -if(!`select LENGTH('$log_error_')`) +if(!$log_error_) { # MySQL Server on windows is started with --console and thus # does not know the location of its .err log, use default location === modified file 'mysql-test/suite/binlog/t/binlog_unsafe.test' --- a/mysql-test/suite/binlog/t/binlog_unsafe.test 2010-10-21 12:36:16 +0000 +++ b/mysql-test/suite/binlog/t/binlog_unsafe.test 2010-11-17 10:23:22 +0000 @@ -141,11 +141,11 @@ END| # In each iteration of this loop, we select one method to make the # statement unsafe. --let $unsafe_type= 0 -while (`SELECT $unsafe_type < 9`) { +while ($unsafe_type < 9) { --echo - if (`SELECT $unsafe_type = 0`) { + if ($unsafe_type == 0) { --echo ==== Testing UUID() unsafeness ==== --let $desc_0= unsafe UUID() function --let $stmt_sidef_0= INSERT INTO t0 VALUES (UUID()) @@ -155,7 +155,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 1`) { + if ($unsafe_type == 1) { --echo ==== Testing @@hostname unsafeness ==== --let $desc_0= unsafe @@hostname variable --let $stmt_sidef_0= INSERT INTO t0 VALUES (@@hostname) @@ -168,7 +168,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 2`) { + if ($unsafe_type == 2) { --echo ==== Testing SELECT...LIMIT unsafeness ==== --let $desc_0= unsafe SELECT...LIMIT statement --let $stmt_sidef_0= INSERT INTO t0 SELECT * FROM data_table LIMIT 1 @@ -178,7 +178,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 3`) { + if ($unsafe_type == 3) { --echo ==== Testing INSERT DELAYED safeness after BUG#54579 is fixed ==== --let $desc_0= unsafe INSERT DELAYED statement --let $stmt_sidef_0= INSERT DELAYED INTO t0 VALUES (1), (2) @@ -188,7 +188,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 0 } - if (`SELECT $unsafe_type = 4`) { + if ($unsafe_type == 4) { --echo ==== Testing unsafeness of insert of two autoinc values ==== --let $desc_0= unsafe update of two autoinc columns --let $stmt_sidef_0= INSERT INTO double_autoinc_table VALUES (NULL) @@ -198,7 +198,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 5`) { + if ($unsafe_type == 5) { --echo ==== Testing unsafeness of UDF's ==== --let $desc_0= unsafe UDF --let $stmt_sidef_0= INSERT INTO t0 VALUES (myfunc_int(10)) @@ -208,7 +208,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 6`) { + if ($unsafe_type == 6) { --echo ==== Testing unsafeness of access to mysql.general_log ==== --let $desc_0= unsafe use of mysql.general_log --let $stmt_sidef_0= INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log @@ -218,7 +218,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 7`) { + if ($unsafe_type == 7) { --echo ==== Testing a statement that is unsafe in many ways ==== --let $desc_0= statement that is unsafe in many ways # Concatenate three unsafe values, and then concatenate NULL to @@ -230,7 +230,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 6 } - if (`SELECT $unsafe_type = 8`) { + if ($unsafe_type == 8) { --echo ==== Testing a statement that is unsafe several times ==== --let $desc_0= statement that is unsafe several times --let $stmt_sidef_0= INSERT INTO ta0 VALUES (multi_unsafe_func()) @@ -249,7 +249,7 @@ while (`SELECT $unsafe_type < 9`) { # construct. Instead, we just invoke the unsafe statement directly. --let $call_type_1= 0 - while (`SELECT $call_type_1 < 8`) { + while ($call_type_1 < 8) { #--echo debug: level 1, types $call_type_1 -> $unsafe_type --let $CRC_ARG_level= 1 --let $CRC_ARG_type= $call_type_1 @@ -280,7 +280,7 @@ while (`SELECT $unsafe_type < 9`) { # construct. --let $call_type_2= 0 - while (`SELECT $call_type_2 < 7`) { + while ($call_type_2 < 7) { #--echo debug: level 2, types $call_type_2 -> $call_type_1 -> $unsafe_type --let $CRC_ARG_level= 2 --let $CRC_ARG_type= $call_type_2 @@ -309,7 +309,7 @@ while (`SELECT $unsafe_type < 9`) { # construct. --let $call_type_3= 0 - while (`SELECT $call_type_3 < 7`) { + while ($call_type_3 < 7) { #--echo debug: level 3, types $call_type_2 -> $call_type_2 -> $call_type_1 -> $unsafe_type --let $CRC_ARG_level= 3 --let $CRC_ARG_type= $call_type_3 === modified file 'mysql-test/suite/federated/federated_bug_25714.test' --- a/mysql-test/suite/federated/federated_bug_25714.test 2009-02-02 11:36:03 +0000 +++ b/mysql-test/suite/federated/federated_bug_25714.test 2010-11-17 10:16:13 +0000 @@ -1,5 +1,5 @@ # Check that path to the specific test program has been setup -if (`select LENGTH("$MYSQL_BUG25714") = 0`) +if (!$MYSQL_BUG25714) { skip Need bug25714 test program; } === modified file 'mysql-test/suite/perfschema/t/setup_actors.test' --- a/mysql-test/suite/perfschema/t/setup_actors.test 2010-11-09 14:34:29 +0000 +++ b/mysql-test/suite/perfschema/t/setup_actors.test 2010-11-17 12:21:45 +0000 @@ -100,7 +100,7 @@ let $con2_thread_id= `select THREAD_ID f --echo # Switch to connection default --connection default # If a thread dies, we don't expect its THREAD_ID value will be re-used. -if (`SELECT $con2_thread_id <= $con1_thread_id`) +if ($con2_thread_id <= $con1_thread_id) { --echo ERROR: THREAD_ID of con2 is not bigger than THREAD_ID of con1 eval SELECT $con2_thread_id as THREAD_ID_con2, $con1_thread_id THREAD_ID_con1; === modified file 'mysql-test/suite/perfschema_stress/t/modify.test' --- a/mysql-test/suite/perfschema_stress/t/modify.test 2010-01-12 01:47:27 +0000 +++ b/mysql-test/suite/perfschema_stress/t/modify.test 2010-11-17 10:16:13 +0000 @@ -19,7 +19,7 @@ let $have_table= `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'`; -if (`SELECT ($have_table = 0)`) { +if (!$have_table) { --source suite/perfschema_stress/t/setup.test } === modified file 'mysql-test/suite/perfschema_stress/t/setup.test' --- a/mysql-test/suite/perfschema_stress/t/setup.test 2010-01-12 01:47:27 +0000 +++ b/mysql-test/suite/perfschema_stress/t/setup.test 2010-11-17 10:16:13 +0000 @@ -23,10 +23,10 @@ if (`SELECT VERSION() LIKE '%embedded%'` --disable_query_log --disable_result_log -if (`SELECT LENGTH('$engine_type') = 0`) { +if (!$engine_type) { let $engine_type= $default_engine_type; } -if (`SELECT '$engine_type' = 'Falcon'`) { +if ($engine_type == Falcon) { --source include/have_falcon.inc } === modified file 'mysql-test/suite/perfschema_stress/t/work.test' --- a/mysql-test/suite/perfschema_stress/t/work.test 2010-01-12 01:47:27 +0000 +++ b/mysql-test/suite/perfschema_stress/t/work.test 2010-11-17 10:16:13 +0000 @@ -19,7 +19,7 @@ let $have_table= `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'`; -if (`SELECT ($have_table = 0)`) { +if (!$have_table) { --source suite/perfschema_stress/t/setup.test } === modified file 'mysql-test/suite/rpl/t/rpl_change_master.test' --- a/mysql-test/suite/rpl/t/rpl_change_master.test 2010-10-07 16:39:57 +0000 +++ b/mysql-test/suite/rpl/t/rpl_change_master.test 2010-11-17 12:21:45 +0000 @@ -23,7 +23,7 @@ source include/stop_slave.inc; let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); -if (`SELECT $read_pos = $exec_pos`) +if ($read_pos == $exec_pos) { source include/show_rpl_debug_info.inc; echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos'; @@ -32,7 +32,7 @@ if (`SELECT $read_pos = $exec_pos`) change master to master_user='root'; let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); -if (`SELECT $read_pos <> $exec_pos`) +if ($read_pos != $exec_pos) { source include/show_rpl_debug_info.inc; echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos'; @@ -141,7 +141,7 @@ if (`SELECT $retry_count1 <> ($retry_cou -- let $retry_count2= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1) # assertion: it shows no changes -if (`SELECT $retry_count2 <> $retry_count1`) +if ($retry_count2 != $retry_count1) { -- echo Unexpected retry count value! Got: $retry_count2, expected: $retry_count1 -- die @@ -156,7 +156,7 @@ CHANGE MASTER TO master_retry_count=1; -- let $retry_count3= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1) # assertion: it should show 1 -if (`SELECT $retry_count3 <> 1`) +if ($retry_count3 != 1) { -- echo Unexpected retry count value! Got: $retry_count3, expected: 1 -- die @@ -171,7 +171,7 @@ if (`SELECT $retry_count3 <> 1`) -- let $retry_count4= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1) # assertion: it should show 1 -if (`SELECT $retry_count4 <> $retry_count0`) +if ($retry_count4 != $retry_count0) { -- echo Unexpected retry count value! Got: $retry_count4, expected: $retry_count0 -- die @@ -200,7 +200,7 @@ if (`SELECT $retry_count4 <> $retry_coun -- let $retry_count_before= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1) -- eval CHANGE MASTER TO master_connect_retry= $connect_retry_new -- let $retry_count_after= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1) -if (`SELECT $retry_count_before <> $retry_count_after`) +if ($retry_count_before != $retry_count_after) { -- echo Unexpected retry count value! Got: $retry_count_after, expected: $retry_count_before -- die @@ -226,7 +226,7 @@ EOF -- source include/start_slave.inc -- let $retry_count5= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1) -if (`SELECT $retry_count5 <> $retry_count_expected`) +if ($retry_count5 != $retry_count_expected) { -- echo Unexpected retry count value! Got: $retry_count5, expected: $retry_count_expected -- die === modified file 'mysql-test/suite/rpl/t/rpl_concurrency_error.test' --- a/mysql-test/suite/rpl/t/rpl_concurrency_error.test 2010-04-28 12:47:49 +0000 +++ b/mysql-test/suite/rpl/t/rpl_concurrency_error.test 2010-11-17 10:16:13 +0000 @@ -53,24 +53,24 @@ while ($type) { let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); connection conn1; - if (`select $type = 2`) + if ($type == 2) { SET AUTOCOMMIT = 1; BEGIN; } - if (`select $type = 1`) + if ($type == 1) { SET AUTOCOMMIT = 0; } eval UPDATE t SET f = 'yellow $type' WHERE i = 3; connection conn2; - if (`select $type = 2`) + if ($type == 2) { SET AUTOCOMMIT = 1; BEGIN; } - if (`select $type = 1`) + if ($type == 1) { SET AUTOCOMMIT = 0; } @@ -88,24 +88,24 @@ while ($type) let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); connection conn1; - if (`select $type = 2`) + if ($type == 2) { SET AUTOCOMMIT = 1; BEGIN; } - if (`select $type = 1`) + if ($type == 1) { SET AUTOCOMMIT = 0; } eval UPDATE t SET f = 'gray $type' WHERE i = 3; connection conn2; - if (`select $type = 2`) + if ($type == 2) { SET AUTOCOMMIT = 1; BEGIN; } - if (`select $type = 1`) + if ($type == 1) { SET AUTOCOMMIT = 0; } === modified file 'mysql-test/suite/rpl/t/rpl_delayed_slave.test' --- a/mysql-test/suite/rpl/t/rpl_delayed_slave.test 2010-09-16 11:00:57 +0000 +++ b/mysql-test/suite/rpl/t/rpl_delayed_slave.test 2010-11-17 12:21:45 +0000 @@ -72,7 +72,7 @@ call mtr.add_suppression("Unsafe stateme # - If we execute a query on master and wait $time3 seconds, then the # query has been executed. --let $time1= 10 -if (`SELECT '$max_query_execution_time' > 0`) { +if ($max_query_execution_time) { --let $time1= $max_query_execution_time } --let $time2= `SELECT 2 * $time1` === modified file 'mysql-test/suite/rpl/t/rpl_heartbeat.test' --- a/mysql-test/suite/rpl/t/rpl_heartbeat.test 2010-06-19 09:24:34 +0000 +++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test 2010-11-17 10:23:22 +0000 @@ -142,7 +142,7 @@ source include/check_slave_param.inc; let $slave_wait_param_counter= 300; let $slave_value= query_get_value("SHOW STATUS like 'Slave_received_heartbeats'", Value, 1); # Checking the fact that at least one heartbeat is received -while (`select $slave_value = 0`) +while (!$slave_value) { dec $slave_wait_param_counter; if (!$slave_wait_param_counter) === modified file 'mysql-test/suite/rpl/t/rpl_mysql_upgrade.test' --- a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test 2010-04-28 12:47:49 +0000 +++ b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test 2010-11-17 10:16:13 +0000 @@ -30,7 +30,7 @@ sync_slave_with_master; connection master; let $after_position= query_get_value(SHOW MASTER STATUS, Position, 1); -if (`SELECT '$before_position'='$after_position'`) +if ($before_position == $after_position) { echo Master position is not changed; } @@ -48,7 +48,7 @@ connection master; let $after_file= query_get_value(SHOW MASTER STATUS, File, 1); let $after_position= query_get_value(SHOW MASTER STATUS, Position, 1); -if (!`SELECT '$before_position'='$after_position'`) +if ($before_position != $after_position) { echo Master position has been changed; } === modified file 'mysql-test/suite/rpl/t/rpl_packet.test' --- a/mysql-test/suite/rpl/t/rpl_packet.test 2010-11-18 04:37:26 +0000 +++ b/mysql-test/suite/rpl/t/rpl_packet.test 2010-11-19 10:19:07 +0000 @@ -207,7 +207,7 @@ while($i) { --let $flags=--start-position=$start_pos - if(`SELECT $i=2`) + if($i==2) { --let $flags= $flags --base64-output=decode-rows -v } === modified file 'mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test' --- a/mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test 2010-06-21 10:44:26 +0000 +++ b/mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test 2010-11-17 12:21:45 +0000 @@ -18,9 +18,7 @@ RESET SLAVE; # the old version of relay_log.info comes in two versions: with path # separator '/' (most systems) and with path separator '\' (windows) ---let $escaped_path_separator= \ ---let $escaped_path_separator= $escaped_path_separator$SYSTEM_PATH_SEPARATOR -if (`SELECT '$escaped_path_separator' != '/'`) { +if ($SYSTEM_PATH_SEPARATOR != /) { --let $file_suffix= -win } --copy_file $MYSQL_TEST_DIR/std_data/old-format-relay-log$file_suffix.info $MYSQLD_DATADIR/relay-log.info === modified file 'mysql-test/suite/rpl/t/rpl_seconds_behind_master.test' --- a/mysql-test/suite/rpl/t/rpl_seconds_behind_master.test 2010-05-04 10:35:47 +0000 +++ b/mysql-test/suite/rpl/t/rpl_seconds_behind_master.test 2010-11-17 12:21:45 +0000 @@ -149,7 +149,7 @@ let $condition= = 'Slave has read all re -- source include/wait_show_condition.inc -- let $sbm= query_get_value("SHOW SLAVE STATUS", Seconds_Behind_Master, 1) -if (`SELECT $sbm <> 0`) +if ($sbm != 0) { -- echo #### Seconds behind master must show '0', because SQL thread is now waiting for new events. -- echo #### SBM ($sbm seconds) != 0 !! SQL thread is waiting so should be zero. @@ -186,7 +186,7 @@ let $condition= = 'INSERT INTO t1 VALUES -- source include/wait_show_condition.inc -- let $sbm= query_get_value("SHOW SLAVE STATUS", Seconds_Behind_Master, 1) -if (`SELECT $sbm < 3600`) +if ($sbm < 3600) { -- echo #### Seconds behind master must show > 3600 because the event that -- echo #### is being processed was issued 3600 seconds ago. === modified file 'mysql-test/suite/rpl/t/rpl_semi_sync.test' --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test 2010-11-04 08:19:27 +0000 +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test 2010-11-19 10:19:07 +0000 @@ -59,7 +59,7 @@ echo [ on master ]; disable_query_log; let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1); -if (`select '$value' = 'No such row'`) +if ($value == No such row) { set sql_log_bin=0; eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN'; @@ -124,7 +124,7 @@ echo [ on slave ]; disable_query_log; let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1); -if (`select '$value' = 'No such row'`) +if ($value == No such row) { set sql_log_bin=0; eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN'; === modified file 'mysql-test/suite/rpl/t/rpl_semi_sync_event.test' --- a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test 2010-04-28 12:47:49 +0000 +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test 2010-11-17 10:16:13 +0000 @@ -20,7 +20,7 @@ enable_query_log; connection master; disable_query_log; let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1); -if (`select '$value' = 'No such row'`) +if ($value == No such row) { set sql_log_bin=0; eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN'; @@ -34,7 +34,7 @@ source include/stop_slave.inc; disable_query_log; let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1); -if (`select '$value' = 'No such row'`) +if ($value == No such row) { set sql_log_bin=0; eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN'; === modified file 'mysql-test/suite/rpl/t/rpl_server_uuid.test' --- a/mysql-test/suite/rpl/t/rpl_server_uuid.test 2010-10-08 14:23:55 +0000 +++ b/mysql-test/suite/rpl/t/rpl_server_uuid.test 2010-11-17 12:21:45 +0000 @@ -51,7 +51,7 @@ connection slave; --let $slave_param_value= $master_uuid_on_master source include/check_slave_param.inc; -if (`SELECT '$slave_uuid_on_slave' <> '$slave_uuid_on_master'`) +if ($slave_uuid_on_slave != $slave_uuid_on_master) { --echo slave_uuid_on_slave <> slave_uuid_on_master --echo $slave_uuid_on_slave <> $slave_uuid_on_master === modified file 'mysql-test/suite/rpl/t/rpl_slow_query_log.test' --- a/mysql-test/suite/rpl/t/rpl_slow_query_log.test 2010-04-29 11:20:36 +0000 +++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test 2010-11-17 10:23:22 +0000 @@ -233,7 +233,7 @@ let $master_slow_query= `SELECT count(*) -- sync_slave_with_master let $slave_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`; -if (`SELECT $master_slow_query != $slave_slow_query`) +if ($master_slow_query != $slave_slow_query) { -- connection master -- echo *********************************************** @@ -250,7 +250,7 @@ if (`SELECT $master_slow_query != $slave -- die "Assertion failed! Master and slave slow log contents differ. Bailing out!" } -if (`SELECT $master_slow_query = $slave_slow_query`) +if ($master_slow_query == $slave_slow_query) { -- echo ### Assertion is good. Both Master and Slave exhibit the -- echo ### same number of queries in slow log: $master_slow_query @@ -276,7 +276,7 @@ let $master_slow_query= `SELECT count(*) -- sync_slave_with_master let $slave_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`; -if (`SELECT $master_slow_query != $slave_slow_query`) +if ($master_slow_query != $slave_slow_query) { -- connection master -- echo *********************************************** @@ -293,7 +293,7 @@ if (`SELECT $master_slow_query != $slave -- die "Assertion failed! Master and slave slow log contents differ. Bailing out!" } -if (`SELECT $master_slow_query = $slave_slow_query`) +if ($master_slow_query == $slave_slow_query) { -- echo ### Assertion is good. Both Master and Slave exhibit the -- echo ### same number of queries in slow log: $master_slow_query === modified file 'mysql-test/suite/rpl/t/rpl_ssl.test' --- a/mysql-test/suite/rpl/t/rpl_ssl.test 2010-06-22 09:34:59 +0000 +++ b/mysql-test/suite/rpl/t/rpl_ssl.test 2010-11-17 10:23:22 +0000 @@ -75,7 +75,7 @@ source include/check_slave_is_running.in let $slave_count= `select count(*) from t1`; -if (`select $slave_count != $master_count`) +if ($slave_count != $master_count) { echo master and slave differed in number of rows; echo master: $master_count; === modified file 'mysql-test/suite/sys_vars/t/slow_launch_time_func.test' --- a/mysql-test/suite/sys_vars/t/slow_launch_time_func.test 2008-12-19 15:12:15 +0000 +++ b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test 2010-11-17 10:16:13 +0000 @@ -84,7 +84,7 @@ let $value_before= CONNECT (conn2,localhost,root,,); let $value_after= query_get_value(show status like 'slow_launch_threads', Value, 1); -if (!`SELECT $value_after = $value_before`) +if ($value_after != $value_before) { --echo ERROR: Subtest FN_DYNVARS_124_02 failed --echo A new connect must not be counted as 'slow_launch_thread' if === modified file 'mysql-test/t/change_user.test' --- a/mysql-test/t/change_user.test 2010-08-09 08:32:50 +0000 +++ b/mysql-test/t/change_user.test 2010-11-17 10:16:13 +0000 @@ -117,7 +117,7 @@ let $before= query_get_value(SHOW GLOBAL let $after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_select',Value,1); -if (`select $after != $before`){ +if ($after != $before){ SHOW GLOBAL STATUS LIKE 'com_select'; die The value of com_select changed during change_user; } === modified file 'mysql-test/t/execution_constants.test' --- a/mysql-test/t/execution_constants.test 2008-08-04 10:38:50 +0000 +++ b/mysql-test/t/execution_constants.test 2010-11-17 10:16:13 +0000 @@ -49,7 +49,7 @@ while ($i) let $i = 1// # Check that mysql_errno is 1436 - if (`select $mysql_errno != 1436`) + if ($mysql_errno != 1436) { die Wrong error triggered, expected 1436 but got $mysql_errno// } === modified file 'mysql-test/t/fix_priv_tables.test' --- a/mysql-test/t/fix_priv_tables.test 2009-05-15 10:15:56 +0000 +++ b/mysql-test/t/fix_priv_tables.test 2010-11-17 10:16:13 +0000 @@ -3,7 +3,7 @@ # Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set # to the location of mysql_fix_privilege_tables.sql -if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`) +if (!$MYSQL_FIX_PRIVILEGE_TABLES) { skip Test need MYSQL_FIX_PRIVILEGE_TABLES; } === modified file 'mysql-test/t/mysqltest.test' --- a/mysql-test/t/mysqltest.test 2010-10-27 10:28:09 +0000 +++ b/mysql-test/t/mysqltest.test 2010-11-18 17:03:16 +0000 @@ -854,6 +854,13 @@ let $var2= `failing query`; echo $var2; EOF +create table t1 (a varchar(100)); +insert into t1 values ('`select 42`'); +let $a= `select * from t1`; +# This should output `select 42`, not evaluate it again to 42 +echo $a; +drop table t1; + --error 1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/let.sql 2>&1 @@ -1134,6 +1141,11 @@ if (!$counter) { echo Counter is not 0, (counter=10); } +if (! $counter) +{ + let $counter=5; +} +echo Counter should still be 10, is $counter; let $counter=0; if($counter) { @@ -1143,6 +1155,10 @@ if (!$counter) { echo Counter is not 0, (counter=0); } +if (! $counter) +{ + echo Not space var works; +} # ---------------------------------------------------------------------------- # Test if with some non-numerics @@ -1163,10 +1179,11 @@ if ($counter) { echo oops, -0 is true; } -if (beta) -{ - echo Beta is true; -} +# This is no longer allowed, as a precaution against mistyped conditionals +# if (beta) +# { +# echo Beta is true; +# } let $counter=gamma; while ($counter) { @@ -1175,6 +1192,179 @@ while ($counter) } # ---------------------------------------------------------------------------- +# Test if with compare conditions +# ---------------------------------------------------------------------------- + +let $ifvar= 5; +let $ifvar2= 6; + +if ($ifvar < 7) +{ + echo 5<7; +} +if ($ifvar< 7) +{ + echo 5<7 again; +} +if ($ifvar<7) +{ + echo 5<7 still; +} +if ($ifvar < $ifvar2) +{ + echo 5<6; +} +if ($ifvar <= 4) +{ + echo 5<=4; +} +if ($ifvar >= 5) +{ + echo 5>=5; +} +if ($ifvar>=5) +{ + echo 5>=5 again; +} +if ($ifvar > 3) +{ + echo 5>3; +} +if ($ifvar == 4) +{ + echo 5==4; +} +if ($ifvar == 5) +{ + echo 5==5; +} +if ($ifvar != 8) +{ + echo 5!=8; +} +# Any number should compare unequal to any string +if ($ifvar != five) +{ + echo 5!=five; +} +if ($ifvar == `SELECT 3+2`) +{ + echo 5==3+2; +} +if ($ifvar == 5) +{ + echo 5 == 5; +} +let $ifvar= hello; +if ($ifvar == hello there) +{ + echo hello == hello there; +} +if ($ifvar == hello) +{ + echo hello == hello; +} +if ($ifvar == hell) +{ + echo hello == hell; +} +if ($ifvar == hello) +{ + echo hello == hello; +} +if ($ifvar != goodbye) +{ + echo hello != goodbye; +} + +let $ifvar= two words; +if ($ifvar == two words) +{ + echo two words; +} +if ($ifvar == `SELECT 'two words'`) +{ + echo two words are two words; +} +if (42) +{ + echo right answer; +} +if (0) +{ + echo wrong answer; +} +# Non-empty string treated as 'true' +if (`SELECT 'something'`) +{ + echo anything goes; +} +# Make sure 0 and string compare right +let $ifvar= 0; +if ($ifvar == string) +{ + echo 0 == string; +} +if ($ifvar != string) +{ + echo 0 != string; +} +--write_file $MYSQL_TMP_DIR/mysqltest.sql +let $var= 5; +if ($var >= four) +{ + echo 5>=four; +} +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1 +remove_file $MYSQL_TMP_DIR/mysqltest.sql; + +--write_file $MYSQL_TMP_DIR/mysqltest.sql +let $var= 5; +if ($var ~= 6) +{ + echo 5~=6; +} +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1 +remove_file $MYSQL_TMP_DIR/mysqltest.sql; + +--write_file $MYSQL_TMP_DIR/mysqltest.sql +let $var= text; +if (var == text) +{ + echo Oops I forgot the $; +} +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1 +remove_file $MYSQL_TMP_DIR/mysqltest.sql; + +# ---------------------------------------------------------------------------- +# Test while with compare conditions +# ---------------------------------------------------------------------------- + +let $counter= 2; + +while ($counter < 5) +{ + echo counter is $counter; + inc $counter; +} +let $ifvar=; +while ($ifvar != stop) +{ + if ($counter >= 7) + { + let $ifvar= stop; + } + echo counter is $counter; + inc $counter; +} + +# ---------------------------------------------------------------------------- # Test while, { and } # ---------------------------------------------------------------------------- @@ -2438,15 +2628,15 @@ let $count= 0; while ($run) { let $Field= query_get_value($show_statement, Field, $rowno); - if (`SELECT '$Field' = 'No such row'`) + if ($Field == No such row) { let $run= 0; } - if (`SELECT '$Field' <> 'No such row'`) + if ($Field != No such row) { let $Type= query_get_value($show_statement, Type, $rowno); let $Null= query_get_value($show_statement, Null, $rowno); - if (`SELECT '$Null' = 'YES'`) + if ($Null == YES) { inc $count; } @@ -2534,26 +2724,6 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir; --replace_result c:\\a.txt z SELECT 'c:\\a.txt' AS col; -# -# Bug#32307 mysqltest - does not detect illegal if syntax -# - -let $test= 1; -if ($test){ - echo hej; -} - ---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql -if ($mysql_errno != 1436) -{ - echo ^ Should not be allowed! -} -EOF ---error 1 ---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 -remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; - - # ---------------------------------------------------------------------------- # Test that -- is not allowed as comment, only as mysqltest builtin command # ---------------------------------------------------------------------------- === modified file 'mysql-test/t/named_pipe.test' --- a/mysql-test/t/named_pipe.test 2009-11-19 23:48:08 +0000 +++ b/mysql-test/t/named_pipe.test 2010-11-17 10:16:13 +0000 @@ -5,7 +5,7 @@ # Only run this test if named pipe is avaliable let $nmp= query_get_value("SHOW VARIABLES LIKE 'named_pipe'", Value, 1); -if (`SELECT '$nmp' != 'ON'`){ +if ($nmp != ON){ skip No named pipe support; } === modified file 'mysql-test/t/server_uuid.test' --- a/mysql-test/t/server_uuid.test 2010-06-22 09:34:59 +0000 +++ b/mysql-test/t/server_uuid.test 2010-11-17 12:21:45 +0000 @@ -68,7 +68,7 @@ if (`SELECT '$server_uuid' = '' OR '$ser --source include/restart_mysqld.inc --let $server_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) -if (`SELECT '$server_uuid' <> '$original_server_uuid'`) +if ($server_uuid != $original_server_uuid) { - --echo $server_uuid<> $original_server_uuid + --echo $server_uuid != $original_server_uuid } === modified file 'mysql-test/t/shm.test' --- a/mysql-test/t/shm.test 2009-11-10 19:36:38 +0000 +++ b/mysql-test/t/shm.test 2010-11-17 10:16:13 +0000 @@ -4,7 +4,7 @@ # Only run this test if shared memory is avaliable let $shm= query_get_value("SHOW VARIABLES LIKE 'shared_memory'", Value, 1); -if (`SELECT '$shm' != 'ON'`){ +if ($shm != ON){ skip No shm support; } let $shm_name= query_get_value("SHOW GLOBAL VARIABLES LIKE 'shared_memory_base_name'", Value, 1); === modified file 'mysql-test/t/system_mysql_db_fix40123.test' --- a/mysql-test/t/system_mysql_db_fix40123.test 2010-11-03 14:31:27 +0000 +++ b/mysql-test/t/system_mysql_db_fix40123.test 2010-11-17 10:23:22 +0000 @@ -3,7 +3,7 @@ # Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set # to the location of mysql_fix_privilege_tables.sql -if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`) +if (!$MYSQL_FIX_PRIVILEGE_TABLES) { skip Test need MYSQL_FIX_PRIVILEGE_TABLES; } === modified file 'mysql-test/t/system_mysql_db_fix50030.test' --- a/mysql-test/t/system_mysql_db_fix50030.test 2010-11-03 14:31:27 +0000 +++ b/mysql-test/t/system_mysql_db_fix50030.test 2010-11-17 10:23:22 +0000 @@ -3,7 +3,7 @@ # Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set # to the location of mysql_fix_privilege_tables.sql -if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`) +if (!$MYSQL_FIX_PRIVILEGE_TABLES) { skip Test needs MYSQL_FIX_PRIVILEGE_TABLES; } === modified file 'mysql-test/t/system_mysql_db_fix50117.test' --- a/mysql-test/t/system_mysql_db_fix50117.test 2010-11-03 14:31:27 +0000 +++ b/mysql-test/t/system_mysql_db_fix50117.test 2010-11-17 10:23:22 +0000 @@ -3,7 +3,7 @@ # Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set # to the location of mysql_fix_privilege_tables.sql -if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`) +if (!$MYSQL_FIX_PRIVILEGE_TABLES) { skip Test needs MYSQL_FIX_PRIVILEGE_TABLES; } === modified file 'unittest/unit.pl' --- a/unittest/unit.pl 2010-03-19 08:02:31 +0000 +++ b/unittest/unit.pl 2010-11-14 13:23:57 +0000 @@ -14,7 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -use Test::Harness; use File::Find; use Getopt::Long; @@ -38,9 +37,10 @@ unit - Run unit tests in directory my $big= $ENV{'MYTAP_CONFIG'} eq 'big'; +my $opt_verbose; my $result = GetOptions ( "big!" => \$big, - "verbose!" => \$Test::Harness::verbose, + "verbose!" => \$opt_verbose, ); $ENV{'MYTAP_CONFIG'} = $big ? 'big' : ''; @@ -60,6 +60,19 @@ Run all unit tests in the current direct =cut +BEGIN { + # Test::Harness have been extensively rewritten in newer perl + # versions and is now just a backward compatibility wrapper + # (with a bug causing the HARNESS_PERL_SWITCHES to be mangled) + # Prefer to use TAP::Harness directly if available + if (eval "use TAP::Harness; 1") { + eval 'sub NEW_HARNESS { 1 }'; + warn "using TAP::Harness"; + } else { + eval "use Test::Harness; 1" or die "couldn't find Test::Harness!"; + eval 'sub NEW_HARNESS { 0 }'; + } +} sub _find_test_files (@) { my @dirs = @_; @@ -103,8 +116,19 @@ sub run_cmd (@) { if (@files > 0) { # Removing the first './' from the file names foreach (@files) { s!^\./!! } - $ENV{'HARNESS_PERL_SWITCHES'} .= ' -e "exec @ARGV"'; - runtests @files; + + if (NEW_HARNESS()) + { + my %args = ( exec => [ ], verbosity => $opt_verbose ); + my $harness = TAP::Harness->new( \%args ); + $harness->runtests(@files); + } + else + { + $ENV{'HARNESS_VERBOSE'} = $opt_verbose; + $ENV{'HARNESS_PERL_SWITCHES'} .= ' -e "exec @ARGV"'; + runtests(@files); + } } } No bundle (reason: revision is a merge).