Behaviour change of mysql-test-run.pl:

by default we never run disabled tests (even if they're
explicitely listed on the command-line). We add an option --enable-disabled
which will run tests even though they are disabled, and will print, for each
such test, the comment explaining why it was disabled.
The reason for the change is when you want to run "all tests which are about
NDB" for example: mysql-test-run.pl t/*ndb*.test used to run some disabled
NDB tests, causing failures, causing investigations.
Code amended and approved by Kent.
parent ff179e37
...@@ -37,6 +37,23 @@ sub collect_test_cases ($) { ...@@ -37,6 +37,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 +117,13 @@ sub collect_test_cases ($) { ...@@ -100,30 +117,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;
...@@ -414,20 +414,35 @@ sub collect_one_test_case($$$$$$$) { ...@@ -414,20 +414,35 @@ 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 )
{ {
$tinfo->{'skip'}= 1; $marked_as_disabled= 1;
$tinfo->{'disable'}= 1; # Sub type of 'skip'
$tinfo->{'comment'}= mtr_fromfile($disabled_file); $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->{'disable'}= 1; # Sub type of 'skip'
}
}
if ( $component_id eq 'im' ) if ( $component_id eq 'im' )
{ {
if ( $::glob_use_embedded_server ) if ( $::glob_use_embedded_server )
......
...@@ -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 ($);
...@@ -100,6 +101,23 @@ sub mtr_report_test_skipped ($) { ...@@ -100,6 +101,23 @@ sub mtr_report_test_skipped ($) {
} }
} }
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'};
}
}
}
}
sub mtr_report_test_passed ($) { sub mtr_report_test_passed ($) {
my $tinfo= shift; my $tinfo= shift;
......
...@@ -216,6 +216,7 @@ our $opt_extern; ...@@ -216,6 +216,7 @@ our $opt_extern;
our $opt_fast; our $opt_fast;
our $opt_force; our $opt_force;
our $opt_reorder; our $opt_reorder;
our $opt_enable_disabled;
our $opt_gcov; our $opt_gcov;
our $opt_gcov_err; our $opt_gcov_err;
...@@ -661,6 +662,7 @@ sub command_line_setup () { ...@@ -661,6 +662,7 @@ sub command_line_setup () {
'netware' => \$opt_netware, 'netware' => \$opt_netware,
'old-master' => \$opt_old_master, 'old-master' => \$opt_old_master,
'reorder' => \$opt_reorder, 'reorder' => \$opt_reorder,
'enable-disabled' => \$opt_enable_disabled,
'script-debug' => \$opt_script_debug, 'script-debug' => \$opt_script_debug,
'sleep=i' => \$opt_sleep, 'sleep=i' => \$opt_sleep,
'socket=s' => \$opt_socket, 'socket=s' => \$opt_socket,
...@@ -1781,12 +1783,12 @@ sub run_suite () { ...@@ -1781,12 +1783,12 @@ sub run_suite () {
mtr_print_thick_line(); mtr_print_thick_line();
mtr_report("Finding Tests in the '$suite' suite");
mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout); mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout);
mtr_report("Starting Tests in the '$suite' suite"); mtr_report("Starting Tests in the '$suite' suite");
mtr_report_tests_not_skipped_though_disabled($tests);
mtr_print_header(); mtr_print_header();
foreach my $tinfo ( @$tests ) foreach my $tinfo ( @$tests )
......
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