Commit 6b15f768 authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge neptunus.(none):/home/msvensson/mysql/same_tools/my41-same_tools

into  neptunus.(none):/home/msvensson/mysql/same_tools/my50-same_tools
parents f39ff057 d8191af7
...@@ -802,7 +802,7 @@ void abort_not_supported_test(const char *fmt, ...) ...@@ -802,7 +802,7 @@ void abort_not_supported_test(const char *fmt, ...)
void abort_not_in_this_version() void abort_not_in_this_version()
{ {
die("Not available in mysqltest for MySQL %s", VERSION); die("Not available in this version of mysqltest");
} }
......
...@@ -5,11 +5,14 @@ ...@@ -5,11 +5,14 @@
# same name. # same name.
use File::Basename; use File::Basename;
use IO::File();
use strict; use strict;
sub collect_test_cases ($); sub collect_test_cases ($);
sub collect_one_test_case ($$$$$$$); sub collect_one_test_case ($$$$$$$);
sub mtr_options_from_test_file($$);
############################################################################## ##############################################################################
# #
# Collect information about test cases we are to run # Collect information about test cases we are to run
...@@ -37,6 +40,23 @@ sub collect_test_cases ($) { ...@@ -37,6 +40,23 @@ sub collect_test_cases ($) {
opendir(TESTDIR, $testdir) or mtr_error("Can't open dir \"$testdir\": $!"); opendir(TESTDIR, $testdir) or mtr_error("Can't open dir \"$testdir\": $!");
# ----------------------------------------------------------------------
# Disable some tests listed in disabled.def
# ----------------------------------------------------------------------
my %disabled;
if ( open(DISABLED, "$testdir/disabled.def" ) )
{
while ( <DISABLED> )
{
chomp;
if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
{
$disabled{$1}= $2;
}
}
close DISABLED;
}
if ( @::opt_cases ) if ( @::opt_cases )
{ {
foreach my $tname ( @::opt_cases ) { # Run in specified order, no sort foreach my $tname ( @::opt_cases ) { # Run in specified order, no sort
...@@ -100,30 +120,13 @@ sub collect_test_cases ($) { ...@@ -100,30 +120,13 @@ sub collect_test_cases ($) {
} }
} }
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,{}, collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,\%disabled,
$component_id); $component_id);
} }
closedir TESTDIR; closedir TESTDIR;
} }
else else
{ {
# ----------------------------------------------------------------------
# Disable some tests listed in disabled.def
# ----------------------------------------------------------------------
my %disabled;
if ( ! $::opt_ignore_disabled_def and open(DISABLED, "$testdir/disabled.def" ) )
{
while ( <DISABLED> )
{
chomp;
if ( /^\s*([^\s:]+)\s*:\s*(.*?)\s*$/ )
{
$disabled{$1}= $2;
}
}
close DISABLED;
}
foreach my $elem ( sort readdir(TESTDIR) ) { foreach my $elem ( sort readdir(TESTDIR) ) {
my $component_id= undef; my $component_id= undef;
my $tname= undef; my $tname= undef;
...@@ -247,48 +250,54 @@ sub collect_one_test_case($$$$$$$) { ...@@ -247,48 +250,54 @@ sub collect_one_test_case($$$$$$$) {
if ( $::opt_skip_rpl ) if ( $::opt_skip_rpl )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No replication tests(--skip-rpl)";
return; return;
} }
$tinfo->{'slave_num'}= 1; # Default, use one slave $tinfo->{'slave_num'}= 1; # Default, use one slave
# FIXME currently we always restart slaves
$tinfo->{'slave_restart'}= 1;
if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' ) if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' )
{ {
# $tinfo->{'slave_num'}= 3; # Not 3 ? Check old code, strange # $tinfo->{'slave_num'}= 3; # Not 3 ? Check old code, strange
} }
} }
if ( defined mtr_match_prefix($tname,"federated") ) if ( defined mtr_match_prefix($tname,"federated") )
{ {
$tinfo->{'slave_num'}= 1; # Default, use one slave # Default, federated uses the first slave as it's federated database
$tinfo->{'slave_num'}= 1;
# FIXME currently we always restart slaves
$tinfo->{'slave_restart'}= 1;
} }
# Cluster is needed by test case if testname contains ndb if ( $::opt_with_ndbcluster or defined mtr_match_substring($tname,"ndb") )
if ( defined mtr_match_substring($tname,"ndb") )
{ {
# This is an ndb test or all tests should be run with ndb cluster started
$tinfo->{'ndb_test'}= 1; $tinfo->{'ndb_test'}= 1;
if ( $::opt_skip_ndbcluster ) if ( $::opt_skip_ndbcluster )
{ {
# Skip all ndb tests # All ndb test's should be skipped
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No ndbcluster test(--skip-ndbcluster)";
return; return;
} }
if ( ! $::opt_with_ndbcluster ) if ( ! $::opt_ndbcluster_supported )
{ {
# Ndb is not supported, skip them # Ndb is not supported, skip them
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No ndbcluster support";
return; return;
} }
} }
else else
{ {
# This is not a ndb test
$tinfo->{'ndb_test'}= 0; $tinfo->{'ndb_test'}= 0;
if ( $::opt_with_ndbcluster_only )
{
# Only the ndb test should be run, all other should be skipped
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Only ndbcluster tests(--with-ndbcluster-only)";
return;
}
} }
# FIXME what about embedded_server + ndbcluster, skip ?! # FIXME what about embedded_server + ndbcluster, skip ?!
...@@ -380,6 +389,8 @@ sub collect_one_test_case($$$$$$$) { ...@@ -380,6 +389,8 @@ sub collect_one_test_case($$$$$$$) {
if ( $::glob_win32_perl ) if ( $::glob_win32_perl )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No tests with sh scripts on Windows";
return;
} }
else else
{ {
...@@ -393,6 +404,8 @@ sub collect_one_test_case($$$$$$$) { ...@@ -393,6 +404,8 @@ sub collect_one_test_case($$$$$$$) {
if ( $::glob_win32_perl ) if ( $::glob_win32_perl )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No tests with sh scripts on Windows";
return;
} }
else else
{ {
...@@ -411,18 +424,34 @@ sub collect_one_test_case($$$$$$$) { ...@@ -411,18 +424,34 @@ sub collect_one_test_case($$$$$$$) {
} }
# FIXME why this late? # FIXME why this late?
my $marked_as_disabled= 0;
if ( $disabled->{$tname} ) if ( $disabled->{$tname} )
{ {
$tinfo->{'skip'}= 1; $marked_as_disabled= 1;
$tinfo->{'disable'}= 1; # Sub type of 'skip' $tinfo->{'comment'}= $disabled->{$tname};
$tinfo->{'comment'}= $disabled->{$tname} if $disabled->{$tname};
} }
if ( -f $disabled_file ) if ( -f $disabled_file )
{
$marked_as_disabled= 1;
$tinfo->{'comment'}= mtr_fromfile($disabled_file);
}
# If test was marked as disabled, either opt_enable_disabled is off and then
# we skip this test, or it is on and then we run this test but warn
if ( $marked_as_disabled )
{
if ( $::opt_enable_disabled )
{
$tinfo->{'dont_skip_though_disabled'}= 1;
}
else
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'disable'}= 1; # Sub type of 'skip' $tinfo->{'disable'}= 1; # Sub type of 'skip'
$tinfo->{'comment'}= mtr_fromfile($disabled_file); return;
}
} }
if ( $component_id eq 'im' ) if ( $component_id eq 'im' )
...@@ -430,26 +459,60 @@ sub collect_one_test_case($$$$$$$) { ...@@ -430,26 +459,60 @@ sub collect_one_test_case($$$$$$$) {
if ( $::glob_use_embedded_server ) if ( $::glob_use_embedded_server )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No IM with embedded server";
mtr_report( return;
"Instance Manager tests are not available in embedded mode. " .
"Test case '$tname' is skipped.");
} }
elsif ( $::opt_ps_protocol ) elsif ( $::opt_ps_protocol )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No IM with --ps-protocol";
mtr_report( return;
"Instance Manager tests are not run with --ps-protocol. " .
"Test case '$tname' is skipped.");
} }
elsif ( $::opt_skip_im ) elsif ( $::opt_skip_im )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No IM tests(--skip-im)";
return;
}
}
else
{
mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
mtr_report( if ( $tinfo->{'big_test'} and ! $::opt_big_test )
"Instance Manager executable is unavailable." . {
"Test case '$tname' is skipped."); $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Test need 'big-test' option";
return;
}
if ( $tinfo->{'ndb_extra'} and ! $::opt_ndb_extra_test )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Test need 'ndb_extra' option";
return;
}
if ( $tinfo->{'require_manager'} )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Test need the _old_ manager(to be removed)";
return;
}
if ( defined $tinfo->{'binlog_format'} and
! ( $tinfo->{'binlog_format'} eq $::used_binlog_format ) )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Not running with binlog format '$tinfo->{'binlog_format'}'";
return;
}
if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Test need debug binaries";
return;
} }
} }
...@@ -459,8 +522,58 @@ sub collect_one_test_case($$$$$$$) { ...@@ -459,8 +522,58 @@ sub collect_one_test_case($$$$$$$) {
( $tinfo->{'master_restart'} or $tinfo->{'slave_restart'} ) ) ( $tinfo->{'master_restart'} or $tinfo->{'slave_restart'} ) )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Can't restart a running server";
return;
} }
} }
# List of tags in the .test files that if found should set
# the specified value in "tinfo"
our @tags=
(
["include/have_innodb.inc", "innodb_test", 1],
["include/have_binlog_format_row.inc", "binlog_format", "row"],
["include/have_binlog_format_statement.inc", "binlog_format", "stmt"],
["include/big_test.inc", "big_test", 1],
["include/have_debug.inc", "need_debug", 1],
["include/have_ndb_extra.inc", "ndb_extra", 1],
["require_manager", "require_manager", 1],
);
sub mtr_options_from_test_file($$) {
my $tinfo= shift;
my $file= shift;
#mtr_verbose("$file");
my $F= IO::File->new($file) or mtr_error("can't open file \"$file\": $!");
while ( my $line= <$F> )
{
next if ( $line !~ /^--/ );
# Match this line against tag in "tags" array
foreach my $tag (@tags)
{
if ( index($line, $tag->[0]) >= 0 )
{
# Tag matched, assign value to "tinfo"
$tinfo->{"$tag->[1]"}= $tag->[2];
}
}
# If test sources another file, open it as well
if ( $line =~ /^\-\-([[:space:]]*)source(.*)$/ )
{
my $value= $2;
$value =~ s/^\s+//; # Remove leading space
$value =~ s/[[:space:]]+$//; # Remove ending space
my $sourced_file= "$::glob_mysql_test_dir/$value";
mtr_options_from_test_file($tinfo, $sourced_file);
}
}
}
1; 1;
This diff is collapsed.
...@@ -11,6 +11,8 @@ sub mtr_get_opts_from_file ($); ...@@ -11,6 +11,8 @@ sub mtr_get_opts_from_file ($);
sub mtr_fromfile ($); sub mtr_fromfile ($);
sub mtr_tofile ($@); sub mtr_tofile ($@);
sub mtr_tonewfile($@); sub mtr_tonewfile($@);
sub mtr_lastlinefromfile($);
sub mtr_appendfile_to_file ($$);
############################################################################## ##############################################################################
# #
...@@ -139,6 +141,20 @@ sub mtr_fromfile ($) { ...@@ -139,6 +141,20 @@ sub mtr_fromfile ($) {
return $text; return $text;
} }
sub mtr_lastlinefromfile ($) {
my $file= shift;
my $text;
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
while (my $line= <FILE>)
{
$text= $line;
}
close FILE;
return $text;
}
sub mtr_tofile ($@) { sub mtr_tofile ($@) {
my $file= shift; my $file= shift;
...@@ -155,5 +171,17 @@ sub mtr_tonewfile ($@) { ...@@ -155,5 +171,17 @@ sub mtr_tonewfile ($@) {
close FILE; close FILE;
} }
sub mtr_appendfile_to_file ($$) {
my $from_file= shift;
my $to_file= shift;
open(TOFILE,">>",$to_file) or mtr_error("can't open file \"$to_file\": $!");
open(FROMFILE,">>",$from_file)
or mtr_error("can't open file \"$from_file\": $!");
print TOFILE while (<FROMFILE>);
close FROMFILE;
close TOFILE;
}
1; 1;
...@@ -139,6 +139,8 @@ sub mtr_copy_dir($$) { ...@@ -139,6 +139,8 @@ sub mtr_copy_dir($$) {
my $from_dir= shift; my $from_dir= shift;
my $to_dir= shift; my $to_dir= shift;
# mtr_verbose("Copying from $from_dir to $to_dir");
mkpath("$to_dir"); mkpath("$to_dir");
opendir(DIR, "$from_dir") opendir(DIR, "$from_dir")
or mtr_error("Can't find $from_dir$!"); or mtr_error("Can't find $from_dir$!");
......
This diff is collapsed.
...@@ -10,6 +10,7 @@ sub mtr_report_test_name($); ...@@ -10,6 +10,7 @@ sub mtr_report_test_name($);
sub mtr_report_test_passed($); sub mtr_report_test_passed($);
sub mtr_report_test_failed($); sub mtr_report_test_failed($);
sub mtr_report_test_skipped($); sub mtr_report_test_skipped($);
sub mtr_report_test_not_skipped_though_disabled($);
sub mtr_show_failed_diff ($); sub mtr_show_failed_diff ($);
sub mtr_report_stats ($); sub mtr_report_stats ($);
...@@ -21,6 +22,7 @@ sub mtr_warning (@); ...@@ -21,6 +22,7 @@ sub mtr_warning (@);
sub mtr_error (@); sub mtr_error (@);
sub mtr_child_error (@); sub mtr_child_error (@);
sub mtr_debug (@); sub mtr_debug (@);
sub mtr_verbose (@);
############################################################################## ##############################################################################
...@@ -96,7 +98,24 @@ sub mtr_report_test_skipped ($) { ...@@ -96,7 +98,24 @@ sub mtr_report_test_skipped ($) {
} }
else else
{ {
print "[ skipped ]\n"; print "[ skipped ] $tinfo->{'comment'}\n";
}
}
sub mtr_report_tests_not_skipped_though_disabled ($) {
my $tests= shift;
if ( $::opt_enable_disabled )
{
my @disabled_tests= grep {$_->{'dont_skip_though_disabled'}} @$tests;
if ( @disabled_tests )
{
print "\nTest(s) which will be run though they are marked as disabled:\n";
foreach my $tinfo ( sort {$a->{'name'} cmp $b->{'name'}} @disabled_tests )
{
printf " %-20s : %s\n", $tinfo->{'name'}, $tinfo->{'comment'};
}
}
} }
} }
...@@ -107,7 +126,7 @@ sub mtr_report_test_passed ($) { ...@@ -107,7 +126,7 @@ sub mtr_report_test_passed ($) {
if ( $::opt_timer and -f "$::opt_vardir/log/timer" ) if ( $::opt_timer and -f "$::opt_vardir/log/timer" )
{ {
$timer= mtr_fromfile("$::opt_vardir/log/timer"); $timer= mtr_fromfile("$::opt_vardir/log/timer");
$::glob_tot_real_time += $timer; $::glob_tot_real_time += ($timer/1000);
$timer= sprintf "%12s", $timer; $timer= sprintf "%12s", $timer;
} }
$tinfo->{'result'}= 'MTR_RES_PASSED'; $tinfo->{'result'}= 'MTR_RES_PASSED';
...@@ -122,7 +141,7 @@ sub mtr_report_test_failed ($) { ...@@ -122,7 +141,7 @@ sub mtr_report_test_failed ($) {
{ {
print "[ fail ] timeout\n"; print "[ fail ] timeout\n";
} }
elsif ( $tinfo->{'ndb_test'} and !$::flag_ndb_status_ok) elsif ( $tinfo->{'ndb_test'} and $::cluster->[0]->{'installed_ok'} eq "NO")
{ {
print "[ fail ] ndbcluster start failure\n"; print "[ fail ] ndbcluster start failure\n";
return; return;
...@@ -157,6 +176,7 @@ sub mtr_report_stats ($) { ...@@ -157,6 +176,7 @@ sub mtr_report_stats ($) {
my $tot_passed= 0; my $tot_passed= 0;
my $tot_failed= 0; my $tot_failed= 0;
my $tot_tests= 0; my $tot_tests= 0;
my $tot_restarts= 0;
my $found_problems= 0; # Some warnings are errors... my $found_problems= 0; # Some warnings are errors...
foreach my $tinfo (@$tests) foreach my $tinfo (@$tests)
...@@ -175,6 +195,10 @@ sub mtr_report_stats ($) { ...@@ -175,6 +195,10 @@ sub mtr_report_stats ($) {
$tot_tests++; $tot_tests++;
$tot_failed++; $tot_failed++;
} }
if ( $tinfo->{'restarted'} )
{
$tot_restarts++;
}
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
...@@ -197,6 +221,14 @@ sub mtr_report_stats ($) { ...@@ -197,6 +221,14 @@ sub mtr_report_stats ($) {
"the documentation at\n", "the documentation at\n",
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n"; "http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
} }
print
"The servers were restarted $tot_restarts times\n";
if ( $::opt_timer )
{
print
"Spent $::glob_tot_real_time seconds actually executing testcases\n"
}
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# If a debug run, there might be interesting information inside # If a debug run, there might be interesting information inside
...@@ -216,7 +248,10 @@ sub mtr_report_stats ($) { ...@@ -216,7 +248,10 @@ sub mtr_report_stats ($) {
else else
{ {
# We report different types of problems in order # We report different types of problems in order
foreach my $pattern ( "^Warning:", "^Error:", "^==.* at 0x" ) foreach my $pattern ( "^Warning:", "^Error:", "^==.* at 0x",
"InnoDB: Warning", "missing DBUG_RETURN",
"mysqld: Warning",
"Attempting backtrace", "Assertion .* failed" )
{ {
foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") ) foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") )
{ {
...@@ -230,7 +265,8 @@ sub mtr_report_stats ($) { ...@@ -230,7 +265,8 @@ sub mtr_report_stats ($) {
# Skip some non fatal warnings from the log files # Skip some non fatal warnings from the log files
if ( /Warning:\s+Table:.* on (delete|rename)/ or if ( /Warning:\s+Table:.* on (delete|rename)/ or
/Warning:\s+Setting lower_case_table_names=2/ or /Warning:\s+Setting lower_case_table_names=2/ or
/Warning:\s+One can only use the --user.*root/ ) /Warning:\s+One can only use the --user.*root/ or
/InnoDB: Warning: we did not need to do crash recovery/)
{ {
next; # Skip these lines next; # Skip these lines
} }
...@@ -241,6 +277,7 @@ sub mtr_report_stats ($) { ...@@ -241,6 +277,7 @@ sub mtr_report_stats ($) {
} }
} }
} }
}
if ( $found_problems ) if ( $found_problems )
{ {
mtr_warning("Got errors/warnings while running tests, please examine", mtr_warning("Got errors/warnings while running tests, please examine",
...@@ -248,7 +285,6 @@ sub mtr_report_stats ($) { ...@@ -248,7 +285,6 @@ sub mtr_report_stats ($) {
} }
} }
} }
}
print "\n"; print "\n";
...@@ -331,5 +367,11 @@ sub mtr_debug (@) { ...@@ -331,5 +367,11 @@ sub mtr_debug (@) {
print STDERR "####: ",join(" ", @_),"\n"; print STDERR "####: ",join(" ", @_),"\n";
} }
} }
sub mtr_verbose (@) {
if ( $::opt_verbose )
{
print STDERR "> ",join(" ", @_),"\n";
}
}
1; 1;
...@@ -21,15 +21,13 @@ sub run_stress_test () ...@@ -21,15 +21,13 @@ sub run_stress_test ()
{ {
my $args; my $args;
my $stress_basedir;
my $stress_suitedir; my $stress_suitedir;
mtr_report("Starting stress testing\n"); mtr_report("Starting stress testing\n");
if ( ! $::glob_use_embedded_server and ! $::opt_local_master ) if ( ! $::glob_use_embedded_server )
{ {
$::master->[0]->{'pid'}= mysqld_start('master',0,[],[],0); if ( ! mysqld_start($::master->[0],[],[]) )
if ( ! $::master->[0]->{'pid'} )
{ {
mtr_error("Can't start the mysqld server"); mtr_error("Can't start the mysqld server");
} }
......
This diff is collapsed.
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