Commit e7a29acf authored by Bjorn Munch's avatar Bjorn Munch

merge from 5.5-mtr

parents d740bd50 5a95f0ae
...@@ -1169,8 +1169,8 @@ void handle_command_error(struct st_command *command, uint error) ...@@ -1169,8 +1169,8 @@ void handle_command_error(struct st_command *command, uint error)
int i; int i;
if (command->abort_on_error) if (command->abort_on_error)
die("command \"%.*s\" failed with error %d", die("command \"%.*s\" failed with error %d. my_errno=%d",
command->first_word_len, command->query, error); command->first_word_len, command->query, error, my_errno);
i= match_expected_error(command, error, NULL); i= match_expected_error(command, error, NULL);
...@@ -1181,8 +1181,8 @@ void handle_command_error(struct st_command *command, uint error) ...@@ -1181,8 +1181,8 @@ void handle_command_error(struct st_command *command, uint error)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
if (command->expected_errors.count > 0) if (command->expected_errors.count > 0)
die("command \"%.*s\" failed with wrong error: %d", die("command \"%.*s\" failed with wrong error: %d. my_errno=%d",
command->first_word_len, command->query, error); command->first_word_len, command->query, error, my_errno);
} }
else if (command->expected_errors.err[0].type == ERR_ERRNO && else if (command->expected_errors.err[0].type == ERR_ERRNO &&
command->expected_errors.err[0].code.errnum != 0) command->expected_errors.err[0].code.errnum != 0)
...@@ -2073,9 +2073,11 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val, ...@@ -2073,9 +2073,11 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val,
name_len = strlen(name); name_len = strlen(name);
if (!val_len && val) if (!val_len && val)
val_len = strlen(val) ; val_len = strlen(val) ;
if (!val)
val_len= 0;
val_alloc_len = val_len + 16; /* room to grow */ val_alloc_len = val_len + 16; /* room to grow */
if (!(tmp_var=v) && !(tmp_var = (VAR*)my_malloc(sizeof(*tmp_var) if (!(tmp_var=v) && !(tmp_var = (VAR*)my_malloc(sizeof(*tmp_var)
+ name_len+1, MYF(MY_WME)))) + name_len+2, MYF(MY_WME))))
die("Out of memory"); die("Out of memory");
if (name != NULL) if (name != NULL)
...@@ -2093,10 +2095,9 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val, ...@@ -2093,10 +2095,9 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val,
die("Out of memory"); die("Out of memory");
if (val) if (val)
{
memcpy(tmp_var->str_val, val, val_len); memcpy(tmp_var->str_val, val, val_len);
tmp_var->str_val[val_len]= 0; tmp_var->str_val[val_len]= 0;
}
var_check_int(tmp_var); var_check_int(tmp_var);
tmp_var->name_len = name_len; tmp_var->name_len = name_len;
tmp_var->str_val_len = val_len; tmp_var->str_val_len = val_len;
...@@ -5053,6 +5054,7 @@ void do_close_connection(struct st_command *command) ...@@ -5053,6 +5054,7 @@ void do_close_connection(struct st_command *command)
dynstr_append_mem(ds, ";\n", 2); dynstr_append_mem(ds, ";\n", 2);
} }
dynstr_free(&ds_connection);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -5487,6 +5489,7 @@ void do_connect(struct st_command *command) ...@@ -5487,6 +5489,7 @@ void do_connect(struct st_command *command)
dynstr_free(&ds_port); dynstr_free(&ds_port);
dynstr_free(&ds_sock); dynstr_free(&ds_sock);
dynstr_free(&ds_options); dynstr_free(&ds_options);
dynstr_free(&ds_default_auth);
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
dynstr_free(&ds_shm); dynstr_free(&ds_shm);
#endif #endif
...@@ -5683,6 +5686,8 @@ void do_block(enum block_cmd cmd, struct st_command* command) ...@@ -5683,6 +5686,8 @@ void do_block(enum block_cmd cmd, struct st_command* command)
} }
while (my_isspace(charset_info, *curr_ptr)) while (my_isspace(charset_info, *curr_ptr))
curr_ptr++; curr_ptr++;
if (curr_ptr == expr_end)
die("Missing right operand in comparison");
/* Strip off trailing white space */ /* Strip off trailing white space */
while (my_isspace(charset_info, expr_end[-1])) while (my_isspace(charset_info, expr_end[-1]))
...@@ -5737,6 +5742,7 @@ void do_block(enum block_cmd cmd, struct st_command* command) ...@@ -5737,6 +5742,7 @@ void do_block(enum block_cmd cmd, struct st_command* command)
} }
v.is_int= TRUE; v.is_int= TRUE;
var_free(&v2);
} else } else
{ {
if (*expr_start != '`' && ! my_isdigit(charset_info, *expr_start)) if (*expr_start != '`' && ! my_isdigit(charset_info, *expr_start))
...@@ -7830,7 +7836,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) ...@@ -7830,7 +7836,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
ds, &ds_warnings); ds, &ds_warnings);
dynstr_free(&ds_warnings); dynstr_free(&ds_warnings);
if (command->type == Q_EVAL) if (command->type == Q_EVAL || command->type == Q_SEND_EVAL)
dynstr_free(&eval_query); dynstr_free(&eval_query);
if (display_result_sorted) if (display_result_sorted)
...@@ -7936,6 +7942,16 @@ void init_re(void) ...@@ -7936,6 +7942,16 @@ void init_re(void)
int match_re(my_regex_t *re, char *str) int match_re(my_regex_t *re, char *str)
{ {
while (my_isspace(charset_info, *str))
str++;
if (str[0] == '/' && str[1] == '*')
{
char *comm_end= strstr (str, "*/");
if (! comm_end)
die("Statement is unterminated comment");
str= comm_end + 2;
}
int err= my_regexec(re, str, (size_t)0, NULL, 0); int err= my_regexec(re, str, (size_t)0, NULL, 0);
if (err == 0) if (err == 0)
......
...@@ -191,6 +191,8 @@ my $opt_cursor_protocol; ...@@ -191,6 +191,8 @@ my $opt_cursor_protocol;
my $opt_view_protocol; my $opt_view_protocol;
our $opt_debug; our $opt_debug;
my $debug_d= "d";
my $opt_debug_common;
our @opt_cases; # The test cases names in argv our @opt_cases; # The test cases names in argv
our $opt_embedded_server; our $opt_embedded_server;
...@@ -911,7 +913,7 @@ sub command_line_setup { ...@@ -911,7 +913,7 @@ sub command_line_setup {
my $opt_list_options; my $opt_list_options;
# Read the command line options # Read the command line options
# Note: Keep list, and the order, in sync with usage at end of this file # Note: Keep list in sync with usage at end of this file
Getopt::Long::Configure("pass_through"); Getopt::Long::Configure("pass_through");
my %options=( my %options=(
# Control what engine/variation to run # Control what engine/variation to run
...@@ -947,6 +949,7 @@ sub command_line_setup { ...@@ -947,6 +949,7 @@ sub command_line_setup {
'combination=s' => \@opt_combinations, 'combination=s' => \@opt_combinations,
'skip-combinations' => \&collect_option, 'skip-combinations' => \&collect_option,
'experimental=s' => \@opt_experimentals, 'experimental=s' => \@opt_experimentals,
# skip-im is deprecated and silently ignored
'skip-im' => \&ignore_option, 'skip-im' => \&ignore_option,
# Specify ports # Specify ports
...@@ -966,6 +969,7 @@ sub command_line_setup { ...@@ -966,6 +969,7 @@ sub command_line_setup {
# Debugging # Debugging
'debug' => \$opt_debug, 'debug' => \$opt_debug,
'debug-common' => \$opt_debug_common,
'gdb' => \$opt_gdb, 'gdb' => \$opt_gdb,
'client-gdb' => \$opt_client_gdb, 'client-gdb' => \$opt_client_gdb,
'manual-gdb' => \$opt_manual_gdb, 'manual-gdb' => \$opt_manual_gdb,
...@@ -1042,7 +1046,8 @@ sub command_line_setup { ...@@ -1042,7 +1046,8 @@ sub command_line_setup {
'report-times' => \$opt_report_times, 'report-times' => \$opt_report_times,
'help|h' => \$opt_usage, 'help|h' => \$opt_usage,
'list-options' => \$opt_list_options, # list-options is internal, not listed in help
'list-options' => \$opt_list_options,
'skip-test-list=s' => \@opt_skip_test_list 'skip-test-list=s' => \@opt_skip_test_list
); );
...@@ -1555,6 +1560,18 @@ sub command_line_setup { ...@@ -1555,6 +1560,18 @@ sub command_line_setup {
join(" ", @valgrind_args), "\""); join(" ", @valgrind_args), "\"");
} }
if ($opt_debug_common)
{
$opt_debug= 1;
$debug_d= "d,query,info,error,enter,exit";
}
if ($opt_debug && $opt_debug ne "1")
{
$debug_d= "d,$opt_debug";
$debug_d= "d,query,info,error,enter,exit" if $opt_debug eq "std";
}
mtr_report("Checking supported features..."); mtr_report("Checking supported features...");
check_ndbcluster_support(\%mysqld_variables); check_ndbcluster_support(\%mysqld_variables);
...@@ -1852,7 +1869,7 @@ sub client_debug_arg($$) { ...@@ -1852,7 +1869,7 @@ sub client_debug_arg($$) {
if ( $opt_debug ) { if ( $opt_debug ) {
mtr_add_arg($args, mtr_add_arg($args,
"--debug=d:t:A,%s/log/%s.trace", "--debug=$debug_d:t:A,%s/log/%s.trace",
$path_vardir_trace, $client_name) $path_vardir_trace, $client_name)
} }
} }
...@@ -3023,13 +3040,19 @@ sub mysql_install_db { ...@@ -3023,13 +3040,19 @@ sub mysql_install_db {
if ( $opt_debug ) if ( $opt_debug )
{ {
mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap.trace", mtr_add_arg($args, "--debug=$debug_d:t:i:A,%s/log/bootstrap.trace",
$path_vardir_trace); $path_vardir_trace);
} }
mtr_add_arg($args, "--lc-messages-dir=%s", $install_lang); mtr_add_arg($args, "--lc-messages-dir=%s", $install_lang);
mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir); mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir);
# On some old linux kernels, aio on tmpfs is not supported
# Remove this if/when Bug #58421 fixes this in the server
if ($^O eq "linux" && $opt_mem) {
mtr_add_arg($args, "--loose-skip-innodb-use-native-aio");
}
# InnoDB arguments that affect file location and sizes may # InnoDB arguments that affect file location and sizes may
# need to be given to the bootstrap process as well as the # need to be given to the bootstrap process as well as the
# server process. # server process.
...@@ -4521,6 +4544,13 @@ sub mysqld_arguments ($$$) { ...@@ -4521,6 +4544,13 @@ sub mysqld_arguments ($$$) {
} }
} }
# On some old linux kernels, aio on tmpfs is not supported
# Remove this if/when Bug #58421 fixes this in the server
if ($^O eq "linux" && $opt_mem)
{
mtr_add_arg($args, "--loose-skip-innodb-use-native-aio");
}
if ( $mysql_version_id >= 50106 && !$opt_user_args) if ( $mysql_version_id >= 50106 && !$opt_user_args)
{ {
# Turn on logging to file # Turn on logging to file
...@@ -4613,7 +4643,7 @@ sub mysqld_start ($$) { ...@@ -4613,7 +4643,7 @@ sub mysqld_start ($$) {
if ( $opt_debug ) if ( $opt_debug )
{ {
mtr_add_arg($args, "--debug=d:t:i:A,%s/log/%s.trace", mtr_add_arg($args, "--debug=$debug_d:t:i:A,%s/log/%s.trace",
$path_vardir_trace, $mysqld->name()); $path_vardir_trace, $mysqld->name());
} }
...@@ -5627,7 +5657,7 @@ Options to control what engine/variation to run ...@@ -5627,7 +5657,7 @@ Options to control what engine/variation to run
defaults-file=<config template> Use fixed config template for all defaults-file=<config template> Use fixed config template for all
tests tests
defaults_extra_file=<config template> Extra config template to add to defaults-extra-file=<config template> Extra config template to add to
all generated configs all generated configs
combination=<opt> Use at least twice to run tests with specified combination=<opt> Use at least twice to run tests with specified
options to mysqld options to mysqld
...@@ -5715,6 +5745,8 @@ Options for debugging the product ...@@ -5715,6 +5745,8 @@ Options for debugging the product
client-gdb Start mysqltest client in gdb client-gdb Start mysqltest client in gdb
ddd Start mysqld in ddd ddd Start mysqld in ddd
debug Dump trace output for all servers and client programs debug Dump trace output for all servers and client programs
debug-common Same as debug, but sets 'd' debug flags to
"query,info,error,enter,exit"
debugger=NAME Start mysqld in the selected debugger debugger=NAME Start mysqld in the selected debugger
gdb Start the mysqld(s) in gdb gdb Start the mysqld(s) in gdb
manual-debug Let user manually start mysqld in debugger, before manual-debug Let user manually start mysqld in debugger, before
...@@ -5723,7 +5755,7 @@ Options for debugging the product ...@@ -5723,7 +5755,7 @@ Options for debugging the product
test(s) test(s)
manual-ddd Let user manually start mysqld in ddd, before running manual-ddd Let user manually start mysqld in ddd, before running
test(s) test(s)
strace-client=[path] Create strace output for mysqltest client, optionally strace-client[=path] Create strace output for mysqltest client, optionally
specifying name and path to the trace program to use. specifying name and path to the trace program to use.
Example: $0 --strace-client=ktrace Example: $0 --strace-client=ktrace
max-save-core Limit the number of core files saved (to avoid filling max-save-core Limit the number of core files saved (to avoid filling
...@@ -5756,7 +5788,7 @@ Options for valgrind ...@@ -5756,7 +5788,7 @@ Options for valgrind
Misc options Misc options
user=USER User for connecting to mysqld(default: $opt_user) user=USER User for connecting to mysqld(default: $opt_user)
comment=STR Write STR to the output comment=STR Write STR to the output
notimer Don't show test case execution time timer Show test case execution time.
verbose More verbose output(use multiple times for even more) verbose More verbose output(use multiple times for even more)
verbose-restart Write when and why servers are restarted verbose-restart Write when and why servers are restarted
start Only initialize and start the servers, using the start Only initialize and start the servers, using the
...@@ -5796,6 +5828,7 @@ Misc options ...@@ -5796,6 +5828,7 @@ Misc options
actions. Disable facility with NUM=0. actions. Disable facility with NUM=0.
gcov Collect coverage information after the test. gcov Collect coverage information after the test.
The result is a gcov file per source and header file. The result is a gcov file per source and header file.
gprof Collect profiling information using gprof.
experimental=<file> Refer to list of tests considered experimental; experimental=<file> Refer to list of tests considered experimental;
failures will be marked exp-fail instead of fail. failures will be marked exp-fail instead of fail.
report-features First run a "test" that reports mysql features report-features First run a "test" that reports mysql features
...@@ -5808,6 +5841,11 @@ Misc options ...@@ -5808,6 +5841,11 @@ Misc options
engine to InnoDB. engine to InnoDB.
report-times Report how much time has been spent on different report-times Report how much time has been spent on different
phases of test execution. phases of test execution.
Some options that control enabling a feature for normal test runs,
can be turned off by prepending 'no' to the option, e.g. --notimer.
This applies to reorder, timer, check-testcases and warnings.
HERE HERE
exit(1); exit(1);
......
...@@ -434,6 +434,8 @@ anything goes ...@@ -434,6 +434,8 @@ anything goes
mysqltest: At line 2: Only == and != are supported for string values 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: Found junk '~= 6' after $variable in condition
mysqltest: At line 2: Expression in if/while must beging with $, ` or a number mysqltest: At line 2: Expression in if/while must beging with $, ` or a number
mysqltest: At line 1: Missing right operand in comparison
mysqltest: At line 1: Missing right operand in comparison
counter is 2 counter is 2
counter is 3 counter is 3
counter is 4 counter is 4
...@@ -623,7 +625,7 @@ if things work as expected ...@@ -623,7 +625,7 @@ if things work as expected
Some data Some data
for cat_file command for cat_file command
of mysqltest of mysqltest
mysqltest: At line 1: command "cat_file" failed with error 1 mysqltest: At line 1: command "cat_file" failed with error 1. (my_errno)
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists' mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file' mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file' mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
......
...@@ -1354,6 +1354,11 @@ EOF ...@@ -1354,6 +1354,11 @@ EOF
--exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1 --exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1
remove_file $MYSQL_TMP_DIR/mysqltest.sql; remove_file $MYSQL_TMP_DIR/mysqltest.sql;
--error 1
--exec echo "if (\$var ==) {" | $MYSQL_TEST 2>&1
--error 1
--exec echo "if (\$var > ) {" | $MYSQL_TEST 2>&1
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test while with compare conditions # Test while with compare conditions
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -2125,6 +2130,7 @@ EOF ...@@ -2125,6 +2130,7 @@ EOF
cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
--replace_regex /my_errno=[0-9]*/(my_errno)/
--error 1 --error 1
--exec echo "cat_file non_existing_file;" | $MYSQL_TEST 2>&1 --exec echo "cat_file non_existing_file;" | $MYSQL_TEST 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