mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merged 5.1-main -> 5.1-bugteam
This commit is contained in:
@ -181,12 +181,18 @@ our $opt_client_debugger;
|
||||
my $config; # The currently running config
|
||||
my $current_config_name; # The currently running config file template
|
||||
|
||||
our $opt_experimental;
|
||||
our $experimental_test_cases;
|
||||
|
||||
my $baseport;
|
||||
my $opt_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
|
||||
my $build_thread= 0;
|
||||
|
||||
my $opt_record;
|
||||
my $opt_report_features;
|
||||
|
||||
my $opt_skip_core;
|
||||
|
||||
our $opt_check_testcases= 1;
|
||||
my $opt_mark_progress;
|
||||
|
||||
@ -677,14 +683,9 @@ sub run_worker ($) {
|
||||
report_option('name',"worker[$thread_num]");
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Use auto build thread in all but first worker
|
||||
# Set different ports per thread
|
||||
# --------------------------------------------------------------------------
|
||||
set_build_thread_ports($thread_num > 1 ? 'auto' : $opt_build_thread);
|
||||
|
||||
if (check_ports_free()){
|
||||
# Some port was not free(which one has already been printed)
|
||||
mtr_error("Some port(s) was not free")
|
||||
}
|
||||
set_build_thread_ports($thread_num);
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Turn off verbosity in workers, unless explicitly specified
|
||||
@ -804,7 +805,7 @@ sub command_line_setup {
|
||||
'big-test' => \$opt_big_test,
|
||||
'combination=s' => \@opt_combinations,
|
||||
'skip-combinations' => \&collect_option,
|
||||
|
||||
'experimental=s' => \$opt_experimental,
|
||||
'skip-im' => \&ignore_option,
|
||||
|
||||
# Specify ports
|
||||
@ -944,12 +945,12 @@ sub command_line_setup {
|
||||
}
|
||||
|
||||
# Look for language files and charsetsdir, use same share
|
||||
my $path_share= mtr_path_exists("$basedir/share/mysql",
|
||||
"$basedir/sql/share",
|
||||
"$basedir/share");
|
||||
$path_language= mtr_path_exists("$basedir/share/mysql/english",
|
||||
"$basedir/sql/share/english",
|
||||
"$basedir/share/english");
|
||||
|
||||
|
||||
$path_language= mtr_path_exists("$path_share/english");
|
||||
|
||||
my $path_share= dirname($path_language);
|
||||
$path_charsetsdir= mtr_path_exists("$path_share/charsets");
|
||||
|
||||
if (using_extern())
|
||||
@ -971,6 +972,33 @@ sub command_line_setup {
|
||||
mtr_print_thick_line('#');
|
||||
}
|
||||
|
||||
if ( $opt_experimental )
|
||||
{
|
||||
# read the list of experimental test cases from the file 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/( +|^)#.*$//;
|
||||
# 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, $_;
|
||||
}
|
||||
close FILE;
|
||||
}
|
||||
|
||||
foreach my $arg ( @ARGV )
|
||||
{
|
||||
if ( $arg =~ /^--skip-/ )
|
||||
@ -1094,6 +1122,14 @@ sub command_line_setup {
|
||||
$opt_shutdown_timeout= 0; # Kill processes instead of nice shutdown
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Check parallel value
|
||||
# --------------------------------------------------------------------------
|
||||
if ($opt_parallel < 1)
|
||||
{
|
||||
mtr_error("0 or negative parallel value makes no sense, use positive number");
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Record flag
|
||||
# --------------------------------------------------------------------------
|
||||
@ -1283,18 +1319,32 @@ sub command_line_setup {
|
||||
# But a fairly safe range seems to be 5001 - 32767
|
||||
#
|
||||
sub set_build_thread_ports($) {
|
||||
my $build_thread= shift || 0;
|
||||
my $thread= shift || 0;
|
||||
|
||||
if ( lc($build_thread) eq 'auto' ) {
|
||||
#mtr_report("Requesting build thread... ");
|
||||
$build_thread= mtr_get_unique_id(250, 299);
|
||||
if ( !defined $build_thread ) {
|
||||
mtr_error("Could not get a unique build thread id");
|
||||
if ( lc($opt_build_thread) eq 'auto' ) {
|
||||
my $found_free = 0;
|
||||
$build_thread = 250; # Start attempts from here
|
||||
while (! $found_free)
|
||||
{
|
||||
$build_thread= mtr_get_unique_id($build_thread, 299);
|
||||
if ( !defined $build_thread ) {
|
||||
mtr_error("Could not get a unique build thread id");
|
||||
}
|
||||
$found_free= check_ports_free($build_thread);
|
||||
# If not free, release and try from next number
|
||||
mtr_release_unique_id($build_thread++) unless $found_free;
|
||||
}
|
||||
#mtr_report(" - got $build_thread");
|
||||
}
|
||||
else
|
||||
{
|
||||
$build_thread = $opt_build_thread + $thread - 1;
|
||||
}
|
||||
$ENV{MTR_BUILD_THREAD}= $build_thread;
|
||||
$opt_build_thread= $build_thread;
|
||||
|
||||
if (! check_ports_free($build_thread)) {
|
||||
# Some port was not free(which one has already been printed)
|
||||
mtr_error("Some port(s) was not free")
|
||||
}
|
||||
|
||||
# Calculate baseport
|
||||
$baseport= $build_thread * 10 + 10000;
|
||||
@ -2448,22 +2498,18 @@ sub kill_leftovers ($) {
|
||||
# Check that all the ports that are going to
|
||||
# be used are free
|
||||
#
|
||||
sub check_ports_free
|
||||
sub check_ports_free ($)
|
||||
{
|
||||
my @ports_to_check;
|
||||
for ($baseport..$baseport+9){
|
||||
push(@ports_to_check, $_);
|
||||
}
|
||||
#mtr_report("Checking ports...");
|
||||
# print "@ports_to_check\n";
|
||||
foreach my $port (@ports_to_check){
|
||||
if (mtr_ping_port($port)){
|
||||
mtr_report(" - 'localhost:$port' was not free");
|
||||
return 1; # One port was not free
|
||||
my $bthread= shift;
|
||||
my $portbase = $bthread * 10 + 10000;
|
||||
for ($portbase..$portbase+9){
|
||||
if (mtr_ping_port($_)){
|
||||
mtr_report(" - 'localhost:$_' was not free");
|
||||
return 0; # One port was not free
|
||||
}
|
||||
}
|
||||
|
||||
return 0; # All ports free
|
||||
return 1; # All ports free
|
||||
}
|
||||
|
||||
|
||||
@ -3482,7 +3528,10 @@ sub start_check_warnings ($$) {
|
||||
|
||||
my $name= "warnings-".$mysqld->name();
|
||||
|
||||
extract_warning_lines($mysqld->value('log-error'));
|
||||
my $log_error= $mysqld->value('#log-error');
|
||||
# To be communicated to the test
|
||||
$ENV{MTR_LOG_ERROR}= $log_error;
|
||||
extract_warning_lines($log_error);
|
||||
|
||||
my $args;
|
||||
mtr_init_args(\$args);
|
||||
@ -3957,6 +4006,7 @@ sub mysqld_arguments ($$$) {
|
||||
mtr_add_arg($args, "%s", $arg);
|
||||
}
|
||||
}
|
||||
$opt_skip_core = $found_skip_core;
|
||||
if ( !$found_skip_core )
|
||||
{
|
||||
mtr_add_arg($args, "%s", "--core-file");
|
||||
@ -3996,6 +4046,12 @@ sub mysqld_start ($$) {
|
||||
$path_vardir_trace, $mysqld->name());
|
||||
}
|
||||
|
||||
if (IS_WINDOWS)
|
||||
{
|
||||
# Trick the server to send output to stderr, with --console
|
||||
mtr_add_arg($args, "--console");
|
||||
}
|
||||
|
||||
if ( $opt_gdb || $opt_manual_gdb )
|
||||
{
|
||||
gdb_arguments(\$args, \$exe, $mysqld->name());
|
||||
@ -4028,7 +4084,7 @@ sub mysqld_start ($$) {
|
||||
# Remove the old pidfile if any
|
||||
unlink($mysqld->value('pid-file'));
|
||||
|
||||
my $output= $mysqld->value('log-error');
|
||||
my $output= $mysqld->value('#log-error');
|
||||
if ( $opt_valgrind and $opt_debug )
|
||||
{
|
||||
# When both --valgrind and --debug is selected, send
|
||||
@ -4048,6 +4104,7 @@ sub mysqld_start ($$) {
|
||||
error => $output,
|
||||
append => 1,
|
||||
verbose => $opt_verbose,
|
||||
nocore => $opt_skip_core,
|
||||
host => undef,
|
||||
shutdown => sub { mysqld_stop($mysqld) },
|
||||
);
|
||||
@ -4100,12 +4157,6 @@ sub server_need_restart {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( $opt_embedded_server )
|
||||
{
|
||||
mtr_verbose_restart($server, "no start or restart for embedded server");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( $tinfo->{'force_restart'} ) {
|
||||
mtr_verbose_restart($server, "forced in .opt file");
|
||||
return 1;
|
||||
@ -4335,7 +4386,7 @@ sub start_servers($) {
|
||||
# Already started
|
||||
|
||||
# Write start of testcase to log file
|
||||
mark_log($mysqld->value('log-error'), $tinfo);
|
||||
mark_log($mysqld->value('#log-error'), $tinfo);
|
||||
|
||||
next;
|
||||
}
|
||||
@ -4394,7 +4445,7 @@ sub start_servers($) {
|
||||
mkpath($tmpdir) unless -d $tmpdir;
|
||||
|
||||
# Write start of testcase to log file
|
||||
mark_log($mysqld->value('log-error'), $tinfo);
|
||||
mark_log($mysqld->value('#log-error'), $tinfo);
|
||||
|
||||
# Run <tname>-master.sh
|
||||
if ($mysqld->option('#!run-master-sh') and
|
||||
@ -4445,7 +4496,7 @@ sub start_servers($) {
|
||||
$tinfo->{comment}=
|
||||
"Failed to start ".$mysqld->name();
|
||||
|
||||
my $logfile= $mysqld->value('log-error');
|
||||
my $logfile= $mysqld->value('#log-error');
|
||||
if ( defined $logfile and -f $logfile )
|
||||
{
|
||||
$tinfo->{logfile}= mtr_fromfile($logfile);
|
||||
|
Reference in New Issue
Block a user