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)
}
/*
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
do_remove_file
......@@ -2998,6 +3033,10 @@ void do_remove_files_wildcard(struct st_command *command)
dir_separator[0]= FN_LIBCHAR;
dir_separator[1]= 0;
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++)
{
file= dir_info->dir_entry + i;
......@@ -3017,6 +3056,7 @@ void do_remove_files_wildcard(struct st_command *command)
if (error)
break;
}
set_wild_chars(0);
my_dirend(dir_info);
end:
......@@ -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 */
if (!(dir_info= my_dir(ds_dirname->str, MYF(0))))
DBUG_RETURN(1);
set_wild_chars(1);
for (i= 0; i < (uint) dir_info->number_off_files; i++)
{
file= dir_info->dir_entry + i;
......@@ -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, "\n");
}
set_wild_chars(0);
my_dirend(dir_info);
DBUG_RETURN(0);
}
......@@ -3836,8 +3878,9 @@ void do_perl(struct st_command *command)
}
error= pclose(res_file);
/* Remove the temporary file */
my_delete(temp_file_path, MYF(0));
/* Remove the temporary file, but keep it if perl failed */
if (!error)
my_delete(temp_file_path, MYF(0));
handle_command_error(command, WEXITSTATUS(error));
}
......
......@@ -188,6 +188,8 @@ sub new {
while ( my $line= <$F> ) {
chomp($line);
# Remove any trailing CR from Windows edited files
$line=~ s/\cM$//;
# [group]
if ( $line =~ /^\[(.*)\]/ ) {
......
......@@ -30,6 +30,13 @@ sub get_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)
sub get_bindir {
if (defined $ENV{MTR_BINDIR})
......@@ -151,9 +158,8 @@ sub fix_secure_file_priv {
sub fix_std_data {
my ($self, $config, $group_name, $group)= @_;
return my_find_dir($self->get_basedir($group),
["share/mysql-test", "mysql-test"],
"std_data");
my $testdir= $self->get_testdir($group);
return "$testdir/std_data";
}
sub ssl_supported {
......
......@@ -124,7 +124,7 @@ sub mtr_report_test ($) {
my $timest = format_time();
my $fail = "fail";
if ( $::opt_experimental )
if ( @$::experimental_test_cases )
{
# Find out if this test case is an experimental one, so we can treat
# the failure as an expected failure instead of a regression.
......
......@@ -205,7 +205,7 @@ our $opt_client_debugger;
my $config; # The currently running config
my $current_config_name; # The currently running config file template
our $opt_experimental;
our @opt_experimentals;
our $experimental_test_cases;
my $baseport;
......@@ -239,6 +239,7 @@ my $opt_start_dirty;
my $opt_start_exit;
my $start_only;
my $opt_wait_all;
my $opt_user_args;
my $opt_repeat= 1;
my $opt_retry= 3;
my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2);
......@@ -864,7 +865,7 @@ sub command_line_setup {
'big-test' => \$opt_big_test,
'combination=s' => \@opt_combinations,
'skip-combinations' => \&collect_option,
'experimental=s' => \$opt_experimental,
'experimental=s' => \@opt_experimentals,
'skip-im' => \&ignore_option,
# Specify ports
......@@ -939,6 +940,7 @@ sub command_line_setup {
'start-dirty' => \$opt_start_dirty,
'start-and-exit' => \$opt_start_exit,
'start' => \$opt_start,
'user-args' => \$opt_user_args,
'wait-all' => \$opt_wait_all,
'print-testcases' => \&collect_option,
'repeat=i' => \$opt_repeat,
......@@ -1050,43 +1052,47 @@ sub command_line_setup {
mtr_print_thick_line('#');
}
if ( $opt_experimental )
if ( @opt_experimentals )
{
# $^O on Windows considered not generic enough
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
open(FILE, "<", $opt_experimental) or mtr_error("Can't read experimental file: $opt_experimental");
mtr_report("Using experimental file: $opt_experimental");
$experimental_test_cases = [];
while(<FILE>) {
chomp;
# remove comments (# foo) at the beginning of the line, or after a
# blank at the end of the line
s/( +|^)#.*$//;
# If @ platform specifier given, use this entry only if it contains
# @<platform> or @!<xxx> where xxx != platform
if (/\@.*/)
{
next if (/\@!$plat/);
next unless (/\@$plat/ or /\@!/);
# Then remove @ and everything after it
s/\@.*$//;
}
# remove whitespace
s/^ +//;
s/ +$//;
# if nothing left, don't need to remember this line
if ( $_ eq "" ) {
next;
foreach my $exp_file (@opt_experimentals)
{
open(FILE, "<", $exp_file)
or mtr_error("Can't read experimental file: $exp_file");
mtr_report("Using experimental file: $exp_file");
while(<FILE>) {
chomp;
# remove comments (# foo) at the beginning of the line, or after a
# blank at the end of the line
s/( +|^)#.*$//;
# If @ platform specifier given, use this entry only if it contains
# @<platform> or @!<xxx> where xxx != platform
if (/\@.*/)
{
next if (/\@!$plat/);
next unless (/\@$plat/ or /\@!/);
# Then remove @ and everything after it
s/\@.*$//;
}
# 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
# treated as experimental
print " - $_\n";
push @$experimental_test_cases, $_;
close FILE;
}
close FILE;
}
foreach my $arg ( @ARGV )
......@@ -1360,13 +1366,24 @@ sub command_line_setup {
$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
# --------------------------------------------------------------------------
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 {
my $config= My::ConfigFactory->new_config
( {
basedir => $basedir,
testdir => $glob_mysql_test_dir,
template_path => "include/default_my.cnf",
vardir => $opt_vardir,
tmpdir => $opt_tmpdir,
......@@ -3410,6 +3428,7 @@ sub run_testcase ($) {
$config= My::ConfigFactory->new_config
( {
basedir => $basedir,
testdir => $glob_mysql_test_dir,
template_path => $tinfo->{template_path},
extra_template_path => $tinfo->{extra_template_path},
vardir => $opt_vardir,
......@@ -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
mtr_add_arg($args, "--log-output=file");
......@@ -4356,7 +4375,7 @@ sub mysqld_arguments ($$$) {
}
}
$opt_skip_core = $found_skip_core;
if ( !$found_skip_core )
if ( !$found_skip_core && !$opt_user_args )
{
mtr_add_arg($args, "%s", "--core-file");
}
......@@ -4364,7 +4383,7 @@ sub mysqld_arguments ($$$) {
# Enable the debug sync facility, set default wait timeout.
# Facility stays disabled if timeout value is zero.
mtr_add_arg($args, "--loose-debug-sync-timeout=%s",
$opt_debug_sync_timeout);
$opt_debug_sync_timeout) unless $opt_user_args;
return $args;
}
......@@ -4662,6 +4681,9 @@ sub envsubst {
sub get_extra_opts {
# No extra options if --user-args
return \@opt_extra_mysqld_opt if $opt_user_args;
my ($mysqld, $tinfo)= @_;
my $opts=
......@@ -5534,8 +5556,13 @@ Misc options
startup settings for the first specified test case
Example:
$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
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
servers to exit before finishing the process
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