summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2005-09-20 14:11:58 +0200
committerunknown <msvensson@neptunus.(none)>2005-09-20 14:11:58 +0200
commit0aee9b2c19b52be26e9a0dc67ae178ccfa70db35 (patch)
tree30ceb7fd83e298b75ba1c741948bc074329fc087
parent6bec4bc605961b7c8066a8d8e594dc60aabd5e75 (diff)
downloadmariadb-git-0aee9b2c19b52be26e9a0dc67ae178ccfa70db35.tar.gz
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
-rw-r--r--client/mysqltest.c24
-rwxr-xr-xmysql-test/mysql-test-run.pl19
-rw-r--r--mysql-test/r/mysqltest.result4
-rw-r--r--mysql-test/t/mysqltest.test10
4 files changed, 37 insertions, 20 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 1e04b41f35c..6963ff2f99e 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -1062,8 +1062,8 @@ static void do_exec(struct st_query *query)
(query->expected_errno[i].code.errnum == status))
{
ok= 1;
- verbose_msg("command \"%s\" failed with expected error: %d",
- cmd, status);
+ DBUG_PRINT("info", ("command \"%s\" failed with expected error: %d",
+ cmd, status));
}
}
if (!ok)
@@ -2557,7 +2557,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
fn_format(buff, argument, "", "", 4);
DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0);
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);
cur_file->file_name= my_strdup(buff, MYF(MY_FAE));
break;
@@ -2663,7 +2663,7 @@ void str_to_file(const char *fname, char *str, int size)
fname=buff;
}
fn_format(buff,fname,"","",4);
-
+
if ((fd = my_open(buff, O_WRONLY | O_CREAT | O_TRUNC,
MYF(MY_WME | MY_FFNF))) < 0)
die("Could not open %s: errno = %d", buff, errno);
@@ -4043,12 +4043,20 @@ int main(int argc, char **argv)
parser.current_line += current_line_inc;
}
- if (result_file && ds_res.length && !error)
+ if (ds_res.length && !error)
{
- if (!record)
- error |= check_result(&ds_res, result_file, q->require_file);
+ if (result_file)
+ {
+ if (!record)
+ error |= check_result(&ds_res, result_file, q->require_file);
+ else
+ str_to_file(result_file, ds_res.str, ds_res.length);
+ }
else
- str_to_file(result_file, ds_res.str, ds_res.length);
+ {
+ // Print the result to stdout
+ printf("%s", ds_res.str);
+ }
}
dynstr_free(&ds_res);
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 013b8d49967..eed80b1e339 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2155,11 +2155,6 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--big-test");
}
- if ( $opt_record )
- {
- mtr_add_arg($args, "--record");
- }
-
if ( $opt_compress )
{
mtr_add_arg($args, "--compress");
@@ -2185,8 +2180,6 @@ sub run_mysqltest ($) {
$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
@@ -2202,6 +2195,18 @@ sub run_mysqltest ($) {
# ----------------------------------------------------------------------
$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,"");
}
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 2277fe1b5ed..0e3d3812781 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -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: End of line junk detected: "!"
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;
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;
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index fc9f621f7cd..7ed204fc6d3 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -810,11 +810,11 @@ select "a" as col1, "c" as col2;
# ----------------------------------------------------------------------------
# -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 -x $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1
-#--exec $MYSQL_TEST --result_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1
-#--error 1
-#--exec $MYSQL_TEST -x non_existing_file.inc 2>&1
+--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc
+--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc
+--exec $MYSQL_TEST --test_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc
+--error 1
+--exec $MYSQL_TEST -x non_existing_file.inc 2>&1
# ----------------------------------------------------------------------------