summaryrefslogtreecommitdiff
path: root/mysql-test/lib/mtr_report.pm
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-07-02 17:46:22 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-07-02 17:46:22 +0300
commite82fe21e3ac3141c92b7c4fb2d1fc3c083d834e8 (patch)
tree3ecf4329b6a623165aa6cb392ae71998de50c89e /mysql-test/lib/mtr_report.pm
parent709f0510e32981c59d7353e55a564073939db770 (diff)
parent7f1e1309bbd54a7923cf33a37938a29171ca0993 (diff)
downloadmariadb-git-e82fe21e3ac3141c92b7c4fb2d1fc3c083d834e8.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'mysql-test/lib/mtr_report.pm')
-rw-r--r--mysql-test/lib/mtr_report.pm26
1 files changed, 25 insertions, 1 deletions
diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
index 3f1e63bcfb9..44074d0838d 100644
--- a/mysql-test/lib/mtr_report.pm
+++ b/mysql-test/lib/mtr_report.pm
@@ -36,6 +36,21 @@ use POSIX qw[ _exit ];
use IO::Handle qw[ flush ];
use mtr_results;
+use Term::ANSIColor;
+
+my %color_map = qw/pass green
+ retry-pass green
+ fail red
+ retry-fail red
+ disabled bright_black
+ skipped yellow
+ reset reset/;
+sub xterm_color {
+ if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
+ syswrite STDOUT, color($color_map{$_[0]});
+ }
+}
+
my $tot_real_time= 0;
our $timestamp= 0;
@@ -498,7 +513,16 @@ sub mtr_print (@) {
sub mtr_report (@) {
if (defined $verbose)
{
- print _name(). join(" ", @_). "\n";
+ my @s = split /\[ (\S+) \]/, _name() . "@_\n";
+ if (@s > 1) {
+ print $s[0];
+ xterm_color($s[1]);
+ print "[ $s[1] ]";
+ xterm_color('reset');
+ print $s[2];
+ } else {
+ print $s[0];
+ }
}
}