Commit dbb0e6ad authored by Magnus Svensson's avatar Magnus Svensson

Merge parallel mtr

parents 8b7a3b97 10968f73
......@@ -1345,23 +1345,21 @@ void show_diff(DYNAMIC_STRING* ds,
if (init_dynamic_string(&ds_tmp, "", 256, 256))
die("Out of memory");
/* First try with diff --help to see if the command exists at all */
/* First try with unified diff */
if (run_tool("diff",
&ds_tmp, /* Get output from diff in ds_tmp */
"--help",
"-u",
filename1,
filename2,
"2>&1",
NULL) != 0) /* Most "diff --help" tools return 0 */
{
diff_failed= "You don't appear to have diff installed";
}
else
NULL) > 1) /* Most "diff" tools return >1 if error */
{
dynstr_set(&ds_tmp, "");
/* First try with unified diff */
/* Fallback to context diff with "diff -c" */
if (run_tool("diff",
&ds_tmp, /* Get output from diff in ds_tmp */
"-u",
"-c",
filename1,
filename2,
"2>&1",
......@@ -1369,17 +1367,17 @@ void show_diff(DYNAMIC_STRING* ds,
{
dynstr_set(&ds_tmp, "");
/* Fallback to context diff with "diff -c" */
/* Fallback to plain "diff" */
if (run_tool("diff",
&ds_tmp, /* Get output from diff in ds_tmp */
"-c",
filename1,
filename2,
"2>&1",
NULL) > 1) /* Most "diff" tools return >1 if error */
{
dynstr_set(&ds_tmp, "");
diff_failed= "Could not execute 'diff -u' or 'diff -c'";
diff_failed= "Could not execute 'diff -u', 'diff -c' or 'diff'";
}
}
}
......
......@@ -38,9 +38,11 @@ nobase_test_DATA = lib/mtr_cases.pm \
lib/My/Config.pm \
lib/My/Find.pm \
lib/My/Options.pm \
lib/My/Test.pm \
lib/My/Platform.pm \
lib/My/SafeProcess.pm \
lib/My/File/Path.pm \
lib/My/SysInfo.pm \
lib/My/SafeProcess/Base.pm \
lib/My/SafeProcess/safe_process.pl
......
......@@ -104,10 +104,16 @@ sub fix_server_id {
sub fix_socket {
my ($self, $config, $group_name, $group)= @_;
# Put socket file in tmpdir
my $dir= $group->value('tmpdir');
my $dir= $self->{ARGS}->{tmpdir};
return "$dir/$group_name.sock";
}
sub fix_tmpdir {
my ($self, $config, $group_name, $group)= @_;
my $dir= $self->{ARGS}->{tmpdir};
return "$dir/$group_name";
}
sub fix_log_error {
my ($self, $config, $group_name, $group)= @_;
my $dir= dirname($group->value('datadir'));
......@@ -182,7 +188,7 @@ sub fix_ssl_client_key {
my @mysqld_rules=
(
{ 'basedir' => sub { return shift->{ARGS}->{basedir}; } },
{ 'tmpdir' => sub { return shift->{ARGS}->{tmpdir}; } },
{ 'tmpdir' => \&fix_tmpdir },
{ 'character-sets-dir' => \&fix_charset_dir },
{ 'language' => \&fix_language },
{ 'datadir' => \&fix_datadir },
......@@ -294,6 +300,16 @@ my @mysqlbinlog_rules=
);
#
# Rules to run for [mysql_upgrade] section
# - will be run in order listed here
#
my @mysql_upgrade_rules=
(
{ 'tmpdir' => sub { return shift->{ARGS}->{tmpdir}; } },
);
#
# Generate a [client.<suffix>] group to be
# used for connecting to [mysqld.<suffix>]
......@@ -600,6 +616,11 @@ sub new_config {
$config->insert('mysqlbinlog'),
@mysqlbinlog_rules);
# [mysql_upgrade] need additional settings
$self->run_rules_for_group($config,
$config->insert('mysql_upgrade'),
@mysql_upgrade_rules);
# Additional rules required for [client]
$self->run_rules_for_group($config,
$config->insert('client'),
......
......@@ -61,6 +61,9 @@ sub _split_option {
elsif ($option=~ /^--(.*)$/){
return ($1, undef)
}
elsif ($option=~ /^\$(.*)$/){ # $VAR
return ($1, undef)
}
elsif ($option=~ /^(.*)=(.*)$/){
return ($1, $2)
}
......
......@@ -65,7 +65,7 @@ END {
# Kill any children still running
for my $proc (values %running){
if ( $proc->is_child($$) ){
print "Killing: $proc\n";
#print "Killing: $proc\n";
$proc->kill();
}
}
......@@ -128,6 +128,7 @@ sub new {
my $verbose = delete($opts{'verbose'});
my $host = delete($opts{'host'});
my $shutdown = delete($opts{'shutdown'});
my $user_data= delete($opts{'user_data'});
# if (defined $host) {
# $safe_script= "lib/My/SafeProcess/safe_process_cpcd.pl";
......@@ -173,6 +174,7 @@ sub new {
SAFE_NAME => $name,
SAFE_SHUTDOWN => $shutdown,
PARENT => $$,
SAFE_USER_DATA => $user_data,
}, $class);
# Put the new process in list of running
......@@ -461,8 +463,8 @@ sub wait_one {
return 1;
}
warn "wait_one: expected pid $pid but got $retpid"
unless( $retpid == $pid );
#warn "wait_one: expected pid $pid but got $retpid"
# unless( $retpid == $pid );
$self->_collect();
return 0;
......@@ -546,4 +548,16 @@ sub _verbose {
print STDERR " ## ", @_, "\n";
}
sub pid {
my ($self)= @_;
return $self->{SAFE_PID};
}
sub user_data {
my ($self)= @_;
return $self->{SAFE_USER_DATA};
}
1;
# -*- cperl -*-
# Copyright (C) 2004-2006 MySQL AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
package My::SysInfo;
use strict;
use Carp;
use My::Platform;
use constant DEFAULT_BOGO_MIPS => 2000;
sub _cpuinfo {
my ($self)= @_;
print "_cpuinfo\n";
my $info_file= "/proc/cpuinfo";
if ( !( -e $info_file and -f $info_file) ) {
return undef;
}
my $F= IO::File->new($info_file) or return undef;
# Set input separator to blank line
local $/ = '';
while ( my $cpu_chunk= <$F>) {
chomp($cpu_chunk);
my $cpuinfo = {};
foreach my $cpuline ( split(/\n/, $cpu_chunk) ) {
my ( $attribute, $value ) = split(/\s*:\s*/, $cpuline);
$attribute =~ s/\s+/_/;
$attribute = lc($attribute);
if ( $value =~ /^(no|not available|yes)$/ ) {
$value = $value eq 'yes' ? 1 : 0;
}
if ( $attribute eq 'flags' ) {
@{ $cpuinfo->{flags} } = split / /, $value;
} else {
$cpuinfo->{$attribute} = $value;
}
}
# Make sure bogomips is set to some value
$cpuinfo->{bogomips} |= DEFAULT_BOGO_MIPS;
# Cpus reported once, but with 'cpu_count' set to the actual number
my $cpu_count= $cpuinfo->{cpu_count} || 1;
for(1..$cpu_count){
push(@{$self->{cpus}}, $cpuinfo);
}
}
$F= undef; # Close file
return $self;
}
sub _kstat {
my ($self)= @_;
while (1){
my $instance_num= $self->{cpus} ? @{$self->{cpus}} : 0;
my $list= `kstat -p -m cpu_info -i $instance_num`;
my @lines= split('\n', $list) or last; # Break loop
my $cpuinfo= {};
foreach my $line (@lines)
{
my ($module, $instance, $name, $statistic, $value)=
$line=~ /(\w*):(\w*):(\w*):(\w*)\t(.*)/;
$cpuinfo->{$statistic}= $value;
}
# Default value, the actual cpu values can be used to decrease this
# on slower cpus
$cpuinfo->{bogomips}= DEFAULT_BOGO_MIPS;
push(@{$self->{cpus}}, $cpuinfo);
}
# At least one cpu should have been found
# if this method worked
if ( $self->{cpus} ) {
return $self;
}
return undef;
}
sub _unamex {
my ($self)= @_;
# TODO
return undef;
}
sub new {
my ($class)= @_;
my $self= bless {
cpus => (),
}, $class;
my @info_methods =
(
\&_cpuinfo,
\&_kstat,
\&_unamex,
);
foreach my $method (@info_methods){
if ($method->($self)){
return $self;
}
}
# Push a dummy cpu
push(@{$self->{cpus}},
{
bogomips => DEFAULT_BOGO_MIPS,
model_name => "unknown",
});
return $self;
}
# Return the list of cpus found
sub cpus {
my ($self)= @_;
return @{$self->{cpus}} or
confess "INTERNAL ERROR: No cpus in list";
}
# Return the number of cpus found
sub num_cpus {
my ($self)= @_;
return int(@{$self->{cpus}}) or
confess "INTERNAL ERROR: No cpus in list";
}
# Return the smallest bogomips value amongst the processors
sub min_bogomips {
my ($self)= @_;
my $bogomips;
foreach my $cpu (@{$self->{cpus}}) {
if (!defined $bogomips or $bogomips > $cpu->{bogomips}) {
$bogomips= $cpu->{bogomips};
}
}
return $bogomips;
}
# Prit the cpuinfo
sub print_info {
my ($self)= @_;
foreach my $cpu (@{$self->{cpus}}) {
while ((my ($key, $value)) = each(%$cpu)) {
print " ", $key, "= ";
if (ref $value eq "ARRAY") {
print "[", join(", ", @$value), "]";
} else {
print $value;
}
print "\n";
}
print "\n";
}
}
1;
# -*- cperl -*-
#
# One test
#
package My::Test;
use strict;
use warnings;
use Carp;
sub new {
my $class= shift;
my $self= bless {
@_,
}, $class;
return $self;
}
#
# Return a unique key that can be used to
# identify this test in a hash
#
sub key {
my ($self)= @_;
my $key= $self->{name};
$key.= "+".$self->{combination} if $self->{combination};
return $key;
}
sub _encode {
my ($value)= @_;
$value =~ s/([|\\\x{0a}\x{0d}])/sprintf('\%02X', ord($1))/eg;
return $value;
}
sub _decode {
my ($value)= @_;
$value =~ s/\\([0-9a-fA-F]{2})/chr(hex($1))/ge;
return $value;
}
sub is_failed {
my ($self)= @_;
my $result= $self->{result};
croak "'is_failed' can't be called until test has been run!"
unless defined $result;
return ($result eq 'MTR_RES_FAILED');
}
sub write_test {
my ($test, $sock, $header)= @_;
print $sock $header, "\n";
while ((my ($key, $value)) = each(%$test)) {
print $sock $key, "= ";
if (ref $value eq "ARRAY") {
print $sock "[", _encode(join(", ", @$value)), "]";
} else {
print $sock _encode($value);
}
print $sock "\n";
}
print $sock "\n";
}
sub read_test {
my ($sock)= @_;
my $test= My::Test->new();
# Read the : separated key value pairs until a
# single newline on it's own line
my $line;
while (defined($line= <$sock>)) {
# List is terminated by newline on it's own
if ($line eq "\n") {
# Correctly terminated reply
# print "Got newline\n";
last;
}
chomp($line);
# Split key/value on the first "="
my ($key, $value)= split("= ", $line, 2);
if ($value =~ /^\[(.*)\]/){
my @values= split(", ", _decode($1));
push(@{$test->{$key}}, @values);
}
else
{
$test->{$key}= _decode($value);
}
}
return $test;
}
sub print_test {
my ($self)= @_;
print "[", $self->{name}, "]", "\n";
while ((my ($key, $value)) = each(%$self)) {
print " ", $key, "= ";
if (ref $value eq "ARRAY") {
print "[", join(", ", @$value), "]";
} else {
print $value;
}
print "\n";
}
print "\n";
}
1;
......@@ -40,7 +40,7 @@ our $default_storage_engine;
our $opt_with_ndbcluster_only;
our $defaults_file;
our $defaults_extra_file;
our $reorder;
our $reorder= 1;
sub collect_option {
my ($opt, $value)= @_;
......@@ -56,6 +56,7 @@ use File::Spec::Functions qw / splitdir /;
use IO::File();
use My::Config;
use My::Platform;
use My::Test;
use My::Find;
require "mtr_misc.pl";
......@@ -136,52 +137,16 @@ sub collect_test_cases ($$) {
{
my @criteria = ();
# Look for tests that must be run in a defined order - that is
# defined by test having the same name except for the ending digit
# Put variables into hash
my $test_name= $tinfo->{'name'};
my $depend_on_test_name;
if ( $test_name =~ /^([\D]+)([0-9]{1})$/ )
{
my $base_name= $1;
my $idx= $2;
mtr_verbose("$test_name => $base_name idx=$idx");
if ( $idx > 1 )
{
$idx-= 1;
$base_name= "$base_name$idx";
mtr_verbose("New basename $base_name");
}
foreach my $tinfo2 (@$cases)
{
if ( $tinfo2->{'name'} eq $base_name )
{
mtr_verbose("found dependent test $tinfo2->{'name'}");
$depend_on_test_name=$base_name;
}
}
}
if ( defined $depend_on_test_name )
{
mtr_verbose("Giving $test_name same critera as $depend_on_test_name");
$sort_criteria{$test_name} = $sort_criteria{$depend_on_test_name};
}
else
{
#
# Append the criteria for sorting, in order of importance.
#
push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0"));
push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "A" : "B"));
# Group test with equal options together.
# Ending with "~" makes empty sort later than filled
my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : [];
push(@criteria, join("!", sort @{$opts}) . "~");
$sort_criteria{$test_name} = join(" ", @criteria);
}
$sort_criteria{$tinfo->{name}} = join(" ", @criteria);
}
@$cases = sort {
......@@ -459,7 +424,7 @@ sub collect_one_suite($)
}
# Copy test options
my $new_test= {};
my $new_test= My::Test->new();
while (my ($key, $value) = each(%$test)) {
if (ref $value eq "ARRAY") {
push(@{$new_test->{$key}}, @$value);
......@@ -687,13 +652,16 @@ sub collect_one_test_case {
# ----------------------------------------------------------------------
# Set defaults
# ----------------------------------------------------------------------
my $tinfo= {};
$tinfo->{'name'}= $suitename . ".$tname";
$tinfo->{'path'}= "$testdir/$filename";
my $tinfo= My::Test->new
(
name => "$suitename.$tname",
path => "$testdir/$filename",
# TODO allow nonexistsing result file
# in that case .test must issue "exit" otherwise test should fail by default
$tinfo->{'result_file'}= "$resdir/$tname.result";
# in that case .test must issue "exit" otherwise test
# should fail by default
result_file => "$resdir/$tname.result",
);
# ----------------------------------------------------------------------
# Skip some tests but include in list, just mark them as skipped
......@@ -1065,19 +1033,6 @@ sub unspace {
}
sub envsubst {
my $string= shift;
if ( ! defined $ENV{$string} )
{
mtr_error(".opt file references '$string' which is not set");
}
return $ENV{$string};
}
sub opts_from_file ($) {
my $file= shift;
......@@ -1114,10 +1069,6 @@ sub opts_from_file ($) {
or $arg =~ s/^([^\'\"]*)\"(.*)\"([^\'\"]*)$/$1$2$3/;
$arg =~ s/\\\\/\\/g;
# Expand environment variables
$arg =~ s/\$\{(\w+)\}/envsubst($1)/ge;
$arg =~ s/\$(\w+)/envsubst($1)/ge;
# Do not pass empty string since my_getopt is not capable to handle it.
if (length($arg)) {
push(@args, $arg);
......@@ -1133,17 +1084,7 @@ sub print_testcases {
print "=" x 60, "\n";
foreach my $test (@cases){
print "[", $test->{name}, "]", "\n";
while ((my ($key, $value)) = each(%$test)) {
print " ", $key, "= ";
if (ref $value eq "ARRAY") {
print "[", join(", ", @$value), "]";
} else {
print $value;
}
print "\n";
}
print "\n";
$test->print_test();
}
print "=" x 60, "\n";
}
......
......@@ -26,15 +26,20 @@ our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line
mtr_print_header mtr_report mtr_report_stats
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_test_skipped mtr_print
mtr_report_test);
use mtr_match;
require "mtr_io.pl";
my $tot_real_time= 0;
our $timestamp= 0;
our $timediff= 1;
our $timestamp= 1;
our $timediff= 0;
our $name;
our $verbose;
our $verbose_restart= 0;
our $timer= 1;
sub report_option {
my ($opt, $value)= @_;
......@@ -43,86 +48,70 @@ sub report_option {
$opt =~ s/-/_/g;
no strict 'refs';
${$opt}= $value;
#print $name, " setting $opt to ", (defined $value? $value : "undef") ,"\n";
}
sub SHOW_SUITE_NAME() { return 1; };
sub _name {
return $name ? $name." " : undef;
}
sub _mtr_report_test_name ($) {
my $tinfo= shift;
my $tname= $tinfo->{name};
# Remove suite part of name
$tname =~ s/.*\.// unless SHOW_SUITE_NAME;
return unless defined $verbose;
# Add combination name if any
$tname.= " '$tinfo->{combination}'"
if defined $tinfo->{combination};
print _timestamp();
printf "%-30s ", $tname;
print _name(), _timestamp();
printf "%-40s ", $tname;
}
sub mtr_report_test_skipped ($) {
my $tinfo= shift;
_mtr_report_test_name($tinfo);
my ($tinfo)= @_;
$tinfo->{'result'}= '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 ]");
}
mtr_report_test($tinfo);
}
sub mtr_report_test_passed ($$) {
my ($tinfo, $use_timer)= @_;
_mtr_report_test_name($tinfo);
sub mtr_report_test_passed ($) {
my ($tinfo)= @_;
my $timer= "";
if ( $use_timer and -f "$::opt_vardir/log/timer" )
# Save the timer value
my $timer_str= "";
if ( $timer and -f "$::opt_vardir/log/timer" )
{
$timer= mtr_fromfile("$::opt_vardir/log/timer");
$tot_real_time += ($timer/1000);
$timer= sprintf "%12s", $timer;
$timer_str= mtr_fromfile("$::opt_vardir/log/timer");
$tinfo->{timer}= $timer_str;
}
# Set as passed unless already set
if ( not defined $tinfo->{'result'} ){
$tinfo->{'result'}= 'MTR_RES_PASSED';
}
mtr_report("[ pass ] $timer");
mtr_report_test($tinfo);
}
sub mtr_report_test_failed ($$) {
my ($tinfo, $logfile)= @_;
sub mtr_report_test ($) {
my ($tinfo)= @_;
_mtr_report_test_name($tinfo);
$tinfo->{'result'}= 'MTR_RES_FAILED';
my $test_failures= $tinfo->{'failures'} || 0;
$tinfo->{'failures'}= $test_failures + 1;
if ($tinfo->{'result'} eq 'MTR_RES_FAILED'){
if ( defined $tinfo->{'warnings'} )
{
mtr_report("[ fail ] Found warnings in server log file!");
mtr_report($tinfo->{'warnings'});
return;
}
elsif ( defined $tinfo->{'timeout'} )
if ( defined $tinfo->{'timeout'} )
{
mtr_report("[ fail ] timeout");
return;
......@@ -139,13 +128,13 @@ sub mtr_report_test_failed ($$) {
# failing the test is saved in "comment"
mtr_report("\nERROR: $tinfo->{'comment'}");
}
elsif ( defined $logfile and -f $logfile )
elsif ( $tinfo->{logfile} )
{
# 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";
mtr_report("\n");
mtr_report($tinfo->{logfile}, "\n");
}
else
{
......@@ -153,6 +142,41 @@ sub mtr_report_test_failed ($$) {
# 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_str= $tinfo->{timer} || "";
$tot_real_time += ($timer_str/1000);
mtr_report("[ pass ] ", sprintf("%5s", $timer_str));
# Show any problems check-testcase found
if ( defined $tinfo->{'check'} )
{
mtr_report($tinfo->{'check'});
}
}
}
......@@ -172,22 +196,27 @@ sub mtr_report_stats ($) {
foreach my $tinfo (@$tests)
{
if ( $tinfo->{'result'} eq 'MTR_RES_SKIPPED' )
if ( $tinfo->{failures} )
{
# Test has failed at least one time
$tot_tests++;
$tot_failed++;
}
elsif ( $tinfo->{'result'} eq 'MTR_RES_SKIPPED' )
{
# Test was skipped
$tot_skiped++;
}
elsif ( $tinfo->{'result'} eq 'MTR_RES_PASSED' )
{
# Test passed
$tot_tests++;
$tot_passed++;
}
elsif ( $tinfo->{'result'} eq 'MTR_RES_FAILED' )
{
$tot_tests++;
$tot_failed++;
}
if ( $tinfo->{'restarted'} )
{
# Servers was restarted
$tot_restarts++;
}
......@@ -207,7 +236,7 @@ sub mtr_report_stats ($) {
# ----------------------------------------------------------------------
print "The servers were restarted $tot_restarts times\n";
if ( $::opt_timer )
if ( $timer )
{
use English;
......@@ -249,6 +278,14 @@ sub mtr_report_stats ($) {
# Print a list of testcases that failed
if ( $tot_failed != 0 )
{
# Print each failed test, again
#foreach my $test ( @$tests ){
# if ( $test->{failures} ) {
# mtr_report_test($test);
# }
#}
my $ratio= $tot_passed * 100 / $tot_tests;
print "Failed $tot_failed/$tot_tests tests, ";
printf("%.2f", $ratio);
......@@ -262,7 +299,7 @@ sub mtr_report_stats ($) {
foreach my $tinfo (@$tests)
{
my $tname= $tinfo->{'name'};
if ( $tinfo->{'result'} eq 'MTR_RES_FAILED' and ! $seen{$tname})
if ( $tinfo->{failures} and ! $seen{$tname})
{
print " $tname";
$seen{$tname}= 1;
......@@ -280,7 +317,7 @@ sub mtr_report_stats ($) {
}
else
{
print "All $tot_tests tests were successful.\n";
print "All $tot_tests tests were successful.\n\n";
}
if ( $tot_failed != 0 || $found_problems)
......@@ -309,14 +346,11 @@ sub mtr_print_thick_line {
sub mtr_print_header () {
print "\n";
if ( $::opt_timer )
{
print "TEST RESULT TIME (ms)\n";
}
else
{
print "TEST RESULT\n";
}
printf "TEST";
print " " x 38;
print "RESULT ";
print "TIME (ms)" if $timer;
print "\n";
mtr_print_line();
print "\n";
}
......@@ -355,38 +389,50 @@ sub _timestamp {
$tm->hour, $tm->min, $tm->sec, $diff);
}
# Always print message to screen
sub mtr_print (@) {
print _name(), join(" ", @_), "\n";
}
# Print message to screen
# Print message to screen if verbose is defined
sub mtr_report (@) {
print join(" ", @_), "\n";
if (defined $verbose)
{
print _name(), 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";
}
}
......@@ -394,9 +440,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";
}
}
......
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