Commit 69d26cb5 authored by unknown's avatar unknown

Move opt_timer to mtr_report.pm

parent f30f2b15
...@@ -39,7 +39,7 @@ our $timediff= 1; ...@@ -39,7 +39,7 @@ our $timediff= 1;
our $name; our $name;
our $verbose; our $verbose;
our $verbose_restart= 0; our $verbose_restart= 0;
our $timer= 1;
sub report_option { sub report_option {
my ($opt, $value)= @_; my ($opt, $value)= @_;
...@@ -99,23 +99,22 @@ sub mtr_report_test_skipped ($) { ...@@ -99,23 +99,22 @@ sub mtr_report_test_skipped ($) {
} }
sub mtr_report_test_passed ($$) { sub mtr_report_test_passed ($) {
my ($tinfo, $use_timer)= @_; my ($tinfo)= @_;
_mtr_report_test_name($tinfo); _mtr_report_test_name($tinfo);
my $timer= ""; my $timer_str= "";
if ( $use_timer and -f "$::opt_vardir/log/timer" ) if ( $timer and -f "$::opt_vardir/log/timer" )
{ {
$timer= mtr_fromfile("$::opt_vardir/log/timer"); $timer_str= mtr_fromfile("$::opt_vardir/log/timer");
$tot_real_time += ($timer/1000); $tinfo->{timer}= $timer_str;
$timer= sprintf "%12s", $timer;
$tinfo->{timer}= $timer;
} }
# Set as passed unless already set # Set as passed unless already set
if ( not defined $tinfo->{'result'} ){ if ( not defined $tinfo->{'result'} ){
$tinfo->{'result'}= 'MTR_RES_PASSED'; $tinfo->{'result'}= 'MTR_RES_PASSED';
} }
mtr_report("[ pass ] $timer");
mtr_report("[ pass ] ", sprintf("%12s", $timer_str));
# Show any problems check-testcase found # Show any problems check-testcase found
if ( defined $tinfo->{'check'} ) if ( defined $tinfo->{'check'} )
...@@ -193,8 +192,9 @@ sub mtr_report_test ($) { ...@@ -193,8 +192,9 @@ sub mtr_report_test ($) {
} }
elsif ($tinfo->{'result'} eq 'MTR_RES_PASSED') elsif ($tinfo->{'result'} eq 'MTR_RES_PASSED')
{ {
my $timer= $tinfo->{timer} || ""; my $timer_str= $tinfo->{timer} || "";
mtr_report("[ pass ] $timer"); $tot_real_time += ($timer_str/1000);
mtr_report("[ pass ] ", sprintf("%12s", $timer_str));
# Show any problems check-testcase found # Show any problems check-testcase found
if ( defined $tinfo->{'check'} ) if ( defined $tinfo->{'check'} )
...@@ -262,7 +262,7 @@ sub mtr_report_stats ($) { ...@@ -262,7 +262,7 @@ sub mtr_report_stats ($) {
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
print "The servers were restarted $tot_restarts times\n"; print "The servers were restarted $tot_restarts times\n";
if ( $::opt_timer ) if ( $timer )
{ {
use English; use English;
...@@ -343,7 +343,7 @@ sub mtr_report_stats ($) { ...@@ -343,7 +343,7 @@ sub mtr_report_stats ($) {
} }
else else
{ {
print "All $tot_tests tests were successful.\n"; print "All $tot_tests tests were successful.\n\n";
} }
if ( $tot_failed != 0 || $found_problems) if ( $tot_failed != 0 || $found_problems)
......
...@@ -168,8 +168,6 @@ my $opt_parallel; ...@@ -168,8 +168,6 @@ my $opt_parallel;
my $opt_strace_client; my $opt_strace_client;
our $opt_timer= 1;
our $opt_user; our $opt_user;
my $opt_valgrind= 0; my $opt_valgrind= 0;
...@@ -784,7 +782,7 @@ sub command_line_setup { ...@@ -784,7 +782,7 @@ sub command_line_setup {
'repeat=i' => \$opt_repeat, 'repeat=i' => \$opt_repeat,
'retry=i' => \$opt_retry, 'retry=i' => \$opt_retry,
'retry-failure=i' => \$opt_retry_failure, 'retry-failure=i' => \$opt_retry_failure,
'timer!' => \$opt_timer, 'timer!' => \&report_option,
'user=s' => \$opt_user, 'user=s' => \$opt_user,
'testcase-timeout=i' => \$opt_testcase_timeout, 'testcase-timeout=i' => \$opt_testcase_timeout,
'suite-timeout=i' => \$opt_suite_timeout, 'suite-timeout=i' => \$opt_suite_timeout,
...@@ -2886,7 +2884,7 @@ sub run_testcase ($) { ...@@ -2886,7 +2884,7 @@ sub run_testcase ($) {
} }
else else
{ {
mtr_report_test_passed($tinfo, $opt_timer); mtr_report_test_passed($tinfo);
} }
my $check_res; my $check_res;
...@@ -3948,10 +3946,7 @@ sub start_mysqltest ($) { ...@@ -3948,10 +3946,7 @@ sub start_mysqltest ($) {
mtr_add_arg($args, "$exe_mysqltest"); mtr_add_arg($args, "$exe_mysqltest");
} }
if ( $opt_timer )
{
mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir); mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir);
}
if ( $opt_compress ) if ( $opt_compress )
{ {
......
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