From 4937eec1a21cd53110f0067dc9fb4c8fc1e9d7cc Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 10 Sep 2010 13:08:06 +0200 Subject: Bug #56647 Valgrind warnings for memory leak in mysqltest.cc Moved an init_dynamic_string() from before to after potential die() --- client/mysqltest.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index b7b7ad25d23..ec8aa0f0110 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7309,11 +7309,10 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) (flags & QUERY_REAP_FLAG)); DBUG_ENTER("run_query"); - init_dynamic_string(&ds_warnings, NULL, 0, 256); - if (cn->pending && (flags & QUERY_SEND_FLAG)) die ("Cannot run query on connection between send and reap"); + init_dynamic_string(&ds_warnings, NULL, 0, 256); /* Evaluate query if this is an eval command */ -- cgit v1.2.1 From 64ae6d4a7e8f507d48c1b4fc0985d1d2733d6ce1 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 14 Sep 2010 14:04:37 +0200 Subject: Bug #55426 mysqltest crashes when trying to unlock not acquired mutex Bug #55546 mysqltest fails to create a new thread on HPUX Missing call to pthread_join(), in embedded mode This independently solves both problems, see 55426 for details. Addendum: cannot test against a pthread_t, adds boolean flag instead --- client/mysqltest.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index ec8aa0f0110..31854737cbc 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -242,7 +242,9 @@ struct st_connection int cur_query_len; pthread_mutex_t mutex; pthread_cond_t cond; + pthread_t tid; int query_done; + my_bool has_thread; #endif /*EMBEDDED_LIBRARY*/ }; @@ -733,8 +735,6 @@ pthread_handler_t send_one_query(void *arg) static int do_send_query(struct st_connection *cn, const char *q, int q_len, int flags) { - pthread_t tid; - if (flags & QUERY_REAP_FLAG) return mysql_send_query(&cn->mysql, q, q_len); @@ -745,9 +745,10 @@ static int do_send_query(struct st_connection *cn, const char *q, int q_len, cn->cur_query= q; cn->cur_query_len= q_len; cn->query_done= 0; - if (pthread_create(&tid, &cn_thd_attrib, send_one_query, (void*)cn)) + if (pthread_create(&cn->tid, &cn_thd_attrib, send_one_query, (void*)cn)) die("Cannot start new thread for query"); + cn->has_thread= TRUE; return 0; } @@ -760,6 +761,11 @@ static void wait_query_thread_end(struct st_connection *con) pthread_cond_wait(&con->cond, &con->mutex); pthread_mutex_unlock(&con->mutex); } + if (con->has_thread) + { + pthread_join(con->tid, NULL); + con->has_thread= FALSE; + } } #else /*EMBEDDED_LIBRARY*/ @@ -5187,6 +5193,7 @@ void do_connect(struct st_command *command) #ifdef EMBEDDED_LIBRARY con_slot->query_done= 1; + con_slot->has_thread= FALSE; #endif if (!mysql_init(&con_slot->mysql)) die("Failed on mysql_init()"); -- cgit v1.2.1 From 6ff48a61f23a1241d7db95e4f84f1a132a4f08d0 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 15 Sep 2010 14:56:22 +0200 Subject: Bug #56753 mtr silently ignores junk after backticks When stepping backward to end of `` expression, check for illegal chars --- client/mysqltest.cc | 6 ++++++ mysql-test/include/setup_fake_relay_log.inc | 2 +- mysql-test/r/mysqltest.result | 3 +++ mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test | 4 ++-- mysql-test/t/mysqltest.test | 17 +++++++++++++++++ 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 31854737cbc..a84ad2ad9e8 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -2181,8 +2181,14 @@ void var_query_set(VAR *var, const char *query, const char** query_end) DBUG_ENTER("var_query_set"); LINT_INIT(res); + /* Only white space or ) allowed past ending ` */ while (end > query && *end != '`') + { + if (*end && (*end != ' ' && *end != '\t' && *end != '\n' && *end != ')')) + die("Spurious text after `query` expression"); --end; + } + if (query == end) die("Syntax error in query, missing '`'"); ++query; diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc index 5b9e7f72fdd..fb035941a29 100644 --- a/mysql-test/include/setup_fake_relay_log.inc +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -72,7 +72,7 @@ copy_file $fake_relay_log $_fake_relay_log; if (`SELECT LENGTH(@@secure_file_priv) > 0`) { - -- let $_file_priv_dir= `SELECT @@secure_file_priv`; + -- let $_file_priv_dir= `SELECT @@secure_file_priv` -- let $_suffix= `SELECT UUID()` -- let $_tmp_file= $_file_priv_dir/fake-index.$_suffix diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 1044127b06e..650cc069b7f 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -177,6 +177,9 @@ mysqltest: At line 1: End of line junk detected: "disconnect default # comment " mysqltest: At line 1: Extra delimiter ";" found mysqltest: At line 1: Extra delimiter ";" found +mysqltest: At line 1: Spurious text after `query` expression +mysqltest: At line 1: Spurious text after `query` expression +mysqltest: At line 2: Spurious text after `query` expression mysqltest: At line 1: Missing argument(s) to 'error' mysqltest: At line 1: Missing argument(s) to 'error' mysqltest: At line 1: The sqlstate definition must start with an uppercase S diff --git a/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test b/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test index be5ebb661ca..d854aa64dc5 100644 --- a/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test +++ b/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test @@ -205,7 +205,7 @@ DROP TABLE `t1`; -- echo === Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail. --- let $MYSQLD_DATADIR= `SELECT @@datadir`; +-- let $MYSQLD_DATADIR= `SELECT @@datadir` -- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog -- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog @@ -330,7 +330,7 @@ while($ntables) -- echo ### assertion: check that binlog is not corrupt. Using mysqlbinlog to -- echo ### detect failure. Before the patch mysqlbinlog would find -- echo ### a corrupted event, thence would fail. --- let $MYSQLD_DATADIR= `SELECT @@datadir`; +-- let $MYSQLD_DATADIR= `SELECT @@datadir` -- exec $MYSQL_BINLOG -v --hex $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog ## clean up diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 9da19ec00e0..597adffd035 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -494,6 +494,23 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; --error 1 --exec echo "--disable_query_log;" | $MYSQL_TEST 2>&1 +# +# Extra text after `` +# +--error 1 +-- exec echo "let \$x= \`select 1\` BOO ;" | $MYSQL_TEST 2>&1 +--error 1 +-- exec echo "--let \$x= \`select 1\`;" | $MYSQL_TEST 2>&1 +--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql +# Missing ; in next line should be detected and cause failure +let $x= `select 1` +let $x= 2; +echo $x; +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; + # Allow trailing # comment --sleep 1 # Wait for insert delayed to be executed. -- cgit v1.2.1 From c18a34bda6f16521f9c3f9c43579af70d1c7a22f Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 20 Sep 2010 11:21:27 +0200 Subject: Bug #55426 mysqltest crashes when trying to unlock not acquired mutex Follow-up: don't call pthread_join() on Windows This change only valid for 5.1 --- client/mysqltest.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index a84ad2ad9e8..08375e4a576 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -763,7 +763,10 @@ static void wait_query_thread_end(struct st_connection *con) } if (con->has_thread) { +#ifndef __WIN__ + /* May hang on Windows, but the problem it solves is not seen there */ pthread_join(con->tid, NULL); +#endif con->has_thread= FALSE; } } -- cgit v1.2.1 From ee6f8ae1bd0f4821bf806b3721877400ede0e848 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 21 Sep 2010 11:16:20 +0200 Subject: test fixes after 56753 --- mysql-test/suite/sys_vars/t/secure_file_priv.test | 2 +- mysql-test/t/mysqltest.test | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv.test b/mysql-test/suite/sys_vars/t/secure_file_priv.test index 7a534e7d6e4..3e2a4fa467a 100644 --- a/mysql-test/suite/sys_vars/t/secure_file_priv.test +++ b/mysql-test/suite/sys_vars/t/secure_file_priv.test @@ -9,7 +9,7 @@ SHOW VARIABLES LIKE 'secure_file_priv'; # Doing this in a portable manner is difficult but we should be able to # count on the depth of the directory hierarchy used. Three steps up from # the datadir is the 'mysql_test' directory. ---let $PROTECTED_FILE=`SELECT concat(@@datadir,'/../../../bug50373.txt')`; +--let $PROTECTED_FILE=`SELECT concat(@@datadir,'/../../../bug50373.txt')` --eval SELECT * FROM t1 INTO OUTFILE '$PROTECTED_FILE'; DELETE FROM t1; --eval LOAD DATA INFILE '$PROTECTED_FILE' INTO TABLE t1; diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 597adffd035..c054b163c0c 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -497,10 +497,19 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; # # Extra text after `` # +# Cannot use exec echo here as ` may or may not need to be escaped +--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql +let $x= `select 1` BOO ; +EOF --error 1 --- exec echo "let \$x= \`select 1\` BOO ;" | $MYSQL_TEST 2>&1 +--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; +--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql +--let $x= `select 1`; +EOF --error 1 --- exec echo "--let \$x= \`select 1\`;" | $MYSQL_TEST 2>&1 +--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql # Missing ; in next line should be detected and cause failure let $x= `select 1` -- cgit v1.2.1 From 7b216d7625301901a8296868d9a4c34bfec8b08a Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 22 Sep 2010 10:57:10 +0200 Subject: Bug #56921 It should be possible to log connection statements in mysqltest Added --enable-connect-log, somewhet similar to --enable-query-log If query log is disabled, disable connect log too Also some related cleanup in mysqltest.test: removing duplicate test loop --- client/mysqltest.cc | 33 +++++++++++++++++++++++++++++++++ mysql-test/r/mysqltest.result | 8 ++++++-- mysql-test/t/mysqltest.test | 32 +++++++++++++++++--------------- 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 08375e4a576..742ddda6add 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -103,6 +103,7 @@ static my_bool parsing_disabled= 0; static my_bool display_result_vertically= FALSE, display_result_lower= FALSE, display_metadata= FALSE, display_result_sorted= FALSE; static my_bool disable_query_log= 0, disable_result_log= 0; +static my_bool disable_connect_log= 1; static my_bool disable_warnings= 0; static my_bool disable_info= 1; static my_bool abort_on_error= 1; @@ -275,6 +276,7 @@ enum enum_commands { Q_DISABLE_RPL_PARSE, Q_EVAL_RESULT, Q_ENABLE_QUERY_LOG, Q_DISABLE_QUERY_LOG, Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG, + Q_ENABLE_CONNECT_LOG, Q_DISABLE_CONNECT_LOG, Q_WAIT_FOR_SLAVE_TO_STOP, Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS, Q_ENABLE_INFO, Q_DISABLE_INFO, @@ -342,6 +344,8 @@ const char *command_names[]= /* Enable/disable that the _result_ from a query is logged to result file */ "enable_result_log", "disable_result_log", + "enable_connect_log", + "disable_connect_log", "wait_for_slave_to_stop", "enable_warnings", "disable_warnings", @@ -4793,6 +4797,16 @@ void select_connection_name(const char *name) set_current_connection(con); + /* Connection logging if enabled */ + if (!disable_connect_log && !disable_query_log) + { + DYNAMIC_STRING *ds= &ds_res; + + dynstr_append_mem(ds, "connection ", 11); + replace_dynstr_append(ds, name); + dynstr_append_mem(ds, ";\n", 2); + } + DBUG_VOID_RETURN; } @@ -4880,6 +4894,16 @@ void do_close_connection(struct st_command *command) var_set_string("$CURRENT_CONNECTION", con->name); } + /* Connection logging if enabled */ + if (!disable_connect_log && !disable_query_log) + { + DYNAMIC_STRING *ds= &ds_res; + + dynstr_append_mem(ds, "disconnect ", 11); + replace_dynstr_append(ds, ds_connection.str); + dynstr_append_mem(ds, ";\n", 2); + } + DBUG_VOID_RETURN; } @@ -5014,6 +5038,13 @@ int connect_n_handle_errors(struct st_command *command, dynstr_append_mem(ds, delimiter, delimiter_length); dynstr_append_mem(ds, "\n", 1); } + /* Simlified logging if enabled */ + if (!disable_connect_log && !disable_query_log) + { + replace_dynstr_append(ds, command->query); + dynstr_append_mem(ds, ";\n", 2); + } + while (!mysql_real_connect(con, host, user, pass, db, port, sock ? sock: 0, CLIENT_MULTI_STATEMENTS)) { @@ -8071,6 +8102,8 @@ int main(int argc, char **argv) case Q_DISABLE_ABORT_ON_ERROR: abort_on_error=0; break; case Q_ENABLE_RESULT_LOG: disable_result_log=0; break; case Q_DISABLE_RESULT_LOG: disable_result_log=1; break; + case Q_ENABLE_CONNECT_LOG: disable_connect_log=0; break; + case Q_DISABLE_CONNECT_LOG: disable_connect_log=1; break; case Q_ENABLE_WARNINGS: disable_warnings=0; break; case Q_DISABLE_WARNINGS: disable_warnings=1; break; case Q_ENABLE_INFO: disable_info=0; break; diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 650cc069b7f..8afef65b66f 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -452,12 +452,16 @@ mysqltest: At line 1: Missing required argument 'host' to command 'connect' mysqltest: At line 1: query 'connect con2,localhost,root,,illegal_db' failed: 1049: Unknown database 'illegal_db' mysqltest: At line 1: Illegal argument for port: 'illegal_port' mysqltest: At line 1: Illegal option to connect: SMTP -OK -mysqltest: The test didn't produce any output +200 connects succeeded mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists show tables; ERROR 3D000: No database selected +connect con1,localhost,root,,; +connection default; +connection con1; +disconnect con1; +connection default; Output from mysqltest-x.inc Output from mysqltest-x.inc Output from mysqltest-x.inc diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index c054b163c0c..caadce44dcf 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1465,19 +1465,6 @@ eval select "$long_rep" as x; --error 1 --exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1 -# Repeat connect/disconnect ---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql -let $i=100; -while ($i) -{ - connect (test_con1,localhost,root,,); - disconnect test_con1; - dec $i; -} -EOF ---exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK; exit;" | $MYSQL_TEST 2>&1 -remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; - # Repeat connect/disconnect --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql let $i=200; @@ -1487,9 +1474,8 @@ while ($i) disconnect test_con1; dec $i; } +echo 200 connects succeeded; EOF ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---error 1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; @@ -1530,6 +1516,22 @@ show tables; disconnect con2; connection default; +# Test enable_connect_log +--enable_connect_log +connect (con1,localhost,root,,); +connection default; +connection con1; +--disable_query_log +# These should not be logged +connect (con2,localhost,root,,*NO-ONE*); +connection con2; +disconnect con2; +connection con1; +--enable_query_log +disconnect con1; +connection default; +--disable_connect_log + # ---------------------------------------------------------------------------- # Test mysqltest arguments # ---------------------------------------------------------------------------- -- cgit v1.2.1 From 9605bc63fc7fe2d2b188d992ae43d9e97360c782 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 28 Sep 2010 15:58:01 +0200 Subject: Bug #56125 MTR2 start-and-exit removes server tmpdir, server becomes not operational This happens when creating new tmpdir due to too long socket path Don't delete it if --start-and-exit, but warn user to do it. --- mysql-test/mysql-test-run.pl | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 82c62ebfcf1..f0c7a02348a 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -110,12 +110,24 @@ my $path_vardir_trace; # unix formatted opt_vardir for trace files my $opt_tmpdir; # Path to use for tmp/ dir my $opt_tmpdir_pid; +my $opt_start; +my $opt_start_dirty; +my $opt_start_exit; +my $start_only; + END { if ( defined $opt_tmpdir_pid and $opt_tmpdir_pid == $$ ) { - # Remove the tempdir this process has created - mtr_verbose("Removing tmpdir '$opt_tmpdir"); - rmtree($opt_tmpdir); + if (!$opt_start_exit) + { + # Remove the tempdir this process has created + mtr_verbose("Removing tmpdir $opt_tmpdir"); + rmtree($opt_tmpdir); + } + else + { + mtr_warning("tmpdir $opt_tmpdir should be removed after the server has finished"); + } } } @@ -215,10 +227,6 @@ my $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds sub suite_timeout { return $opt_suite_timeout * 60; }; sub check_timeout { return $opt_testcase_timeout * 6; }; -my $opt_start; -my $opt_start_dirty; -my $opt_start_exit; -my $start_only; my $opt_wait_all; my $opt_user_args; my $opt_repeat= 1; -- cgit v1.2.1 From 9ec472486608a0fb1a5ea6fa31ad8f1f2927f1c7 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 30 Sep 2010 10:28:22 +0200 Subject: Small test fix after 56753 --- mysql-test/suite/innodb/t/innodb_bug53756.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/innodb/t/innodb_bug53756.test b/mysql-test/suite/innodb/t/innodb_bug53756.test index 8324f2640a2..d3b0a77c680 100644 --- a/mysql-test/suite/innodb/t/innodb_bug53756.test +++ b/mysql-test/suite/innodb/t/innodb_bug53756.test @@ -34,8 +34,8 @@ INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44); --echo --echo # Select a less restrictive isolation level. # Don't use user variables. They won't survive server crash. ---let $global_isolation= `SELECT @@global.tx_isolation`; ---let $session_isolation= `SELECT @@session.tx_isolation`; +--let $global_isolation= `SELECT @@global.tx_isolation` +--let $session_isolation= `SELECT @@session.tx_isolation` SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; COMMIT; -- cgit v1.2.1 From be7b3c004066fba276471df861ffb6d90c88a883 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 30 Sep 2010 12:42:37 +0200 Subject: Bug #52828 Tests that use perl fail when perl is not in path Trying to run perl fails, just like it does when perl is started but fails Trap the case that perl was not found/could not be started, and skip test Also force a restart of servers since test may already have done something mtr now also appends path of current perl to PATH to aid mysqltest --- client/mysqltest.cc | 13 ++++++++++++- mysql-test/mysql-test-run.pl | 8 ++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 89ba739a9ef..7d335b7d47a 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3853,7 +3853,18 @@ void do_perl(struct st_command *command) if (!error) my_delete(temp_file_path, MYF(0)); - handle_command_error(command, WEXITSTATUS(error)); + /* Check for error code that indicates perl could not be started */ + int exstat= WEXITSTATUS(error); +#ifdef __WIN__ + if (exstat == 1) + /* Text must begin 'perl not found' as mtr looks for it */ + abort_not_supported_test("perl not found in path or did not start"); +#else + if (exstat == 127) + abort_not_supported_test("perl not found in path"); +#endif + else + handle_command_error(command, exstat); } dynstr_free(&ds_delimiter); DBUG_VOID_RETURN; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index f0c7a02348a..b83c32d3815 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2107,6 +2107,11 @@ sub environment_setup { # to detect that valgrind is being used from test cases $ENV{'VALGRIND_TEST'}= $opt_valgrind; + # Add dir of this perl to aid mysqltest in finding perl + my $perldir= dirname($^X); + my $pathsep= ":"; + $pathsep= ";" if IS_WINDOWS && ! IS_CYGWIN; + $ENV{'PATH'}= "$ENV{'PATH'}".$pathsep.$perldir; } @@ -3583,6 +3588,9 @@ sub run_testcase ($) { # Try to get reason from test log file find_testcase_skipped_reason($tinfo); mtr_report_test_skipped($tinfo); + # Restart if skipped due to missing perl, it may have had side effects + stop_all_servers($opt_shutdown_timeout) + if ($tinfo->{'comment'} =~ /^perl not found/); } elsif ( $res == 65 ) { -- cgit v1.2.1 From abaa5c91b4307750aeac4582753f2f4131cf4f6f Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 1 Oct 2010 11:00:18 +0200 Subject: Bug #20304 mysqltest: reap with no preceding statement hangs forever Added sanity check, similar to the one preventing send without reap --- client/mysqltest.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 7d335b7d47a..53c1f1bdf85 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7370,6 +7370,9 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) if (cn->pending && (flags & QUERY_SEND_FLAG)) die ("Cannot run query on connection between send and reap"); + if (!(flags & QUERY_SEND_FLAG) && !cn->pending) + die ("Cannot reap on a connection without pending send"); + init_dynamic_string(&ds_warnings, NULL, 0, 256); /* Evaluate query if this is an eval command -- cgit v1.2.1