1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Add support for running in parallel

This commit is contained in:
msvensson@pilot.mysql.com
2008-04-24 13:02:53 +02:00
parent ea839ba054
commit ba900fe302
6 changed files with 678 additions and 258 deletions

View File

@ -27,7 +27,7 @@ our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line
mtr_warning mtr_error mtr_debug mtr_verbose
mtr_verbose_restart mtr_report_test_passed
mtr_report_test_failed mtr_report_test_skipped
mtr_report_stats);
mtr_report_stats mtr_report_test);
use mtr_match;
require "mtr_io.pl";
@ -35,6 +35,10 @@ require "mtr_io.pl";
my $tot_real_time= 0;
our $timestamp= 0;
our $name;
our $verbose;
our $verbose_restart= 0;
sub report_option {
my ($opt, $value)= @_;
@ -43,6 +47,8 @@ sub report_option {
$opt =~ s/-/_/;
no strict 'refs';
${$opt}= $value;
#print $name, " setting $opt to ", (defined $value? $value : "undef") ,"\n";
}
sub SHOW_SUITE_NAME() { return 1; };
@ -51,6 +57,8 @@ sub _mtr_report_test_name ($) {
my $tinfo= shift;
my $tname= $tinfo->{name};
return unless defined $verbose;
# Remove suite part of name
$tname =~ s/.*\.// unless SHOW_SUITE_NAME;
@ -58,7 +66,7 @@ sub _mtr_report_test_name ($) {
$tname.= " '$tinfo->{combination}'"
if defined $tinfo->{combination};
print _timestamp();
print $name, _timestamp();
printf "%-30s ", $tname;
}
@ -100,12 +108,19 @@ sub mtr_report_test_passed ($$) {
$timer= mtr_fromfile("$::opt_vardir/log/timer");
$tot_real_time += ($timer/1000);
$timer= sprintf "%12s", $timer;
$tinfo->{timer}= $timer;
}
# Set as passed unless already set
if ( not defined $tinfo->{'result'} ){
$tinfo->{'result'}= 'MTR_RES_PASSED';
}
mtr_report("[ pass ] $timer");
# Show any problems check-testcase found
if ( defined $tinfo->{'check'} )
{
mtr_report($tinfo->{'check'});
}
}
@ -143,9 +158,7 @@ sub mtr_report_test_failed ($$) {
{
# Test failure was detected by test tool and its report
# about what failed has been saved to file. Display the report.
print "\n";
mtr_printfile($logfile);
print "\n";
$tinfo->{logfile}= mtr_fromfile($logfile);
}
else
{
@ -156,6 +169,83 @@ sub mtr_report_test_failed ($$) {
}
sub mtr_report_test ($) {
my ($tinfo)= @_;
_mtr_report_test_name($tinfo);
if ($tinfo->{'result'} eq 'MTR_RES_FAILED'){
#my $test_failures= $tinfo->{'failures'} || 0;
#$tinfo->{'failures'}= $test_failures + 1;
if ( defined $tinfo->{'warnings'} )
{
mtr_report("[ fail ] Found warnings in server log file!");
mtr_report($tinfo->{'warnings'});
return;
}
if ( defined $tinfo->{'timeout'} )
{
mtr_report("[ fail ] timeout");
return;
}
else
{
mtr_report("[ fail ]");
}
if ( $tinfo->{'comment'} )
{
# The test failure has been detected by mysql-test-run.pl
# when starting the servers or due to other error, the reason for
# failing the test is saved in "comment"
mtr_report("\nERROR: $tinfo->{'comment'}");
}
elsif ( $tinfo->{logfile} )
{
# Test failure was detected by test tool and its report
# about what failed has been saved to file. Display the report.
mtr_report("\n");
mtr_report($tinfo->{logfile}, "\n");
}
else
{
# Neither this script or the test tool has recorded info
# about why the test has failed. Should be debugged.
mtr_report("\nUnexpected termination, probably when starting mysqld");;
}
}
elsif ($tinfo->{'result'} eq 'MTR_RES_SKIPPED')
{
if ( $tinfo->{'disable'} )
{
mtr_report("[ disabled ] $tinfo->{'comment'}");
}
elsif ( $tinfo->{'comment'} )
{
if ( $tinfo->{skip_detected_by_test} )
{
mtr_report("[ skip ]. $tinfo->{'comment'}");
}
else
{
mtr_report("[ skip ] $tinfo->{'comment'}");
}
}
else
{
mtr_report("[ skip ]");
}
}
elsif ($tinfo->{'result'} eq 'MTR_RES_PASSED')
{
my $timer= $tinfo->{timer} || "";
mtr_report("[ pass ] $timer");
}
}
sub mtr_report_stats ($) {
my $tests= shift;
@ -342,35 +432,42 @@ sub _timestamp {
# Print message to screen
sub mtr_report (@) {
print join(" ", @_), "\n";
if (defined $verbose)
{
print join(" ", @_), "\n";
}
}
# Print warning to screen
sub mtr_warning (@) {
print STDERR _timestamp(), "mysql-test-run: WARNING: ", join(" ", @_), "\n";
print STDERR $name, _timestamp(),
"mysql-test-run: WARNING: ", join(" ", @_), "\n";
}
# Print error to screen and then exit
sub mtr_error (@) {
print STDERR _timestamp(), "mysql-test-run: *** ERROR: ", join(" ", @_), "\n";
print STDERR $name, _timestamp(),
"mysql-test-run: *** ERROR: ", join(" ", @_), "\n";
exit(1);
}
sub mtr_debug (@) {
if ( $::opt_verbose > 1 )
if ( $verbose > 2 )
{
print STDERR _timestamp(), "####: ", join(" ", @_), "\n";
print STDERR $name,
_timestamp(), "####: ", join(" ", @_), "\n";
}
}
sub mtr_verbose (@) {
if ( $::opt_verbose )
if ( $verbose )
{
print STDERR _timestamp(), "> ",join(" ", @_),"\n";
print STDERR $name, _timestamp(),
"> ",join(" ", @_),"\n";
}
}
@ -378,9 +475,10 @@ sub mtr_verbose (@) {
sub mtr_verbose_restart (@) {
my ($server, @args)= @_;
my $proc= $server->{proc};
if ( $::opt_verbose_restart )
if ( $verbose_restart )
{
print STDERR _timestamp(), "> Restart $proc - ",join(" ", @args),"\n";
print STDERR $name,_timestamp(),
"> Restart $proc - ",join(" ", @args),"\n";
}
}