mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
This commit is contained in:
@ -68,8 +68,8 @@ use My::File::Path; # Patched version of File::Path
|
||||
use File::Basename;
|
||||
use File::Copy;
|
||||
use File::Find;
|
||||
use File::Temp qw / tempdir /;
|
||||
use File::Spec::Functions qw / splitdir /;
|
||||
use File::Temp qw/tempdir/;
|
||||
use File::Spec::Functions qw/splitdir/;
|
||||
use My::Platform;
|
||||
use My::SafeProcess;
|
||||
use My::ConfigFactory;
|
||||
@ -87,6 +87,7 @@ use IO::Select;
|
||||
require "lib/mtr_process.pl";
|
||||
require "lib/mtr_io.pl";
|
||||
require "lib/mtr_gcov.pl";
|
||||
require "lib/mtr_gprof.pl";
|
||||
require "lib/mtr_misc.pl";
|
||||
|
||||
$SIG{INT}= sub { mtr_error("Got ^C signal"); };
|
||||
@ -118,6 +119,8 @@ END {
|
||||
}
|
||||
}
|
||||
|
||||
sub env_or_val($$) { defined $ENV{$_[0]} ? $ENV{$_[0]} : $_[1] }
|
||||
|
||||
my $path_config_file; # The generated config file, var/my.cnf
|
||||
|
||||
# Visual Studio produces executables in different sub-directories based on the
|
||||
@ -170,6 +173,9 @@ our $opt_gcov_exe= "gcov";
|
||||
our $opt_gcov_err= "mysql-test-gcov.msg";
|
||||
our $opt_gcov_msg= "mysql-test-gcov.err";
|
||||
|
||||
our $opt_gprof;
|
||||
our %gprof_dirs;
|
||||
|
||||
our $glob_debugger= 0;
|
||||
our $opt_gdb;
|
||||
our $opt_client_gdb;
|
||||
@ -188,7 +194,9 @@ our $opt_experimental;
|
||||
our $experimental_test_cases;
|
||||
|
||||
my $baseport;
|
||||
# $opt_build_thread may later be set from $opt_port_base
|
||||
my $opt_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
|
||||
my $opt_port_base= $ENV{'MTR_PORT_BASE'} || "auto";
|
||||
my $build_thread= 0;
|
||||
|
||||
my $opt_record;
|
||||
@ -198,6 +206,7 @@ my $opt_skip_core;
|
||||
|
||||
our $opt_check_testcases= 1;
|
||||
my $opt_mark_progress;
|
||||
my $opt_max_connections;
|
||||
|
||||
my $opt_sleep;
|
||||
|
||||
@ -216,7 +225,8 @@ my $start_only;
|
||||
my $opt_wait_all;
|
||||
my $opt_repeat= 1;
|
||||
my $opt_retry= 1;
|
||||
my $opt_retry_failure= 2;
|
||||
my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2);
|
||||
my $opt_reorder= 1;
|
||||
|
||||
my $opt_strace_client;
|
||||
|
||||
@ -229,6 +239,7 @@ my @default_valgrind_args= ("--show-reachable=yes");
|
||||
my @valgrind_args;
|
||||
my $opt_valgrind_path;
|
||||
my $opt_callgrind;
|
||||
my %mysqld_logs;
|
||||
my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions.
|
||||
|
||||
our $opt_warnings= 1;
|
||||
@ -245,9 +256,9 @@ our %mysqld_variables;
|
||||
|
||||
my $source_dist= 0;
|
||||
|
||||
my $opt_max_save_core= $ENV{MTR_MAX_SAVE_CORE} || 5;
|
||||
my $opt_max_save_datadir= $ENV{MTR_MAX_SAVE_DATADIR} || 20;
|
||||
my $opt_max_test_fail= $ENV{MTR_MAX_TEST_FAIL} || 10;
|
||||
my $opt_max_save_core= env_or_val(MTR_MAX_SAVE_CORE => 5);
|
||||
my $opt_max_save_datadir= env_or_val(MTR_MAX_SAVE_DATADIR => 20);
|
||||
my $opt_max_test_fail= env_or_val(MTR_MAX_TEST_FAIL => 10);
|
||||
|
||||
my $opt_parallel= $ENV{MTR_PARALLEL} || 1;
|
||||
|
||||
@ -273,6 +284,9 @@ sub main {
|
||||
|
||||
command_line_setup();
|
||||
|
||||
# --help will not reach here, so now it's safe to assume we have binaries
|
||||
My::SafeProcess::find_bin();
|
||||
|
||||
if ( $opt_gcov ) {
|
||||
gcov_prepare($basedir . "/" . $opt_gcov_src_dir);
|
||||
}
|
||||
@ -305,7 +319,7 @@ sub main {
|
||||
detect_plugins();
|
||||
|
||||
mtr_report("Collecting tests...");
|
||||
my $tests= collect_test_cases($opt_suites, \@opt_cases);
|
||||
my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases);
|
||||
|
||||
if ( $opt_report_features ) {
|
||||
# Put "report features" as the first test to run
|
||||
@ -379,7 +393,7 @@ sub main {
|
||||
mtr_print_thick_line();
|
||||
mtr_print_header();
|
||||
|
||||
my ($fail, $completed, $extra_warnings)=
|
||||
my ($prefix, $fail, $completed, $extra_warnings)=
|
||||
run_test_server($server, $tests, $opt_parallel);
|
||||
|
||||
# Send Ctrl-C to any children still running
|
||||
@ -422,7 +436,7 @@ sub main {
|
||||
$opt_gcov_msg, $opt_gcov_err);
|
||||
}
|
||||
|
||||
mtr_report_stats($fail, $completed, $extra_warnings);
|
||||
mtr_report_stats($prefix, $fail, $completed, $extra_warnings);
|
||||
|
||||
if ( @$completed != $num_tests)
|
||||
{
|
||||
@ -452,7 +466,7 @@ sub run_test_server ($$$) {
|
||||
my $result;
|
||||
my $exe_mysqld= find_mysqld($basedir) || ""; # Used as hint to CoreDump
|
||||
|
||||
my $suite_timeout_proc= My::SafeProcess->timer(suite_timeout());
|
||||
my $suite_timeout= start_timer(suite_timeout());
|
||||
|
||||
my $s= IO::Select->new();
|
||||
$s->add($server);
|
||||
@ -462,8 +476,7 @@ sub run_test_server ($$$) {
|
||||
if (mtr_wait_lock_file($opt_stop_file, $opt_stop_keep_alive))
|
||||
{
|
||||
# We were waiting so restart timer process
|
||||
$suite_timeout_proc->kill();
|
||||
$suite_timeout_proc= My::SafeProcess->timer(suite_timeout());
|
||||
my $suite_timeout= start_timer(suite_timeout());
|
||||
}
|
||||
}
|
||||
my @ready = $s->can_read(1); # Wake up once every second
|
||||
@ -482,8 +495,7 @@ sub run_test_server ($$$) {
|
||||
mtr_verbose("Child closed socket");
|
||||
$s->remove($sock);
|
||||
if (--$childs == 0){
|
||||
$suite_timeout_proc->kill();
|
||||
return ($test_failure, $completed, $extra_warnings);
|
||||
return ("Completed", $test_failure, $completed, $extra_warnings);
|
||||
}
|
||||
next;
|
||||
}
|
||||
@ -552,17 +564,15 @@ sub run_test_server ($$$) {
|
||||
$test_failure= 1;
|
||||
if ( !$opt_force ) {
|
||||
# Test has failed, force is off
|
||||
$suite_timeout_proc->kill();
|
||||
push(@$completed, $result);
|
||||
return (1, $completed, $extra_warnings);
|
||||
return ("Failure", 1, $completed, $extra_warnings);
|
||||
}
|
||||
elsif ($opt_max_test_fail > 0 and
|
||||
$num_failed_test >= $opt_max_test_fail) {
|
||||
$suite_timeout_proc->kill();
|
||||
push(@$completed, $result);
|
||||
mtr_report("Too many tests($num_failed_test) failed!",
|
||||
"Terminating...");
|
||||
return (1, $completed, $extra_warnings);
|
||||
return ("Too many failed", 1, $completed, $extra_warnings);
|
||||
}
|
||||
}
|
||||
|
||||
@ -624,8 +634,7 @@ sub run_test_server ($$$) {
|
||||
$test_failure= 1;
|
||||
if ( !$opt_force ) {
|
||||
# Test failure due to warnings, force is off
|
||||
$suite_timeout_proc->kill();
|
||||
return (1, $completed, $extra_warnings);
|
||||
return ("Warnings in log", 1, $completed, $extra_warnings);
|
||||
}
|
||||
} else {
|
||||
mtr_error("Unknown response: '$line' from client");
|
||||
@ -659,9 +668,9 @@ sub run_test_server ($$$) {
|
||||
next;
|
||||
}
|
||||
|
||||
# Prefer same configuration
|
||||
if (defined $result and
|
||||
$result->{template_path} eq $t->{template_path})
|
||||
# Prefer same configuration, or just use next if --noreorder
|
||||
if (!$opt_reorder or (defined $result and
|
||||
$result->{template_path} eq $t->{template_path}))
|
||||
{
|
||||
#mtr_report("Test uses same config => good match");
|
||||
# Test uses same config => good match
|
||||
@ -702,10 +711,10 @@ sub run_test_server ($$$) {
|
||||
# ----------------------------------------------------
|
||||
# Check if test suite timer expired
|
||||
# ----------------------------------------------------
|
||||
if ( ! $suite_timeout_proc->wait_one(0) )
|
||||
if ( has_expired($suite_timeout) )
|
||||
{
|
||||
mtr_report("Test suite timeout! Terminating...");
|
||||
return (1, $completed, $extra_warnings);
|
||||
return ("Timeout", 1, $completed, $extra_warnings);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -787,6 +796,12 @@ sub run_worker ($) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
stop_all_servers($opt_shutdown_timeout);
|
||||
}
|
||||
if ( $opt_gprof ) {
|
||||
gprof_collect (find_mysqld($basedir), keys %gprof_dirs);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
else {
|
||||
@ -872,6 +887,7 @@ sub command_line_setup {
|
||||
|
||||
# Specify ports
|
||||
'build-thread|mtr-build-thread=i' => \$opt_build_thread,
|
||||
'port-base|mtr-port-base=i' => \$opt_port_base,
|
||||
|
||||
# Test case authoring
|
||||
'record' => \$opt_record,
|
||||
@ -906,6 +922,7 @@ sub command_line_setup {
|
||||
# Coverage, profiling etc
|
||||
'gcov' => \$opt_gcov,
|
||||
'gcov-src-dir=s' => \$opt_gcov_src_dir,
|
||||
'gprof' => \$opt_gprof,
|
||||
'valgrind|valgrind-all' => \$opt_valgrind,
|
||||
'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
|
||||
'valgrind-mysqld' => \$opt_valgrind_mysqld,
|
||||
@ -936,7 +953,7 @@ sub command_line_setup {
|
||||
'report-features' => \$opt_report_features,
|
||||
'comment=s' => \$opt_comment,
|
||||
'fast' => \$opt_fast,
|
||||
'reorder!' => \&collect_option,
|
||||
'reorder!' => \$opt_reorder,
|
||||
'enable-disabled' => \&collect_option,
|
||||
'verbose+' => \$opt_verbose,
|
||||
'verbose-restart' => \&report_option,
|
||||
@ -958,6 +975,7 @@ sub command_line_setup {
|
||||
'timediff' => \&report_option,
|
||||
'stop-file=s' => \$opt_stop_file,
|
||||
'stop-keep-alive=i' => \$opt_stop_keep_alive,
|
||||
'max-connections=i' => \$opt_max_connections,
|
||||
|
||||
'help|h' => \$opt_usage,
|
||||
'list-options' => \$opt_list_options,
|
||||
@ -981,6 +999,11 @@ sub command_line_setup {
|
||||
|
||||
# Find the absolute path to the test directory
|
||||
$glob_mysql_test_dir= cwd();
|
||||
if ($glob_mysql_test_dir =~ / /)
|
||||
{
|
||||
die("Working directory \"$glob_mysql_test_dir\" contains space\n".
|
||||
"Bailing out, cannot function properly with space in path");
|
||||
}
|
||||
if (IS_CYGWIN)
|
||||
{
|
||||
# Use mixed path format i.e c:/path/to/
|
||||
@ -1145,6 +1168,21 @@ sub command_line_setup {
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_WINDOWS and defined $opt_mem) {
|
||||
mtr_report("--mem not supported on Windows, ignored");
|
||||
$opt_mem= undef;
|
||||
}
|
||||
|
||||
if ($opt_port_base ne "auto")
|
||||
{
|
||||
if (my $rem= $opt_port_base % 10)
|
||||
{
|
||||
mtr_warning ("Port base $opt_port_base rounded down to multiple of 10");
|
||||
$opt_port_base-= $rem;
|
||||
}
|
||||
$opt_build_thread= $opt_port_base / 10 - 1000;
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Check if we should speed up tests by trying to run on tmpfs
|
||||
# --------------------------------------------------------------------------
|
||||
@ -1311,7 +1349,7 @@ sub command_line_setup {
|
||||
# --------------------------------------------------------------------------
|
||||
# Gcov flag
|
||||
# --------------------------------------------------------------------------
|
||||
if ( $opt_gcov and ! $source_dist )
|
||||
if ( ($opt_gcov or $opt_gprof) and ! $source_dist )
|
||||
{
|
||||
mtr_error("Coverage test needs the source - please use source dist");
|
||||
}
|
||||
@ -1422,8 +1460,7 @@ sub command_line_setup {
|
||||
push(@valgrind_args, @default_valgrind_args)
|
||||
unless @valgrind_args;
|
||||
|
||||
# Make valgrind run in quiet mode so it only print errors
|
||||
push(@valgrind_args, "--quiet" );
|
||||
# Don't add --quiet; you will loose the summary reports.
|
||||
|
||||
mtr_report("Running valgrind with options \"",
|
||||
join(" ", @valgrind_args), "\"");
|
||||
@ -1544,6 +1581,12 @@ sub collect_mysqld_features {
|
||||
mtr_add_arg($args, "--verbose");
|
||||
mtr_add_arg($args, "--help");
|
||||
|
||||
# Need --user=root if running as *nix root user
|
||||
if (!IS_WINDOWS and $> == 0)
|
||||
{
|
||||
mtr_add_arg($args, "--user=root");
|
||||
}
|
||||
|
||||
my $exe_mysqld= find_mysqld($basedir);
|
||||
my $cmd= join(" ", $exe_mysqld, @$args);
|
||||
my $list= `$cmd`;
|
||||
@ -1937,11 +1980,11 @@ sub environment_setup {
|
||||
{
|
||||
push(@ld_library_paths, "$basedir/libmysql/.libs/",
|
||||
"$basedir/libmysql_r/.libs/",
|
||||
"$basedir/zlib.libs/");
|
||||
"$basedir/zlib/.libs/");
|
||||
}
|
||||
else
|
||||
{
|
||||
push(@ld_library_paths, "$basedir/lib");
|
||||
push(@ld_library_paths, "$basedir/lib", "$basedir/lib/mysql");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2670,6 +2713,7 @@ sub create_config_file_for_extern {
|
||||
# binlog reads from [client] and [mysqlbinlog]
|
||||
[mysqlbinlog]
|
||||
character-sets-dir= $path_charsetsdir
|
||||
local-load= $opt_tmpdir
|
||||
|
||||
# mysql_fix_privilege_tables.sh don't read from [client]
|
||||
[mysql_fix_privilege_tables]
|
||||
@ -3128,11 +3172,11 @@ sub check_testcase($$)
|
||||
# Return immediately if no check proceess was started
|
||||
return 0 unless ( keys %started );
|
||||
|
||||
my $timeout_proc= My::SafeProcess->timer(check_timeout());
|
||||
my $timeout= start_timer(check_timeout());
|
||||
|
||||
while (1){
|
||||
my $result;
|
||||
my $proc= My::SafeProcess->wait_any();
|
||||
my $proc= My::SafeProcess->wait_any_timeout($timeout);
|
||||
mtr_report("Got $proc");
|
||||
|
||||
if ( delete $started{$proc->pid()} ) {
|
||||
@ -3156,9 +3200,6 @@ sub check_testcase($$)
|
||||
|
||||
if ( keys(%started) == 0){
|
||||
# All checks completed
|
||||
|
||||
$timeout_proc->kill();
|
||||
|
||||
return 0;
|
||||
}
|
||||
# Wait for next process to exit
|
||||
@ -3203,10 +3244,9 @@ test case was executed:\n";
|
||||
|
||||
}
|
||||
}
|
||||
elsif ( $proc eq $timeout_proc ) {
|
||||
$tinfo->{comment}.= "Timeout $timeout_proc for ".
|
||||
"'check-testcase' expired after ".check_timeout().
|
||||
" seconds";
|
||||
elsif ( $proc->{timeout} ) {
|
||||
$tinfo->{comment}.= "Timeout for 'check-testcase' expired after "
|
||||
.check_timeout()." seconds";
|
||||
$result= 4;
|
||||
}
|
||||
else {
|
||||
@ -3221,8 +3261,6 @@ test case was executed:\n";
|
||||
# Kill any check processes still running
|
||||
map($_->kill(), values(%started));
|
||||
|
||||
$timeout_proc->kill();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -3294,11 +3332,11 @@ sub run_on_all($$)
|
||||
# Return immediately if no check proceess was started
|
||||
return 0 unless ( keys %started );
|
||||
|
||||
my $timeout_proc= My::SafeProcess->timer(check_timeout());
|
||||
my $timeout= start_timer(check_timeout());
|
||||
|
||||
while (1){
|
||||
my $result;
|
||||
my $proc= My::SafeProcess->wait_any();
|
||||
my $proc= My::SafeProcess->wait_any_timeout($timeout);
|
||||
mtr_report("Got $proc");
|
||||
|
||||
if ( delete $started{$proc->pid()} ) {
|
||||
@ -3317,17 +3355,15 @@ sub run_on_all($$)
|
||||
|
||||
if ( keys(%started) == 0){
|
||||
# All completed
|
||||
$timeout_proc->kill();
|
||||
return 0;
|
||||
}
|
||||
|
||||
# Wait for next process to exit
|
||||
next;
|
||||
}
|
||||
elsif ( $proc eq $timeout_proc ) {
|
||||
$tinfo->{comment}.= "Timeout $timeout_proc for '$run' ".
|
||||
"expired after ". check_timeout().
|
||||
" seconds";
|
||||
elsif ($proc->{timeout}) {
|
||||
$tinfo->{comment}.= "Timeout for '$run' expired after "
|
||||
.check_timeout()." seconds";
|
||||
}
|
||||
else {
|
||||
# Unknown process returned, most likley a crash, abort everything
|
||||
@ -3339,8 +3375,6 @@ sub run_on_all($$)
|
||||
# Kill any check processes still running
|
||||
map($_->kill(), values(%started));
|
||||
|
||||
$timeout_proc->kill();
|
||||
|
||||
return 1;
|
||||
}
|
||||
mtr_error("INTERNAL_ERROR: run_on_all");
|
||||
@ -3448,9 +3482,11 @@ sub run_testcase ($$) {
|
||||
|
||||
mtr_verbose("Running test:", $tinfo->{name});
|
||||
|
||||
# Allow only alpanumerics pluss _ - + . in combination names
|
||||
# Allow only alpanumerics pluss _ - + . in combination names,
|
||||
# or anything beginning with -- (the latter comes from --combination)
|
||||
my $combination= $tinfo->{combination};
|
||||
if ($combination && $combination !~ /^\w[-\w\.\+]+$/)
|
||||
if ($combination && $combination !~ /^\w[-\w\.\+]+$/
|
||||
&& $combination !~ /^--/)
|
||||
{
|
||||
mtr_error("Combination '$combination' contains illegal characters");
|
||||
}
|
||||
@ -3580,7 +3616,7 @@ sub run_testcase ($$) {
|
||||
}
|
||||
}
|
||||
|
||||
my $test_timeout_proc= My::SafeProcess->timer(testcase_timeout());
|
||||
my $test_timeout= start_timer(testcase_timeout());
|
||||
|
||||
do_before_run_mysqltest($tinfo);
|
||||
|
||||
@ -3588,9 +3624,6 @@ sub run_testcase ($$) {
|
||||
# Failed to record state of server or server crashed
|
||||
report_failure_and_restart($tinfo);
|
||||
|
||||
# Stop the test case timer
|
||||
$test_timeout_proc->kill();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -3608,20 +3641,20 @@ sub run_testcase ($$) {
|
||||
if ($proc)
|
||||
{
|
||||
mtr_verbose ("Found exited process $proc");
|
||||
# If that was the timeout, cancel waiting
|
||||
if ( $proc eq $test_timeout_proc )
|
||||
{
|
||||
$keep_waiting_proc = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$proc = $keep_waiting_proc;
|
||||
# Also check if timer has expired, if so cancel waiting
|
||||
if ( has_expired($test_timeout) )
|
||||
{
|
||||
$keep_waiting_proc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (! $keep_waiting_proc)
|
||||
{
|
||||
$proc= My::SafeProcess->wait_any();
|
||||
$proc= My::SafeProcess->wait_any_timeout($test_timeout);
|
||||
}
|
||||
|
||||
# Will be restored if we need to keep waiting
|
||||
@ -3638,9 +3671,6 @@ sub run_testcase ($$) {
|
||||
# ----------------------------------------------------
|
||||
if ($proc eq $test)
|
||||
{
|
||||
# Stop the test case timer
|
||||
$test_timeout_proc->kill();
|
||||
|
||||
my $res= $test->exit_status();
|
||||
|
||||
if ($res == 0 and $opt_warnings and check_warnings($tinfo) )
|
||||
@ -3708,6 +3738,14 @@ sub run_testcase ($$) {
|
||||
run_on_all($tinfo, "analyze-$analyze");
|
||||
}
|
||||
|
||||
# Wait a bit and see if a server died, if so report that instead
|
||||
mtr_milli_sleep(100);
|
||||
my $srvproc= My::SafeProcess::check_any();
|
||||
if ($srvproc && grep($srvproc eq $_, started(all_servers()))) {
|
||||
$proc= $srvproc;
|
||||
goto SRVDIED;
|
||||
}
|
||||
|
||||
# Test case failure reported by mysqltest
|
||||
report_failure_and_restart($tinfo);
|
||||
}
|
||||
@ -3715,7 +3753,7 @@ sub run_testcase ($$) {
|
||||
{
|
||||
# mysqltest failed, probably crashed
|
||||
$tinfo->{comment}=
|
||||
"mysqltest failed with unexpected return code $res";
|
||||
"mysqltest failed with unexpected return code $res\n";
|
||||
report_failure_and_restart($tinfo);
|
||||
}
|
||||
|
||||
@ -3733,6 +3771,7 @@ sub run_testcase ($$) {
|
||||
# ----------------------------------------------------
|
||||
# Check if it was an expected crash
|
||||
# ----------------------------------------------------
|
||||
SRVDIED:
|
||||
my $check_crash = check_expected_crash_and_restart($proc);
|
||||
if ($check_crash)
|
||||
{
|
||||
@ -3745,7 +3784,7 @@ sub run_testcase ($$) {
|
||||
# ----------------------------------------------------
|
||||
# Stop the test case timer
|
||||
# ----------------------------------------------------
|
||||
$test_timeout_proc->kill();
|
||||
$test_timeout= 0;
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Check if it was a server that died
|
||||
@ -3784,7 +3823,7 @@ sub run_testcase ($$) {
|
||||
# ----------------------------------------------------
|
||||
# Check if testcase timer expired
|
||||
# ----------------------------------------------------
|
||||
if ( $proc eq $test_timeout_proc )
|
||||
if ( $proc->{timeout} )
|
||||
{
|
||||
my $log_file_name= $opt_vardir."/log/".$tinfo->{shortname}.".log";
|
||||
$tinfo->{comment}=
|
||||
@ -3977,7 +4016,7 @@ sub extract_warning_lines ($) {
|
||||
(
|
||||
qr/^Warning:|mysqld: Warning|\[Warning\]/,
|
||||
qr/^Error:|\[ERROR\]/,
|
||||
qr/^==\d*==/, # valgrind errors
|
||||
qr/^==\d+==\s+\S/, # valgrind errors
|
||||
qr/InnoDB: Warning|InnoDB: Error/,
|
||||
qr/^safe_mutex:|allocated at line/,
|
||||
qr/missing DBUG_RETURN/,
|
||||
@ -4078,7 +4117,6 @@ sub start_check_warnings ($$) {
|
||||
|
||||
mtr_add_arg($args, "--skip-safemalloc");
|
||||
mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test");
|
||||
mtr_add_arg($args, "--verbose");
|
||||
|
||||
if ( $opt_embedded_server )
|
||||
{
|
||||
@ -4141,11 +4179,11 @@ sub check_warnings ($) {
|
||||
# Return immediately if no check proceess was started
|
||||
return 0 unless ( keys %started );
|
||||
|
||||
my $timeout_proc= My::SafeProcess->timer(check_timeout());
|
||||
my $timeout= start_timer(check_timeout());
|
||||
|
||||
while (1){
|
||||
my $result= 0;
|
||||
my $proc= My::SafeProcess->wait_any();
|
||||
my $proc= My::SafeProcess->wait_any_timeout($timeout);
|
||||
mtr_report("Got $proc");
|
||||
|
||||
if ( delete $started{$proc->pid()} ) {
|
||||
@ -4174,9 +4212,6 @@ sub check_warnings ($) {
|
||||
|
||||
if ( keys(%started) == 0){
|
||||
# All checks completed
|
||||
|
||||
$timeout_proc->kill();
|
||||
|
||||
return $result;
|
||||
}
|
||||
# Wait for next process to exit
|
||||
@ -4194,10 +4229,9 @@ sub check_warnings ($) {
|
||||
$result= 2;
|
||||
}
|
||||
}
|
||||
elsif ( $proc eq $timeout_proc ) {
|
||||
$tinfo->{comment}.= "Timeout $timeout_proc for ".
|
||||
"'check warnings' expired after ".check_timeout().
|
||||
" seconds";
|
||||
elsif ( $proc->{timeout} ) {
|
||||
$tinfo->{comment}.= "Timeout for 'check warnings' expired after "
|
||||
.check_timeout()." seconds";
|
||||
$result= 4;
|
||||
}
|
||||
else {
|
||||
@ -4211,8 +4245,6 @@ sub check_warnings ($) {
|
||||
# Kill any check processes still running
|
||||
map($_->kill(), values(%started));
|
||||
|
||||
$timeout_proc->kill();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -4252,7 +4284,7 @@ sub check_expected_crash_and_restart {
|
||||
|
||||
foreach my $mysqld ( mysqlds() )
|
||||
{
|
||||
next unless ( $mysqld->{proc} eq $proc );
|
||||
next unless ( $mysqld->{proc} and $mysqld->{proc} eq $proc );
|
||||
|
||||
# Check if crash expected by looking at the .expect file
|
||||
# in var/tmp
|
||||
@ -4451,6 +4483,20 @@ sub report_failure_and_restart ($) {
|
||||
# about what failed has been saved to file. Save the report
|
||||
# in tinfo
|
||||
$tinfo->{logfile}= mtr_fromfile($logfile);
|
||||
# If no newlines in the test log:
|
||||
# (it will contain the CURRENT_TEST written by mtr, so is not empty)
|
||||
if ($tinfo->{logfile} !~ /\n/)
|
||||
{
|
||||
# Show how far it got before suddenly failing
|
||||
$tinfo->{comment}.= "mysqltest failed but provided no output\n";
|
||||
my $log_file_name= $opt_vardir."/log/".$tinfo->{shortname}.".log";
|
||||
if (-e $log_file_name) {
|
||||
$tinfo->{comment}.=
|
||||
"The result from queries just before the failure was:".
|
||||
"\n< snip >\n".
|
||||
mtr_lastlinesfromfile($log_file_name, 20)."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4674,6 +4720,10 @@ sub mysqld_start ($$) {
|
||||
$output= $trace_name;
|
||||
|
||||
}
|
||||
# Remember this log file for valgrind error report search
|
||||
$mysqld_logs{$output}= 1 if $opt_valgrind;
|
||||
# Remember data dir for gmon.out files if using gprof
|
||||
$gprof_dirs{$mysqld->value('datadir')}= 1 if $opt_gprof;
|
||||
|
||||
if ( defined $exe )
|
||||
{
|
||||
@ -5227,6 +5277,9 @@ sub start_mysqltest ($) {
|
||||
{
|
||||
mtr_add_arg($args, "%s", $arg);
|
||||
}
|
||||
if ( $opt_max_connections ) {
|
||||
mtr_add_arg($args, "--max-connections=%d", $opt_max_connections);
|
||||
}
|
||||
|
||||
if ( $opt_embedded_server )
|
||||
{
|
||||
@ -5335,7 +5388,7 @@ sub gdb_arguments {
|
||||
my $type= shift;
|
||||
|
||||
# Write $args to gdb init file
|
||||
my $str= join(" ", @$$args);
|
||||
my $str= join " ", map { s/"/\\"/g; "\"$_\""; } @$$args;
|
||||
my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type";
|
||||
|
||||
# Remove the old gdbinit file
|
||||
@ -5399,7 +5452,7 @@ sub ddd_arguments {
|
||||
my $type= shift;
|
||||
|
||||
# Write $args to ddd init file
|
||||
my $str= join(" ", @$$args);
|
||||
my $str= join " ", map { s/"/\\"/g; "\"$_\""; } @$$args;
|
||||
my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type";
|
||||
|
||||
# Remove the old gdbinit file
|
||||
@ -5463,9 +5516,9 @@ sub debugger_arguments {
|
||||
{
|
||||
# vc[express] /debugexe exe arg1 .. argn
|
||||
|
||||
# Add /debugexe and name of the exe before args
|
||||
unshift(@$$args, "/debugexe");
|
||||
# Add name of the exe and /debugexe before args
|
||||
unshift(@$$args, "$$exe");
|
||||
unshift(@$$args, "/debugexe");
|
||||
|
||||
# Set exe to debuggername
|
||||
$$exe= $debugger;
|
||||
@ -5538,6 +5591,66 @@ sub valgrind_arguments {
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Search server logs for valgrind reports printed at mysqld termination
|
||||
#
|
||||
|
||||
sub valgrind_exit_reports() {
|
||||
foreach my $log_file (keys %mysqld_logs)
|
||||
{
|
||||
my @culprits= ();
|
||||
my $valgrind_rep= "";
|
||||
my $found_report= 0;
|
||||
my $err_in_report= 0;
|
||||
|
||||
my $LOGF = IO::File->new($log_file)
|
||||
or mtr_error("Could not open file '$log_file' for reading: $!");
|
||||
|
||||
while ( my $line = <$LOGF> )
|
||||
{
|
||||
if ($line =~ /^CURRENT_TEST: (.+)$/)
|
||||
{
|
||||
my $testname= $1;
|
||||
# If we have a report, report it if needed and start new list of tests
|
||||
if ($found_report)
|
||||
{
|
||||
if ($err_in_report)
|
||||
{
|
||||
mtr_print ("Valgrind report from $log_file after tests:\n",
|
||||
@culprits);
|
||||
mtr_print_line();
|
||||
print ("$valgrind_rep\n");
|
||||
$err_in_report= 0;
|
||||
}
|
||||
# Make ready to collect new report
|
||||
@culprits= ();
|
||||
$found_report= 0;
|
||||
$valgrind_rep= "";
|
||||
}
|
||||
push (@culprits, $testname);
|
||||
next;
|
||||
}
|
||||
# This line marks the start of a valgrind report
|
||||
$found_report= 1 if $line =~ /ERROR SUMMARY:/;
|
||||
|
||||
if ($found_report) {
|
||||
$line=~ s/^==\d+== //;
|
||||
$valgrind_rep .= $line;
|
||||
$err_in_report= 1 if $line =~ /ERROR SUMMARY: [1-9]/;
|
||||
$err_in_report= 1 if $line =~ /definitely lost: [1-9]/;
|
||||
$err_in_report= 1 if $line =~ /possibly lost: [1-9]/;
|
||||
}
|
||||
}
|
||||
|
||||
$LOGF= undef;
|
||||
|
||||
if ($err_in_report) {
|
||||
mtr_print ("Valgrind report from $log_file after tests:\n", @culprits);
|
||||
mtr_print_line();
|
||||
print ("$valgrind_rep\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Usage
|
||||
@ -5621,6 +5734,11 @@ Options to control what test suites or cases to run
|
||||
|
||||
Options that specify ports
|
||||
|
||||
mtr-port-base=# Base for port numbers, ports from this number to
|
||||
port-base=# number+9 are reserved. Should be divisible by 10;
|
||||
if not it will be rounded down. May be set with
|
||||
environment variable MTR_PORT_BASE. If this value is
|
||||
set and is not "auto", it overrides build-thread.
|
||||
mtr-build-thread=# Specify unique number to calculate port number(s) from.
|
||||
build-thread=# Can be set in environment variable MTR_BUILD_THREAD.
|
||||
Set MTR_BUILD_THREAD="auto" to automatically aquire
|
||||
@ -5747,18 +5865,18 @@ Misc options
|
||||
timestamp Print timestamp before each test report line
|
||||
timediff With --timestamp, also print time passed since
|
||||
*previous* test started
|
||||
max-connections=N Max number of open connection to server in mysqltest
|
||||
|
||||
HERE
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub list_options ($) {
|
||||
my $hash= shift;
|
||||
|
||||
for (keys %$hash) {
|
||||
s/(=.*|!)$//;
|
||||
s/([:=].*|[+!])$//;
|
||||
s/\|/\n--/g;
|
||||
print "--$_\n";
|
||||
}
|
||||
|
Reference in New Issue
Block a user