Commit 9cc04425 authored by Tor Didriksen's avatar Tor Didriksen

local merge

parents 0b706e54 3952f6bf
...@@ -118,6 +118,41 @@ static char **default_argv; ...@@ -118,6 +118,41 @@ static char **default_argv;
static const char *load_default_groups[]= { "mysqltest", "client", 0 }; static const char *load_default_groups[]= { "mysqltest", "client", 0 };
static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer; static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer;
/* Info on properties that can be set with --enable_X and --disable_X */
struct property {
my_bool *var; /* Actual variable */
my_bool set; /* Has been set for ONE command */
my_bool old; /* If set, thus is the old value */
my_bool reverse; /* Varible is true if disabled */
const char *env_name; /* Env. variable name */
};
static struct property prop_list[] = {
{ &abort_on_error, 0, 1, 0, "$ENABLED_ABORT_ON_ERROR" },
{ &disable_connect_log, 0, 1, 1, "$ENABLED_CONNECT_LOG" },
{ &disable_info, 0, 1, 1, "$ENABLED_INFO" },
{ &display_metadata, 0, 0, 0, "$ENABLED_METADATA" },
{ &ps_protocol_enabled, 0, 0, 0, "$ENABLED_PS_PROTOCOL" },
{ &disable_query_log, 0, 0, 1, "$ENABLED_QUERY_LOG" },
{ &disable_result_log, 0, 0, 1, "$ENABLED_RESULT_LOG" },
{ &disable_warnings, 0, 0, 1, "$ENABLED_WARNINGS" }
};
static my_bool once_property= FALSE;
enum enum_prop {
P_ABORT= 0,
P_CONNECT,
P_INFO,
P_META,
P_PS,
P_QUERY,
P_RESULT,
P_WARN,
P_MAX
};
static uint start_lineno= 0; /* Start line of current command */ static uint start_lineno= 0; /* Start line of current command */
static uint my_end_arg= 0; static uint my_end_arg= 0;
...@@ -463,6 +498,7 @@ TYPELIB command_typelib= {array_elements(command_names),"", ...@@ -463,6 +498,7 @@ TYPELIB command_typelib= {array_elements(command_names),"",
DYNAMIC_STRING ds_res; DYNAMIC_STRING ds_res;
/* Points to ds_warning in run_query, so it can be freed */ /* Points to ds_warning in run_query, so it can be freed */
DYNAMIC_STRING *ds_warn= 0; DYNAMIC_STRING *ds_warn= 0;
struct st_command *curr_command= 0;
char builtin_echo[FN_REFLEN]; char builtin_echo[FN_REFLEN];
...@@ -712,6 +748,7 @@ void handle_error(struct st_command*, ...@@ -712,6 +748,7 @@ void handle_error(struct st_command*,
unsigned int err_errno, const char *err_error, unsigned int err_errno, const char *err_error,
const char *err_sqlstate, DYNAMIC_STRING *ds); const char *err_sqlstate, DYNAMIC_STRING *ds);
void handle_no_error(struct st_command*); void handle_no_error(struct st_command*);
void revert_properties();
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
...@@ -1174,6 +1211,7 @@ void handle_command_error(struct st_command *command, uint error) ...@@ -1174,6 +1211,7 @@ void handle_command_error(struct st_command *command, uint error)
{ {
DBUG_PRINT("info", ("command \"%.*s\" failed with expected error: %d", DBUG_PRINT("info", ("command \"%.*s\" failed with expected error: %d",
command->first_word_len, command->query, error)); command->first_word_len, command->query, error));
revert_properties();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
if (command->expected_errors.count > 0) if (command->expected_errors.count > 0)
...@@ -1188,6 +1226,7 @@ void handle_command_error(struct st_command *command, uint error) ...@@ -1188,6 +1226,7 @@ void handle_command_error(struct st_command *command, uint error)
command->first_word_len, command->query, command->first_word_len, command->query,
command->expected_errors.err[0].code.errnum); command->expected_errors.err[0].code.errnum);
} }
revert_properties();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -2267,6 +2306,50 @@ void var_set_errno(int sql_errno) ...@@ -2267,6 +2306,50 @@ void var_set_errno(int sql_errno)
var_set_string("$mysql_errname", get_errname_from_code(sql_errno)); var_set_string("$mysql_errname", get_errname_from_code(sql_errno));
} }
/* Functions to handle --disable and --enable properties */
void set_once_property(enum_prop prop, my_bool val)
{
property &pr= prop_list[prop];
pr.set= 1;
pr.old= *pr.var;
*pr.var= val;
var_set_int(pr.env_name, (val != pr.reverse));
once_property= TRUE;
}
void set_property(st_command *command, enum_prop prop, my_bool val)
{
char* p= command->first_argument;
if (p && !strcmp (p, "ONCE"))
{
command->last_argument= p + 4;
set_once_property(prop, val);
return;
}
property &pr= prop_list[prop];
*pr.var= val;
pr.set= 0;
var_set_int(pr.env_name, (val != pr.reverse));
}
void revert_properties()
{
if (! once_property)
return;
for (int i= 0; i < (int) P_MAX; i++)
{
property &pr= prop_list[i];
if (pr.set)
{
*pr.var= pr.old;
pr.set= 0;
var_set_int(pr.env_name, (pr.old != pr.reverse));
}
}
once_property=FALSE;
}
/* /*
Set variable from the result of a query Set variable from the result of a query
...@@ -2318,9 +2401,16 @@ void var_query_set(VAR *var, const char *query, const char** query_end) ...@@ -2318,9 +2401,16 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
init_dynamic_string(&ds_query, 0, (end - query) + 32, 256); init_dynamic_string(&ds_query, 0, (end - query) + 32, 256);
do_eval(&ds_query, query, end, FALSE); do_eval(&ds_query, query, end, FALSE);
if (mysql_real_query(mysql, ds_query.str, ds_query.length)) if (mysql_real_query(mysql, ds_query.str, ds_query.length))
die("Error running query '%s': %d %s", ds_query.str, {
mysql_errno(mysql), mysql_error(mysql)); handle_error (curr_command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), &ds_res);
/* If error was acceptable, return empty string */
dynstr_free(&ds_query);
eval_expr(var, "", 0);
DBUG_VOID_RETURN;
}
if (!(res= mysql_store_result(mysql))) if (!(res= mysql_store_result(mysql)))
die("Query '%s' didn't return a result set", ds_query.str); die("Query '%s' didn't return a result set", ds_query.str);
dynstr_free(&ds_query); dynstr_free(&ds_query);
...@@ -2474,8 +2564,15 @@ void var_set_query_get_value(struct st_command *command, VAR *var) ...@@ -2474,8 +2564,15 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
/* Run the query */ /* Run the query */
if (mysql_real_query(mysql, ds_query.str, ds_query.length)) if (mysql_real_query(mysql, ds_query.str, ds_query.length))
die("Error running query '%s': %d %s", ds_query.str, {
mysql_errno(mysql), mysql_error(mysql)); handle_error (curr_command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), &ds_res);
/* If error was acceptable, return empty string */
dynstr_free(&ds_query);
eval_expr(var, "", 0);
DBUG_VOID_RETURN;
}
if (!(res= mysql_store_result(mysql))) if (!(res= mysql_store_result(mysql)))
die("Query '%s' didn't return a result set", ds_query.str); die("Query '%s' didn't return a result set", ds_query.str);
...@@ -4426,6 +4523,7 @@ void do_let(struct st_command *command) ...@@ -4426,6 +4523,7 @@ void do_let(struct st_command *command)
var_set(var_name, var_name_end, let_rhs_expr.str, var_set(var_name, var_name_end, let_rhs_expr.str,
(let_rhs_expr.str + let_rhs_expr.length)); (let_rhs_expr.str + let_rhs_expr.length));
dynstr_free(&let_rhs_expr); dynstr_free(&let_rhs_expr);
revert_properties();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -7354,6 +7452,7 @@ void handle_error(struct st_command *command, ...@@ -7354,6 +7452,7 @@ void handle_error(struct st_command *command,
dynstr_append(ds,"Got one of the listed errors\n"); dynstr_append(ds,"Got one of the listed errors\n");
} }
/* OK */ /* OK */
revert_properties();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -7381,6 +7480,7 @@ void handle_error(struct st_command *command, ...@@ -7381,6 +7480,7 @@ void handle_error(struct st_command *command,
command->expected_errors.err[0].code.sqlstate); command->expected_errors.err[0].code.sqlstate);
} }
revert_properties();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -7415,6 +7515,7 @@ void handle_no_error(struct st_command *command) ...@@ -7415,6 +7515,7 @@ void handle_no_error(struct st_command *command)
command->query, command->expected_errors.err[0].code.sqlstate); command->query, command->expected_errors.err[0].code.sqlstate);
} }
revert_properties();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -7445,6 +7546,9 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command, ...@@ -7445,6 +7546,9 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
DBUG_ENTER("run_query_stmt"); DBUG_ENTER("run_query_stmt");
DBUG_PRINT("query", ("'%-.60s'", query)); DBUG_PRINT("query", ("'%-.60s'", query));
/* Remember disable_result_log since handle_no_error() may reset it */
my_bool dis_res= disable_result_log;
/* /*
Init a new stmt if it's not already one created for this connection Init a new stmt if it's not already one created for this connection
*/ */
...@@ -7540,7 +7644,7 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command, ...@@ -7540,7 +7644,7 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
/* If we got here the statement was both executed and read successfully */ /* If we got here the statement was both executed and read successfully */
handle_no_error(command); handle_no_error(command);
if (!disable_result_log) if (!dis_res)
{ {
/* /*
Not all statements creates a result set. If there is one we can Not all statements creates a result set. If there is one we can
...@@ -8466,6 +8570,8 @@ int main(int argc, char **argv) ...@@ -8466,6 +8570,8 @@ int main(int argc, char **argv)
{ {
command->last_argument= command->first_argument; command->last_argument= command->first_argument;
processed = 1; processed = 1;
/* Need to remember this for handle_error() */
curr_command= command;
switch (command->type) { switch (command->type) {
case Q_CONNECT: case Q_CONNECT:
do_connect(command); do_connect(command);
...@@ -8475,60 +8581,46 @@ int main(int argc, char **argv) ...@@ -8475,60 +8581,46 @@ int main(int argc, char **argv)
case Q_DIRTY_CLOSE: case Q_DIRTY_CLOSE:
do_close_connection(command); break; do_close_connection(command); break;
case Q_ENABLE_QUERY_LOG: case Q_ENABLE_QUERY_LOG:
disable_query_log= 0; set_property(command, P_QUERY, 0);
var_set_int("$ENABLED_QUERY_LOG", 1);
break; break;
case Q_DISABLE_QUERY_LOG: case Q_DISABLE_QUERY_LOG:
disable_query_log= 1; set_property(command, P_QUERY, 1);
var_set_int("$ENABLED_QUERY_LOG", 0);
break; break;
case Q_ENABLE_ABORT_ON_ERROR: case Q_ENABLE_ABORT_ON_ERROR:
abort_on_error= 1; set_property(command, P_ABORT, 1);
var_set_int("$ENABLED_ABORT_ON_ERROR", 1);
break; break;
case Q_DISABLE_ABORT_ON_ERROR: case Q_DISABLE_ABORT_ON_ERROR:
abort_on_error= 0; set_property(command, P_ABORT, 0);
var_set_int("$ENABLED_ABORT_ON_ERROR", 0);
break; break;
case Q_ENABLE_RESULT_LOG: case Q_ENABLE_RESULT_LOG:
disable_result_log= 0; set_property(command, P_RESULT, 0);
var_set_int("$ENABLED_RESULT_LOG", 1);
break; break;
case Q_DISABLE_RESULT_LOG: case Q_DISABLE_RESULT_LOG:
disable_result_log=1; set_property(command, P_RESULT, 1);
var_set_int("$ENABLED_RESULT_LOG", 0);
break; break;
case Q_ENABLE_CONNECT_LOG: case Q_ENABLE_CONNECT_LOG:
disable_connect_log=0; set_property(command, P_CONNECT, 0);
var_set_int("$ENABLED_CONNECT_LOG", 1);
break; break;
case Q_DISABLE_CONNECT_LOG: case Q_DISABLE_CONNECT_LOG:
disable_connect_log=1; set_property(command, P_CONNECT, 1);
var_set_int("$ENABLED_CONNECT_LOG", 0);
break; break;
case Q_ENABLE_WARNINGS: case Q_ENABLE_WARNINGS:
disable_warnings= 0; set_property(command, P_WARN, 0);
var_set_int("$ENABLED_WARNINGS", 1);
break; break;
case Q_DISABLE_WARNINGS: case Q_DISABLE_WARNINGS:
disable_warnings= 1; set_property(command, P_WARN, 1);
var_set_int("$ENABLED_WARNINGS", 0);
break; break;
case Q_ENABLE_INFO: case Q_ENABLE_INFO:
disable_info= 0; set_property(command, P_INFO, 0);
var_set_int("$ENABLED_INFO", 1);
break; break;
case Q_DISABLE_INFO: case Q_DISABLE_INFO:
disable_info= 1; set_property(command, P_INFO, 1);
var_set_int("$ENABLED_INFO", 0);
break; break;
case Q_ENABLE_METADATA: case Q_ENABLE_METADATA:
display_metadata= 1; set_property(command, P_META, 1);
var_set_int("$ENABLED_METADATA", 1);
break; break;
case Q_DISABLE_METADATA: case Q_DISABLE_METADATA:
display_metadata= 0; set_property(command, P_META, 0);
var_set_int("$ENABLED_METADATA", 0);
break; break;
case Q_SOURCE: do_source(command); break; case Q_SOURCE: do_source(command); break;
case Q_SLEEP: do_sleep(command, 0); break; case Q_SLEEP: do_sleep(command, 0); break;
...@@ -8744,12 +8836,12 @@ int main(int argc, char **argv) ...@@ -8744,12 +8836,12 @@ int main(int argc, char **argv)
do_set_charset(command); do_set_charset(command);
break; break;
case Q_DISABLE_PS_PROTOCOL: case Q_DISABLE_PS_PROTOCOL:
ps_protocol_enabled= 0; set_property(command, P_PS, 0);
/* Close any open statements */ /* Close any open statements */
close_statements(); close_statements();
break; break;
case Q_ENABLE_PS_PROTOCOL: case Q_ENABLE_PS_PROTOCOL:
ps_protocol_enabled= ps_protocol; set_property(command, P_PS, ps_protocol);
break; break;
case Q_DISABLE_RECONNECT: case Q_DISABLE_RECONNECT:
set_reconnect(&cur_con->mysql, 0); set_reconnect(&cur_con->mysql, 0);
......
...@@ -238,9 +238,9 @@ GetOptions("server-host=s", "server-logs-dir=s", "server-port=s", ...@@ -238,9 +238,9 @@ GetOptions("server-host=s", "server-logs-dir=s", "server-port=s",
"test-duration=i", "test-suffix=s", "check-tests-file", "test-duration=i", "test-suffix=s", "check-tests-file",
"verbose", "log-error-details", "cleanup", "mysqltest=s", "verbose", "log-error-details", "cleanup", "mysqltest=s",
# OBN: (changing 'abort-on-error' to numberic for WL-4626/4685) # OBN: (changing 'abort-on-error' to numberic for WL-4626/4685)
"abort-on-error=i" => \$opt_abort_on_error, "help") || usage(); "abort-on-error=i" => \$opt_abort_on_error, "help") || usage(1);
usage() if ($opt_help); usage(0) if ($opt_help);
#$opt_abort_on_error=1; #$opt_abort_on_error=1;
...@@ -1131,6 +1131,7 @@ sub sig_TERM_handler ...@@ -1131,6 +1131,7 @@ sub sig_TERM_handler
sub usage sub usage
{ {
my $retcode= shift;
print <<EOF; print <<EOF;
The MySQL Stress suite Ver $stress_suite_version The MySQL Stress suite Ver $stress_suite_version
...@@ -1234,7 +1235,7 @@ perl mysql-stress-test.pl \ ...@@ -1234,7 +1235,7 @@ perl mysql-stress-test.pl \
--cleanup \ --cleanup \
EOF EOF
exit(0); exit($retcode);
} }
...@@ -181,6 +181,8 @@ our @opt_combinations; ...@@ -181,6 +181,8 @@ our @opt_combinations;
our @opt_extra_mysqld_opt; our @opt_extra_mysqld_opt;
our @opt_mysqld_envs; our @opt_mysqld_envs;
my $opt_stress;
my $opt_compress; my $opt_compress;
my $opt_ssl; my $opt_ssl;
my $opt_skip_ssl; my $opt_skip_ssl;
...@@ -222,10 +224,13 @@ our %gprof_dirs; ...@@ -222,10 +224,13 @@ our %gprof_dirs;
our $glob_debugger= 0; our $glob_debugger= 0;
our $opt_gdb; our $opt_gdb;
our $opt_client_gdb; our $opt_client_gdb;
my $opt_boot_gdb;
our $opt_dbx; our $opt_dbx;
our $opt_client_dbx; our $opt_client_dbx;
my $opt_boot_dbx;
our $opt_ddd; our $opt_ddd;
our $opt_client_ddd; our $opt_client_ddd;
my $opt_boot_ddd;
our $opt_manual_gdb; our $opt_manual_gdb;
our $opt_manual_dbx; our $opt_manual_dbx;
our $opt_manual_ddd; our $opt_manual_ddd;
...@@ -423,8 +428,8 @@ sub main { ...@@ -423,8 +428,8 @@ sub main {
} }
$ENV{MTR_PARALLEL} = $opt_parallel; $ENV{MTR_PARALLEL} = $opt_parallel;
if ($opt_parallel > 1 && $opt_start_exit) { if ($opt_parallel > 1 && ($opt_start_exit || $opt_stress)) {
mtr_warning("Parallel and --start-and-exit cannot be combined\n" . mtr_warning("Parallel cannot be used with --start-and-exit or --stress\n" .
"Setting parallel to 1"); "Setting parallel to 1");
$opt_parallel= 1; $opt_parallel= 1;
} }
...@@ -654,8 +659,9 @@ sub run_test_server ($$$) { ...@@ -654,8 +659,9 @@ sub run_test_server ($$$) {
my $core_file= $File::Find::name; my $core_file= $File::Find::name;
my $core_name= basename($core_file); my $core_name= basename($core_file);
if ($core_name =~ /^core/ or # Starting with core # Name beginning with core, not ending in .gz
(IS_WINDOWS and $core_name =~ /\.dmp$/)){ if (($core_name =~ /^core/ and $core_name !~ /\.gz$/)
or (IS_WINDOWS and $core_name =~ /\.dmp$/)){
# Ending with .dmp # Ending with .dmp
mtr_report(" - found '$core_name'", mtr_report(" - found '$core_name'",
"($num_saved_cores/$opt_max_save_core)"); "($num_saved_cores/$opt_max_save_core)");
...@@ -1098,14 +1104,17 @@ sub command_line_setup { ...@@ -1098,14 +1104,17 @@ sub command_line_setup {
'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,
'boot-gdb' => \$opt_boot_gdb,
'manual-debug' => \$opt_manual_debug, 'manual-debug' => \$opt_manual_debug,
'ddd' => \$opt_ddd, 'ddd' => \$opt_ddd,
'client-ddd' => \$opt_client_ddd, 'client-ddd' => \$opt_client_ddd,
'manual-ddd' => \$opt_manual_ddd, 'manual-ddd' => \$opt_manual_ddd,
'boot-ddd' => \$opt_boot_ddd,
'dbx' => \$opt_dbx, 'dbx' => \$opt_dbx,
'client-dbx' => \$opt_client_dbx, 'client-dbx' => \$opt_client_dbx,
'manual-dbx' => \$opt_manual_dbx, 'manual-dbx' => \$opt_manual_dbx,
'debugger=s' => \$opt_debugger, 'debugger=s' => \$opt_debugger,
'boot-dbx' => \$opt_boot_dbx,
'client-debugger=s' => \$opt_client_debugger, 'client-debugger=s' => \$opt_client_debugger,
'strace-client:s' => \$opt_strace_client, 'strace-client:s' => \$opt_strace_client,
'max-save-core=i' => \$opt_max_save_core, 'max-save-core=i' => \$opt_max_save_core,
...@@ -1174,6 +1183,7 @@ sub command_line_setup { ...@@ -1174,6 +1183,7 @@ sub command_line_setup {
'report-times' => \$opt_report_times, 'report-times' => \$opt_report_times,
'result-file' => \$opt_resfile, 'result-file' => \$opt_resfile,
'unit-tests!' => \$opt_ctest, 'unit-tests!' => \$opt_ctest,
'stress=s' => \$opt_stress,
'help|h' => \$opt_usage, 'help|h' => \$opt_usage,
# list-options is internal, not listed in help # list-options is internal, not listed in help
...@@ -1627,6 +1637,22 @@ sub command_line_setup { ...@@ -1627,6 +1637,22 @@ sub command_line_setup {
mtr_error("--wait-all can only be used with --start options"); mtr_error("--wait-all can only be used with --start options");
} }
# --------------------------------------------------------------------------
# Gather stress-test options and modify behavior
# --------------------------------------------------------------------------
if ($opt_stress)
{
$opt_stress=~ s/,/ /g;
$opt_user_args= 1;
mtr_error("--stress cannot be combined with named ordinary suites or tests")
if $opt_suites || @opt_cases;
$opt_suites="stress";
@opt_cases= ("wrapper");
$ENV{MST_OPTIONS}= $opt_stress;
$opt_ctest= 0;
}
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Check timeout arguments # Check timeout arguments
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
...@@ -2359,6 +2385,12 @@ sub environment_setup { ...@@ -2359,6 +2385,12 @@ sub environment_setup {
$ENV{'MYSQL_PLUGIN'}= $exe_mysql_plugin; $ENV{'MYSQL_PLUGIN'}= $exe_mysql_plugin;
$ENV{'MYSQL_EMBEDDED'}= $exe_mysql_embedded; $ENV{'MYSQL_EMBEDDED'}= $exe_mysql_embedded;
my $exe_mysqld= find_mysqld($basedir);
$ENV{'MYSQLD'}= $exe_mysqld;
my $extra_opts= join (" ", @opt_extra_mysqld_opt);
$ENV{'MYSQLD_CMD'}= "$exe_mysqld --defaults-group-suffix=.1 ".
"--defaults-file=$path_config_file $extra_opts";
# ---------------------------------------------------- # ----------------------------------------------------
# bug25714 executable may _not_ exist in # bug25714 executable may _not_ exist in
# some versions, test using it should be skipped # some versions, test using it should be skipped
...@@ -3234,6 +3266,19 @@ sub mysql_install_db { ...@@ -3234,6 +3266,19 @@ sub mysql_install_db {
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql"; my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
if ($opt_boot_gdb) {
gdb_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
$bootstrap_sql_file);
}
if ($opt_boot_dbx) {
dbx_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
$bootstrap_sql_file);
}
if ($opt_boot_ddd) {
ddd_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
$bootstrap_sql_file);
}
my $path_sql= my_find_file($install_basedir, my $path_sql= my_find_file($install_basedir,
["mysql", "sql/share", "share/mysql", ["mysql", "sql/share", "share/mysql",
"share", "scripts"], "share", "scripts"],
...@@ -4152,6 +4197,11 @@ sub extract_server_log ($$) { ...@@ -4152,6 +4197,11 @@ sub extract_server_log ($$) {
else else
{ {
push(@lines, $line); push(@lines, $line);
if (scalar(@lines) > 1000000) {
$Ferr = undef;
mtr_warning("Too much log from test, bailing out from extracting");
return ();
}
} }
} }
else else
...@@ -5556,19 +5606,21 @@ sub gdb_arguments { ...@@ -5556,19 +5606,21 @@ sub gdb_arguments {
my $args= shift; my $args= shift;
my $exe= shift; my $exe= shift;
my $type= shift; my $type= shift;
my $input= shift;
# Write $args to gdb init file
my $str= join " ", map { s/"/\\"/g; "\"$_\""; } @$$args;
my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type"; my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type";
# Remove the old gdbinit file # Remove the old gdbinit file
unlink($gdb_init_file); unlink($gdb_init_file);
# Put $args into a single string
my $str= join(" ", @$$args);
my $runline= $input ? "run $str < $input" : "run $str";
# write init file for mysqld or client # write init file for mysqld or client
mtr_tofile($gdb_init_file, mtr_tofile($gdb_init_file,
"set args $str\n" .
"break main\n" . "break main\n" .
"run"); $runline);
if ( $opt_manual_gdb ) if ( $opt_manual_gdb )
{ {
...@@ -5607,20 +5659,22 @@ sub ddd_arguments { ...@@ -5607,20 +5659,22 @@ sub ddd_arguments {
my $args= shift; my $args= shift;
my $exe= shift; my $exe= shift;
my $type= shift; my $type= shift;
my $input= shift;
# Write $args to ddd init file
my $str= join " ", map { s/"/\\"/g; "\"$_\""; } @$$args;
my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type"; my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type";
# Remove the old gdbinit file # Remove the old gdbinit file
unlink($gdb_init_file); unlink($gdb_init_file);
# Put $args into a single string
my $str= join(" ", @$$args);
my $runline= $input ? "run $str < $input" : "run $str";
# write init file for mysqld or client # write init file for mysqld or client
mtr_tofile($gdb_init_file, mtr_tofile($gdb_init_file,
"file $$exe\n" . "file $$exe\n" .
"set args $str\n" .
"break main\n" . "break main\n" .
"run"); $runline);
if ( $opt_manual_ddd ) if ( $opt_manual_ddd )
{ {
...@@ -5656,14 +5710,16 @@ sub dbx_arguments { ...@@ -5656,14 +5710,16 @@ sub dbx_arguments {
my $args= shift; my $args= shift;
my $exe= shift; my $exe= shift;
my $type= shift; my $type= shift;
my $input= shift;
# Put $args into a single string # Put $args into a single string
my $str= join " ", @$$args; my $str= join " ", @$$args;
my $runline= $input ? "run $str < $input" : "run $str";
if ( $opt_manual_dbx ) { if ( $opt_manual_dbx ) {
print "\nTo start dbx for $type, type in another window:\n"; print "\nTo start dbx for $type, type in another window:\n";
print "cd $glob_mysql_test_dir; dbx -c \"stop in main; " . print "cd $glob_mysql_test_dir; dbx -c \"stop in main; " .
"run $str\" $$exe\n"; "$runline\" $$exe\n";
# Indicate the exe should not be started # Indicate the exe should not be started
$$exe= undef; $$exe= undef;
...@@ -5682,7 +5738,7 @@ sub dbx_arguments { ...@@ -5682,7 +5738,7 @@ sub dbx_arguments {
mtr_add_arg($$args, "dbx"); mtr_add_arg($$args, "dbx");
mtr_add_arg($$args, "-c"); mtr_add_arg($$args, "-c");
mtr_add_arg($$args, "stop in main; run $str"); mtr_add_arg($$args, "stop in main; $runline");
mtr_add_arg($$args, "$$exe"); mtr_add_arg($$args, "$$exe");
$$exe= "xterm"; $$exe= "xterm";
...@@ -6128,6 +6184,8 @@ Misc options ...@@ -6128,6 +6184,8 @@ Misc options
nounit-tests Do not run unit tests. Normally run if configured nounit-tests Do not run unit tests. Normally run if configured
and if not running named tests/suites and if not running named tests/suites
unit-tests Run unit tests even if they would otherwise not be run unit-tests Run unit tests even if they would otherwise not be run
stress=ARGS Run stress test, providing options to
mysql-stress-test.pl. Options are separated by comma.
Some options that control enabling a feature for normal test runs, Some options that control enabling a feature for normal test runs,
can be turned off by prepending 'no' to the option, e.g. --notimer. can be turned off by prepending 'no' to the option, e.g. --notimer.
......
...@@ -151,6 +151,10 @@ select 1146 as "after_!errno_masked_error" ; ...@@ -151,6 +151,10 @@ select 1146 as "after_!errno_masked_error" ;
after_!errno_masked_error after_!errno_masked_error
1146 1146
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1000... mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1000...
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 'garbage' at line 1
is empty
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 'nonsense' at line 1
is empty
garbage ; garbage ;
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 'garbage' 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 'garbage' at line 1
ER_PARSE_ERROR ER_PARSE_ERROR
...@@ -160,6 +164,28 @@ after_--enable_abort_on_error ...@@ -160,6 +164,28 @@ after_--enable_abort_on_error
select 3 from t1 ; select 3 from t1 ;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1064... mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1064...
garbage;
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 'garbage' at line 1
select 2;
select 3;
3
3
select 5;
ERROR 42S02: Table 'test.t1' doesn't exist
select 7;
7
7
mysqltest: At line 1: End of line junk detected: "OCNE"
connect con1,localhost,root,,;
select 5 from t1;
lower
case
name
abc
xyz
is empty
is empty
"Yes it's empty"
hello hello
hello hello
;;;;;;;; ;;;;;;;;
...@@ -332,7 +358,7 @@ insert into t1 values ('$dollar'); ...@@ -332,7 +358,7 @@ insert into t1 values ('$dollar');
$dollar $dollar
`select 42` `select 42`
drop table t1; 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: query 'let $var2= `failing query`' failed: 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: Missing required argument 'filename' to command 'source'
mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2 mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql":
...@@ -864,7 +890,7 @@ mysqltest: At line 1: Could not find column 'column_not_exists' in the result of ...@@ -864,7 +890,7 @@ mysqltest: At line 1: Could not find column 'column_not_exists' in the result of
mysqltest: At line 1: Query 'SET @A = 1' didn't return a result set mysqltest: At line 1: Query 'SET @A = 1' didn't return a result set
mysqltest: At line 1: Could not find column '1 AS B' in the result of 'SELECT 1 AS A' mysqltest: At line 1: Could not find column '1 AS B' in the result of 'SELECT 1 AS A'
value= No such row value= No such row
mysqltest: At line 1: Error running query 'SHOW COLNS FROM t1': 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 'COLNS FROM t1' at line 1 mysqltest: At line 1: query 'let $value= query_get_value(SHOW COLNS FROM t1, Field, 1)' failed: 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 'COLNS FROM t1' at line 1
Field Type Null Key Default Extra Field Type Null Key Default Extra
a int(11) YES -><- NULL a int(11) YES -><- NULL
......
--plugin_dir=$FEDERATED_PLUGIN_DIR --plugin_dir=$FEDERATED_PLUGIN_DIR
--loose-federated=ON
CREATE TABLE t2(a int);
CREATE TABLE t1(a int) ENGINE=FEDERATED
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
Warnings:
Warning 1286 Unknown storage engine 'FEDERATED'
Warning 1266 Using storage engine MyISAM for table 't1'
DROP TABLE t1;
INSTALL PLUGIN federated SONAME 'FEDERATED_PLUGIN';
INSTALL PLUGIN FEDERATED SONAME 'FEDERATED_PLUGIN';
ERROR HY000: Function 'FEDERATED' already exists
UNINSTALL PLUGIN federated;
INSTALL PLUGIN federated SONAME 'FEDERATED_PLUGIN';
CREATE TABLE t1(a int) ENGINE=FEDERATED
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
DROP TABLE t1;
UNINSTALL PLUGIN federated;
UNINSTALL PLUGIN federated;
ERROR 42000: PLUGIN federated does not exist
DROP TABLE t2;
--source include/not_windows.inc
--source include/have_federated_plugin.inc --source include/have_federated_plugin.inc
--skip federated plugin is disabled # Uninstall will not uninstall if ps has been used
--disable_ps_protocol
CREATE TABLE t1(a int) ENGINE=FEDERATED; connect (master,localhost,root,,test,$MASTER_MYPORT,);
connect (slave,localhost,root,,test,$SLAVE_MYPORT,);
connection master;
CREATE TABLE t2(a int);
connection slave;
CREATE TABLE t1(a int) ENGINE=FEDERATED
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
DROP TABLE t1; DROP TABLE t1;
INSTALL PLUGIN federated SONAME 'ha_federated.so'; --replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN
--error 1125 eval INSTALL PLUGIN federated SONAME '$FEDERATED_PLUGIN';
INSTALL PLUGIN FEDERATED SONAME 'ha_federated.so'; --replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN
--error ER_UDF_EXISTS
eval INSTALL PLUGIN FEDERATED SONAME '$FEDERATED_PLUGIN';
UNINSTALL PLUGIN federated; UNINSTALL PLUGIN federated;
INSTALL PLUGIN federated SONAME 'ha_federated.so'; --replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN
eval INSTALL PLUGIN federated SONAME '$FEDERATED_PLUGIN';
CREATE TABLE t1(a int) ENGINE=FEDERATED;
CREATE TABLE t1(a int) ENGINE=FEDERATED
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
DROP TABLE t1; DROP TABLE t1;
UNINSTALL PLUGIN federated; UNINSTALL PLUGIN federated;
--error ER_SP_DOES_NOT_EXIST --error ER_SP_DOES_NOT_EXIST
UNINSTALL PLUGIN federated; UNINSTALL PLUGIN federated;
connection master;
DROP TABLE t2;
#
# This is a wrapper "pseudo" test for mtr --stress execution.
# It should not be run directly (will be skipped)
# Do not create a result file!
#
if (!$MST_OPTIONS) {
skip Only to be run with mtr --stress;
}
# echo Running MST with options $MST_OPTIONS;
perl;
my ($mtest)= split " ", $ENV{MYSQL_TEST};
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mtest.inc") or die;
print FILE "let \$MYSQLTEST_BIN= $mtest;\n";
close FILE;
EOF
--source $MYSQL_TMP_DIR/mtest.inc
--remove_file $MYSQL_TMP_DIR/mtest.inc
exec perl mysql-stress-test.pl --mysqltest=$MYSQLTEST_BIN
--server-port=$MASTER_MYPORT --server-socket=$MASTER_MYSOCK
--server-user=root --cleanup
--server-logs-dir=$MYSQLTEST_VARDIR/log
--stress-basedir=$MYSQLTEST_VARDIR
$MST_OPTIONS
;
...@@ -11,7 +11,5 @@ There should be *no* long test name listed below: ...@@ -11,7 +11,5 @@ There should be *no* long test name listed below:
select variable_name as `There should be *no* variables listed below:` from t2 select variable_name as `There should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null; left join t1 on variable_name=test_name where test_name is null;
There should be *no* variables listed below: There should be *no* variables listed below:
INNODB_LARGE_PREFIX
INNODB_LARGE_PREFIX
drop table t1; drop table t1;
drop table t2; drop table t2;
...@@ -45,7 +45,6 @@ use File::Basename; ...@@ -45,7 +45,6 @@ use File::Basename;
my $plugindir_ini= "$ENV{PLUGIN_DIR}/daemon_example.ini"; my $plugindir_ini= "$ENV{PLUGIN_DIR}/daemon_example.ini";
my $notfound= ""; my $notfound= "";
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mysqld.inc") or die; open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mysqld.inc") or die;
print FILE "let \$MYSQLD= $mysqld;\n";
print FILE "let \$MYSQLD_BASEDIR= $mysqld_basedir;\n"; print FILE "let \$MYSQLD_BASEDIR= $mysqld_basedir;\n";
print FILE "let \$MYSQL_MY_PRINT_DEFAULTS_BASEDIR= $my_print_defaults_basedir;\n"; print FILE "let \$MYSQL_MY_PRINT_DEFAULTS_BASEDIR= $my_print_defaults_basedir;\n";
if ((!-e $daemonexample_ini) || (!-r $daemonexample_ini)) if ((!-e $daemonexample_ini) || (!-r $daemonexample_ini))
......
...@@ -5,21 +5,6 @@ ...@@ -5,21 +5,6 @@
source include/not_embedded.inc; source include/not_embedded.inc;
source include/not_windows.inc; source include/not_windows.inc;
# We need to use a plain "mysqld" without any other options to trigger
# the bug. In particular, it seems that passing --bootstrap does not
# trigger the bug. To do that, we extract the "command name" from the
# MYSQLD_BOOTSTRAP_CMD variable and store that in a file, which we
# then load into the test case.
perl;
my ($mysqld)= split " ", $ENV{MYSQLD_BOOTSTRAP_CMD};
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mysqld.inc") or die;
print FILE "let \$MYSQLD= $mysqld;\n";
close FILE;
EOF
source $MYSQL_TMP_DIR/mysqld.inc;
# All these tests refer to configuration files that do not exist # All these tests refer to configuration files that do not exist
--error 1 --error 1
...@@ -44,4 +29,3 @@ exec $MYSQLD --defaults-file=with.ext --print-defaults 2>&1; ...@@ -44,4 +29,3 @@ exec $MYSQLD --defaults-file=with.ext --print-defaults 2>&1;
--error 1 --error 1
exec $MYSQLD --defaults-file=no_extension --print-defaults 2>&1; exec $MYSQLD --defaults-file=no_extension --print-defaults 2>&1;
remove_file $MYSQL_TMP_DIR/mysqld.inc;
...@@ -353,6 +353,14 @@ eval select $mysql_errno as "after_!errno_masked_error" ; ...@@ -353,6 +353,14 @@ eval select $mysql_errno as "after_!errno_masked_error" ;
exit(2); exit(2);
EOF EOF
# ----------------------------------------------------------------------------
# Check backtick and query_get_value, result should be empty
# ----------------------------------------------------------------------------
let $empty= `garbage`;
echo $empty is empty;
let $empty= query_get_value(nonsense, blabla, 1);
echo $empty is empty;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Switch the abort on error on and check the effect on $mysql_errno # Switch the abort on error on and check the effect on $mysql_errno
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -383,6 +391,71 @@ select 3 from t1 ; ...@@ -383,6 +391,71 @@ select 3 from t1 ;
--error 1 --error 1
--exec echo "disable_abort_on_error; enable_abort_on_error; error 1064; select 3 from t1; select 3 from t1;" | $MYSQL_TEST 2>&1 --exec echo "disable_abort_on_error; enable_abort_on_error; error 1064; select 3 from t1; select 3 from t1;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
# Test --enable and --disable with ONCE
# ----------------------------------------------------------------------------
--disable_abort_on_error ONCE
garbage;
--disable_abort_on_error ONCE
--remove_file DoesNotExist
--disable_result_log
select 2;
--enable_result_log ONCE
select 3;
select 5;
--enable_result_log
# ----------------------------------------------------------------------------
# Test cumulative ONCE
# ----------------------------------------------------------------------------
--disable_abort_on_error ONCE
--disable_query_log ONCE
select 3 from t1;
select 7;
--error 1
--exec echo "--disable_info OCNE" | $MYSQL_TEST 2>&1
--enable_connect_log ONCE
connect (con1,localhost,root,,);
connection default;
disconnect con1;
# ----------------------------------------------------------------------------
# Test ONCE can be combined with --error or modifiers like lowercase
# ----------------------------------------------------------------------------
--disable_result_log ONCE
--error ER_NO_SUCH_TABLE
select 5 from t1;
--disable_query_log ONCE
--lowercase_result
select "CASE" as "LOWER";
--sorted_result
--disable_query_log ONCE
select "xyz" as name union select "abc" as name order by name desc;
# ----------------------------------------------------------------------------
# Test --error with backtick operator or query_get_value
# ----------------------------------------------------------------------------
--error 0,ER_NO_SUCH_TABLE
let $empty= `SELECT foo from bar`;
echo $empty is empty;
--error 0,ER_BAD_FIELD_ERROR
let $empty= query_get_value(SELECT bar as foo, baz, 1);
echo $empty is empty;
--error 0,ER_NO_SUCH_TABLE
if (!`SELECT foo from bar`) {
echo "Yes it's empty";
}
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test comments # Test comments
...@@ -952,10 +1025,9 @@ while ($outer) ...@@ -952,10 +1025,9 @@ while ($outer)
--source $MYSQLTEST_VARDIR/tmp/sourced.inc --source $MYSQLTEST_VARDIR/tmp/sourced.inc
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE
SELECT * from nowhere; SELECT * from nowhere;
--disable_abort_on_error --disable_abort_on_error ONCE
# Statement giving a different error, to make sure we don't mask it # Statement giving a different error, to make sure we don't mask it
SELECT * FROM nowhere else; SELECT * FROM nowhere else;
--enable_abort_on_error
} }
dec $outer; dec $outer;
inc $ifval; inc $ifval;
...@@ -1104,9 +1176,8 @@ system echo "hej" > /dev/null; ...@@ -1104,9 +1176,8 @@ system echo "hej" > /dev/null;
--error 1 --error 1
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1 --exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
--disable_abort_on_error --disable_abort_on_error ONCE
system NonExistsinfComamdn 2> /dev/null; system NonExistsinfComamdn 2> /dev/null;
--enable_abort_on_error
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -2517,10 +2588,9 @@ INSERT INTO t1 SELECT f1 - 64 FROM t1; ...@@ -2517,10 +2588,9 @@ INSERT INTO t1 SELECT f1 - 64 FROM t1;
INSERT INTO t1 SELECT f1 - 128 FROM t1; INSERT INTO t1 SELECT f1 - 128 FROM t1;
INSERT INTO t1 SELECT f1 - 256 FROM t1; INSERT INTO t1 SELECT f1 - 256 FROM t1;
INSERT INTO t1 SELECT f1 - 512 FROM t1; INSERT INTO t1 SELECT f1 - 512 FROM t1;
--disable_result_log --disable_result_log ONCE
--sorted_result --sorted_result
SELECT * FROM t1; SELECT * FROM t1;
--enable_result_log
DROP TABLE t1; DROP TABLE t1;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -2568,11 +2638,9 @@ SELECT 0 as "WILL NOT lower case ...@@ -2568,11 +2638,9 @@ SELECT 0 as "WILL NOT lower case
--exec $MYSQL_TEST --help 2>&1 > /dev/null --exec $MYSQL_TEST --help 2>&1 > /dev/null
--exec $MYSQL_TEST --version 2>&1 > /dev/null --exec $MYSQL_TEST --version 2>&1 > /dev/null
--enable_query_log --enable_query_log
--disable_abort_on_error --disable_abort_on_error ONCE
--error 1 --error 1
--exec $MYSQL_TEST a b c 2>&1 > /dev/null --exec $MYSQL_TEST a b c 2>&1 > /dev/null
--enable_abort_on_error
--enable_query_log
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# test for query_get_value # test for query_get_value
......
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