Skip to content

Commit 78092b1

Browse files
author
Pavan Naik
committed
BUG#28203341: MTR: BACK-PORT THE FIX FOR BUG#28061910 TO 5.7
Fix for BUG#28061910 enables test-progress by default. Back-port this fix to 5.7 branch. Change-Id: Ia3728f83e5954021b791b7572e3d7b2833bb1df4
1 parent 143ffa3 commit 78092b1

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

mysql-test/lib/mtr_report.pm

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- cperl -*-
2-
# Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
33
#
44
# This program is free software; you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -32,14 +32,15 @@ our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line
3232
use mtr_match;
3333
use File::Spec;
3434
use My::Platform;
35-
use POSIX qw[ _exit ];
35+
use POSIX qw(_exit floor);
3636
use IO::Handle qw[ flush ];
3737
require "mtr_io.pl";
3838
use mtr_results;
3939

4040
my $tot_real_time= 0;
4141

4242
my $done_percentage= 0;
43+
my $tests_completed= 0;
4344

4445
our $timestamp= 0;
4546
our $timediff= 0;
@@ -67,9 +68,11 @@ sub _name {
6768
return $name ? $name." " : undef;
6869
}
6970

70-
sub _mtr_report_test_name ($)
71+
sub _mtr_report_test_name ($$)
7172
{
7273
my $tinfo= shift;
74+
my $done_percentage= shift;
75+
7376
my $tname= $tinfo->{name};
7477

7578
return unless defined $verbose;
@@ -141,13 +144,13 @@ sub mtr_report_test ($) {
141144
{
142145
if ($tinfo->{'name'} && !$retry)
143146
{
144-
$::remaining= $::remaining - 1;
145-
$done_percentage = 100 - int (($::remaining * 100) /
146-
($::num_tests_for_report));
147+
$tests_completed= $tests_completed + 1;
148+
$done_percentage=
149+
floor(($tests_completed / $::num_tests_for_report) * 100);
147150
}
148151
}
149152

150-
my $test_name = _mtr_report_test_name($tinfo);
153+
my $test_name = _mtr_report_test_name($tinfo, $done_percentage);
151154

152155
if ($result eq 'MTR_RES_FAILED'){
153156

mysql-test/mysql-test-run.pl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ BEGIN
137137
my $start_only;
138138

139139
our $num_tests_for_report; # for test-progress option
140-
our $remaining;
141140

142141
my $auth_plugin; # the path to the authentication test plugin
143142

@@ -284,7 +283,7 @@ END
284283

285284
our $opt_check_testcases= 1;
286285
my $opt_mark_progress;
287-
our $opt_test_progress;
286+
our $opt_test_progress= 1;
288287
my $opt_max_connections;
289288
our $opt_report_times= 0;
290289

@@ -428,9 +427,7 @@ sub main {
428427

429428
#######################################################################
430429
my $num_tests= @$tests;
431-
432430
$num_tests_for_report = $num_tests * $opt_repeat;
433-
$remaining= $num_tests_for_report;
434431

435432
if ( $opt_parallel eq "auto" ) {
436433
# Try to find a suitable value for number of workers
@@ -1159,7 +1156,7 @@ sub command_line_setup {
11591156
'record' => \$opt_record,
11601157
'check-testcases!' => \$opt_check_testcases,
11611158
'mark-progress' => \$opt_mark_progress,
1162-
'test-progress' => \$opt_test_progress,
1159+
'test-progress:1' => \$opt_test_progress,
11631160

11641161
# Extra options used when starting mysqld
11651162
'mysqld=s' => \@opt_extra_mysqld_opt,
@@ -1439,6 +1436,10 @@ sub command_line_setup {
14391436
}
14401437
}
14411438

1439+
if ($opt_test_progress != 0 and $opt_test_progress != 1) {
1440+
mtr_error("Invalid value '$opt_test_progress' for option 'test-progress'.");
1441+
}
1442+
14421443
# disable syslog / EventLog in normal (non-bootstrap) operation.
14431444
push(@opt_extra_mysqld_opt, "--log-syslog=0");
14441445

@@ -7324,7 +7325,8 @@ ($)
73247325
record TESTNAME (Re)genereate the result file for TESTNAME
73257326
check-testcases Check testcases for sideeffects
73267327
mark-progress Log line number and elapsed time to <testname>.progress
7327-
test-progress Print the percentage of tests completed
7328+
test-progress[={0|1}] Print the percentage of tests completed. This setting
7329+
is enabled by default.
73287330
73297331
Options that pass on options (these may be repeated)
73307332

0 commit comments

Comments
 (0)