Commit 0aee9b2c authored by unknown's avatar unknown

BUG#12959 mysqltest crashes if testcase passed with -x option

 - Enable testcases after help from Serg 


client/mysqltest.c:
  Dump output to stdout if no result file is specified
  Don't print verbose_msg when command fails whith expected error
mysql-test/mysql-test-run.pl:
  Don't add all args to the MYSQL_TEST environment variable.
mysql-test/r/mysqltest.result:
  Add test for mysqltest -x
mysql-test/t/mysqltest.test:
  Add test for mysqltest -x
parent 6bec4bc6
...@@ -1062,8 +1062,8 @@ static void do_exec(struct st_query *query) ...@@ -1062,8 +1062,8 @@ static void do_exec(struct st_query *query)
(query->expected_errno[i].code.errnum == status)) (query->expected_errno[i].code.errnum == status))
{ {
ok= 1; ok= 1;
verbose_msg("command \"%s\" failed with expected error: %d", DBUG_PRINT("info", ("command \"%s\" failed with expected error: %d",
cmd, status); cmd, status));
} }
} }
if (!ok) if (!ok)
...@@ -2557,7 +2557,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -2557,7 +2557,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
fn_format(buff, argument, "", "", 4); fn_format(buff, argument, "", "", 4);
DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0); DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0);
if (!(cur_file->file= if (!(cur_file->file=
my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME)))) my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0))))
die("Could not open %s: errno = %d", buff, errno); die("Could not open %s: errno = %d", buff, errno);
cur_file->file_name= my_strdup(buff, MYF(MY_FAE)); cur_file->file_name= my_strdup(buff, MYF(MY_FAE));
break; break;
...@@ -4043,13 +4043,21 @@ int main(int argc, char **argv) ...@@ -4043,13 +4043,21 @@ int main(int argc, char **argv)
parser.current_line += current_line_inc; parser.current_line += current_line_inc;
} }
if (result_file && ds_res.length && !error) if (ds_res.length && !error)
{
if (result_file)
{ {
if (!record) if (!record)
error |= check_result(&ds_res, result_file, q->require_file); error |= check_result(&ds_res, result_file, q->require_file);
else else
str_to_file(result_file, ds_res.str, ds_res.length); str_to_file(result_file, ds_res.str, ds_res.length);
} }
else
{
// Print the result to stdout
printf("%s", ds_res.str);
}
}
dynstr_free(&ds_res); dynstr_free(&ds_res);
if (!silent) if (!silent)
......
...@@ -2155,11 +2155,6 @@ sub run_mysqltest ($) { ...@@ -2155,11 +2155,6 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--big-test"); mtr_add_arg($args, "--big-test");
} }
if ( $opt_record )
{
mtr_add_arg($args, "--record");
}
if ( $opt_compress ) if ( $opt_compress )
{ {
mtr_add_arg($args, "--compress"); mtr_add_arg($args, "--compress");
...@@ -2185,8 +2180,6 @@ sub run_mysqltest ($) { ...@@ -2185,8 +2180,6 @@ sub run_mysqltest ($) {
$glob_mysql_test_dir); $glob_mysql_test_dir);
} }
mtr_add_arg($args, "-R");
mtr_add_arg($args, $tinfo->{'result_file'});
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# If embedded server, we create server args to give mysqltest to pass on # If embedded server, we create server args to give mysqltest to pass on
...@@ -2202,6 +2195,18 @@ sub run_mysqltest ($) { ...@@ -2202,6 +2195,18 @@ sub run_mysqltest ($) {
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
$ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args); $ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args);
# ----------------------------------------------------------------------
# Add arguments that should not go into the MYSQL_TEST env var
# ----------------------------------------------------------------------
mtr_add_arg($args, "-R");
mtr_add_arg($args, $tinfo->{'result_file'});
if ( $opt_record )
{
mtr_add_arg($args, "--record");
}
return mtr_run_test($exe,$args,$tinfo->{'path'},"",$path_timefile,""); return mtr_run_test($exe,$args,$tinfo->{'path'},"",$path_timefile,"");
} }
......
...@@ -345,6 +345,10 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 ...@@ -345,6 +345,10 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1
mysqltest: At line 1: Invalid integer argument "10!" mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: End of line junk detected: "!" mysqltest: At line 1: End of line junk detected: "!"
mysqltest: At line 1: Invalid integer argument "a" mysqltest: At line 1: Invalid integer argument "a"
Output from mysqltest-x.inc
Output from mysqltest-x.inc
Output from mysqltest-x.inc
mysqltest: Could not open ./non_existing_file.inc: errno = 2
failing_statement; failing_statement;
ERROR 42000: 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_statement' at line 1 ERROR 42000: 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_statement' at line 1
failing_statement; failing_statement;
......
...@@ -810,11 +810,11 @@ select "a" as col1, "c" as col2; ...@@ -810,11 +810,11 @@ select "a" as col1, "c" as col2;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# -x <file_name>, use the file specified after -x as the test file # -x <file_name>, use the file specified after -x as the test file
#--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1 --exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc
#--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1 --exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc
#--exec $MYSQL_TEST --result_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1 --exec $MYSQL_TEST --test_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc
#--error 1 --error 1
#--exec $MYSQL_TEST -x non_existing_file.inc 2>&1 --exec $MYSQL_TEST -x non_existing_file.inc 2>&1
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment