Commit 062f57e2 authored by Bjorn Munch's avatar Bjorn Munch

upmerge 52321,53374,53949,54111,54364,54368

parents 6377334b d8432094
...@@ -2922,6 +2922,41 @@ void do_system(struct st_command *command) ...@@ -2922,6 +2922,41 @@ void do_system(struct st_command *command)
} }
/*
SYNOPSIS
set_wild_chars
set true to set * etc. as wild char, false to reset
DESCRIPTION
Auxiliary function to set "our" wild chars before calling wild_compare
This is needed because the default values are changed to SQL syntax
in mysqltest_embedded.
*/
void set_wild_chars (my_bool set)
{
static char old_many= 0, old_one, old_prefix;
if (set)
{
if (wild_many == '*') return; // No need
old_many= wild_many;
old_one= wild_one;
old_prefix= wild_prefix;
wild_many= '*';
wild_one= '?';
wild_prefix= 0;
}
else
{
if (! old_many) return; // Was not set
wild_many= old_many;
wild_one= old_one;
wild_prefix= old_prefix;
}
}
/* /*
SYNOPSIS SYNOPSIS
do_remove_file do_remove_file
...@@ -2998,6 +3033,10 @@ void do_remove_files_wildcard(struct st_command *command) ...@@ -2998,6 +3033,10 @@ void do_remove_files_wildcard(struct st_command *command)
dir_separator[0]= FN_LIBCHAR; dir_separator[0]= FN_LIBCHAR;
dir_separator[1]= 0; dir_separator[1]= 0;
dynstr_append(&ds_file_to_remove, dir_separator); dynstr_append(&ds_file_to_remove, dir_separator);
/* Set default wild chars for wild_compare, is changed in embedded mode */
set_wild_chars(1);
for (i= 0; i < (uint) dir_info->number_off_files; i++) for (i= 0; i < (uint) dir_info->number_off_files; i++)
{ {
file= dir_info->dir_entry + i; file= dir_info->dir_entry + i;
...@@ -3017,6 +3056,7 @@ void do_remove_files_wildcard(struct st_command *command) ...@@ -3017,6 +3056,7 @@ void do_remove_files_wildcard(struct st_command *command)
if (error) if (error)
break; break;
} }
set_wild_chars(0);
my_dirend(dir_info); my_dirend(dir_info);
end: end:
...@@ -3262,6 +3302,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname, ...@@ -3262,6 +3302,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
/* Note that my_dir sorts the list if not given any flags */ /* Note that my_dir sorts the list if not given any flags */
if (!(dir_info= my_dir(ds_dirname->str, MYF(0)))) if (!(dir_info= my_dir(ds_dirname->str, MYF(0))))
DBUG_RETURN(1); DBUG_RETURN(1);
set_wild_chars(1);
for (i= 0; i < (uint) dir_info->number_off_files; i++) for (i= 0; i < (uint) dir_info->number_off_files; i++)
{ {
file= dir_info->dir_entry + i; file= dir_info->dir_entry + i;
...@@ -3275,6 +3316,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname, ...@@ -3275,6 +3316,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
dynstr_append(ds, file->name); dynstr_append(ds, file->name);
dynstr_append(ds, "\n"); dynstr_append(ds, "\n");
} }
set_wild_chars(0);
my_dirend(dir_info); my_dirend(dir_info);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -3836,8 +3878,9 @@ void do_perl(struct st_command *command) ...@@ -3836,8 +3878,9 @@ void do_perl(struct st_command *command)
} }
error= pclose(res_file); error= pclose(res_file);
/* Remove the temporary file */ /* Remove the temporary file, but keep it if perl failed */
my_delete(temp_file_path, MYF(0)); if (!error)
my_delete(temp_file_path, MYF(0));
handle_command_error(command, WEXITSTATUS(error)); handle_command_error(command, WEXITSTATUS(error));
} }
......
...@@ -188,6 +188,8 @@ sub new { ...@@ -188,6 +188,8 @@ sub new {
while ( my $line= <$F> ) { while ( my $line= <$F> ) {
chomp($line); chomp($line);
# Remove any trailing CR from Windows edited files
$line=~ s/\cM$//;
# [group] # [group]
if ( $line =~ /^\[(.*)\]/ ) { if ( $line =~ /^\[(.*)\]/ ) {
......
...@@ -30,6 +30,13 @@ sub get_basedir { ...@@ -30,6 +30,13 @@ sub get_basedir {
return $basedir; return $basedir;
} }
sub get_testdir {
my ($self, $group)= @_;
my $testdir= $group->if_exist('testdir') ||
$self->{ARGS}->{testdir};
return $testdir;
}
# Retrive build directory (which is different from basedir in out-of-source build) # Retrive build directory (which is different from basedir in out-of-source build)
sub get_bindir { sub get_bindir {
if (defined $ENV{MTR_BINDIR}) if (defined $ENV{MTR_BINDIR})
...@@ -151,9 +158,8 @@ sub fix_secure_file_priv { ...@@ -151,9 +158,8 @@ sub fix_secure_file_priv {
sub fix_std_data { sub fix_std_data {
my ($self, $config, $group_name, $group)= @_; my ($self, $config, $group_name, $group)= @_;
return my_find_dir($self->get_basedir($group), my $testdir= $self->get_testdir($group);
["share/mysql-test", "mysql-test"], return "$testdir/std_data";
"std_data");
} }
sub ssl_supported { sub ssl_supported {
......
...@@ -124,7 +124,7 @@ sub mtr_report_test ($) { ...@@ -124,7 +124,7 @@ sub mtr_report_test ($) {
my $timest = format_time(); my $timest = format_time();
my $fail = "fail"; my $fail = "fail";
if ( $::opt_experimental ) if ( @$::experimental_test_cases )
{ {
# Find out if this test case is an experimental one, so we can treat # Find out if this test case is an experimental one, so we can treat
# the failure as an expected failure instead of a regression. # the failure as an expected failure instead of a regression.
......
...@@ -205,7 +205,7 @@ our $opt_client_debugger; ...@@ -205,7 +205,7 @@ our $opt_client_debugger;
my $config; # The currently running config my $config; # The currently running config
my $current_config_name; # The currently running config file template my $current_config_name; # The currently running config file template
our $opt_experimental; our @opt_experimentals;
our $experimental_test_cases; our $experimental_test_cases;
my $baseport; my $baseport;
...@@ -239,6 +239,7 @@ my $opt_start_dirty; ...@@ -239,6 +239,7 @@ my $opt_start_dirty;
my $opt_start_exit; my $opt_start_exit;
my $start_only; my $start_only;
my $opt_wait_all; my $opt_wait_all;
my $opt_user_args;
my $opt_repeat= 1; my $opt_repeat= 1;
my $opt_retry= 3; my $opt_retry= 3;
my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2); my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2);
...@@ -864,7 +865,7 @@ sub command_line_setup { ...@@ -864,7 +865,7 @@ sub command_line_setup {
'big-test' => \$opt_big_test, 'big-test' => \$opt_big_test,
'combination=s' => \@opt_combinations, 'combination=s' => \@opt_combinations,
'skip-combinations' => \&collect_option, 'skip-combinations' => \&collect_option,
'experimental=s' => \$opt_experimental, 'experimental=s' => \@opt_experimentals,
'skip-im' => \&ignore_option, 'skip-im' => \&ignore_option,
# Specify ports # Specify ports
...@@ -939,6 +940,7 @@ sub command_line_setup { ...@@ -939,6 +940,7 @@ sub command_line_setup {
'start-dirty' => \$opt_start_dirty, 'start-dirty' => \$opt_start_dirty,
'start-and-exit' => \$opt_start_exit, 'start-and-exit' => \$opt_start_exit,
'start' => \$opt_start, 'start' => \$opt_start,
'user-args' => \$opt_user_args,
'wait-all' => \$opt_wait_all, 'wait-all' => \$opt_wait_all,
'print-testcases' => \&collect_option, 'print-testcases' => \&collect_option,
'repeat=i' => \$opt_repeat, 'repeat=i' => \$opt_repeat,
...@@ -1050,43 +1052,47 @@ sub command_line_setup { ...@@ -1050,43 +1052,47 @@ sub command_line_setup {
mtr_print_thick_line('#'); mtr_print_thick_line('#');
} }
if ( $opt_experimental ) if ( @opt_experimentals )
{ {
# $^O on Windows considered not generic enough # $^O on Windows considered not generic enough
my $plat= (IS_WINDOWS) ? 'windows' : $^O; my $plat= (IS_WINDOWS) ? 'windows' : $^O;
# read the list of experimental test cases from the file specified on # read the list of experimental test cases from the files specified on
# the command line # the command line
open(FILE, "<", $opt_experimental) or mtr_error("Can't read experimental file: $opt_experimental");
mtr_report("Using experimental file: $opt_experimental");
$experimental_test_cases = []; $experimental_test_cases = [];
while(<FILE>) { foreach my $exp_file (@opt_experimentals)
chomp; {
# remove comments (# foo) at the beginning of the line, or after a open(FILE, "<", $exp_file)
# blank at the end of the line or mtr_error("Can't read experimental file: $exp_file");
s/( +|^)#.*$//; mtr_report("Using experimental file: $exp_file");
# If @ platform specifier given, use this entry only if it contains while(<FILE>) {
# @<platform> or @!<xxx> where xxx != platform chomp;
if (/\@.*/) # remove comments (# foo) at the beginning of the line, or after a
{ # blank at the end of the line
next if (/\@!$plat/); s/( +|^)#.*$//;
next unless (/\@$plat/ or /\@!/); # If @ platform specifier given, use this entry only if it contains
# Then remove @ and everything after it # @<platform> or @!<xxx> where xxx != platform
s/\@.*$//; if (/\@.*/)
} {
# remove whitespace next if (/\@!$plat/);
s/^ +//; next unless (/\@$plat/ or /\@!/);
s/ +$//; # Then remove @ and everything after it
# if nothing left, don't need to remember this line s/\@.*$//;
if ( $_ eq "" ) { }
next; # remove whitespace
s/^ +//;
s/ +$//;
# if nothing left, don't need to remember this line
if ( $_ eq "" ) {
next;
}
# remember what is left as the name of another test case that should be
# treated as experimental
print " - $_\n";
push @$experimental_test_cases, $_;
} }
# remember what is left as the name of another test case that should be close FILE;
# treated as experimental
print " - $_\n";
push @$experimental_test_cases, $_;
} }
close FILE;
} }
foreach my $arg ( @ARGV ) foreach my $arg ( @ARGV )
...@@ -1360,13 +1366,24 @@ sub command_line_setup { ...@@ -1360,13 +1366,24 @@ sub command_line_setup {
$start_only= 1; $start_only= 1;
} }
# --------------------------------------------------------------------------
# Check use of user-args
# --------------------------------------------------------------------------
if ($opt_user_args) {
mtr_error("--user-args only valid with --start options")
unless $start_only;
mtr_error("--user-args cannot be combined with named suites or tests")
if $opt_suites || @opt_cases;
}
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Check use of wait-all # Check use of wait-all
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
if ($opt_wait_all && ! $start_only) if ($opt_wait_all && ! $start_only)
{ {
mtr_error("--wait-all can only be used with --start or --start-dirty"); mtr_error("--wait-all can only be used with --start options");
} }
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
...@@ -2802,6 +2819,7 @@ sub default_mysqld { ...@@ -2802,6 +2819,7 @@ sub default_mysqld {
my $config= My::ConfigFactory->new_config my $config= My::ConfigFactory->new_config
( { ( {
basedir => $basedir, basedir => $basedir,
testdir => $glob_mysql_test_dir,
template_path => "include/default_my.cnf", template_path => "include/default_my.cnf",
vardir => $opt_vardir, vardir => $opt_vardir,
tmpdir => $opt_tmpdir, tmpdir => $opt_tmpdir,
...@@ -3410,6 +3428,7 @@ sub run_testcase ($) { ...@@ -3410,6 +3428,7 @@ sub run_testcase ($) {
$config= My::ConfigFactory->new_config $config= My::ConfigFactory->new_config
( { ( {
basedir => $basedir, basedir => $basedir,
testdir => $glob_mysql_test_dir,
template_path => $tinfo->{template_path}, template_path => $tinfo->{template_path},
extra_template_path => $tinfo->{extra_template_path}, extra_template_path => $tinfo->{extra_template_path},
vardir => $opt_vardir, vardir => $opt_vardir,
...@@ -4313,7 +4332,7 @@ sub mysqld_arguments ($$$) { ...@@ -4313,7 +4332,7 @@ sub mysqld_arguments ($$$) {
} }
} }
if ( $mysql_version_id >= 50106 ) if ( $mysql_version_id >= 50106 && !$opt_user_args)
{ {
# Turn on logging to file # Turn on logging to file
mtr_add_arg($args, "--log-output=file"); mtr_add_arg($args, "--log-output=file");
...@@ -4356,7 +4375,7 @@ sub mysqld_arguments ($$$) { ...@@ -4356,7 +4375,7 @@ sub mysqld_arguments ($$$) {
} }
} }
$opt_skip_core = $found_skip_core; $opt_skip_core = $found_skip_core;
if ( !$found_skip_core ) if ( !$found_skip_core && !$opt_user_args )
{ {
mtr_add_arg($args, "%s", "--core-file"); mtr_add_arg($args, "%s", "--core-file");
} }
...@@ -4364,7 +4383,7 @@ sub mysqld_arguments ($$$) { ...@@ -4364,7 +4383,7 @@ sub mysqld_arguments ($$$) {
# Enable the debug sync facility, set default wait timeout. # Enable the debug sync facility, set default wait timeout.
# Facility stays disabled if timeout value is zero. # Facility stays disabled if timeout value is zero.
mtr_add_arg($args, "--loose-debug-sync-timeout=%s", mtr_add_arg($args, "--loose-debug-sync-timeout=%s",
$opt_debug_sync_timeout); $opt_debug_sync_timeout) unless $opt_user_args;
return $args; return $args;
} }
...@@ -4662,6 +4681,9 @@ sub envsubst { ...@@ -4662,6 +4681,9 @@ sub envsubst {
sub get_extra_opts { sub get_extra_opts {
# No extra options if --user-args
return \@opt_extra_mysqld_opt if $opt_user_args;
my ($mysqld, $tinfo)= @_; my ($mysqld, $tinfo)= @_;
my $opts= my $opts=
...@@ -5534,8 +5556,13 @@ Misc options ...@@ -5534,8 +5556,13 @@ Misc options
startup settings for the first specified test case startup settings for the first specified test case
Example: Example:
$0 --start alias & $0 --start alias &
start-and-exit Same as --start, but mysql-test-run terminates and
leaves just the server running
start-dirty Only start the servers (without initialization) for start-dirty Only start the servers (without initialization) for
the first specified test case the first specified test case
user-args In combination with start* and no test name, drops
arguments to mysqld except those speficied with
--mysqld (if any)
wait-all If --start or --start-dirty option is used, wait for all wait-all If --start or --start-dirty option is used, wait for all
servers to exit before finishing the process servers to exit before finishing the process
fast Run as fast as possible, dont't wait for servers fast Run as fast as possible, dont't wait for servers
......
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