diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-05-02 08:44:17 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-05-02 08:44:17 +0200 |
commit | ca091e6372c4d1b05d2338e878042c2914519a4e (patch) | |
tree | 406c71091eb4fdf4409147d22e6749309f677e8e /mysql-test/mysql-test-run.pl | |
parent | 28325b08633372cc343dfcbc41fe252020cf6e6e (diff) | |
parent | d233fd14a39f9c583b85ffb03e42b5ea52e2f4c2 (diff) | |
download | mariadb-git-ca091e6372c4d1b05d2338e878042c2914519a4e.tar.gz |
Merge branch '10.1' into 10.2
Diffstat (limited to 'mysql-test/mysql-test-run.pl')
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index d5c01cf2fe1..f584529e608 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -369,6 +369,32 @@ my $opt_stop_keep_alive= $ENV{MTR_STOP_KEEP_ALIVE}; select(STDOUT); $| = 1; # Automatically flush STDOUT +my $set_titlebar; + + + BEGIN { + if (IS_WINDOWS) { + my $have_win32_console= 0; + eval { + require Win32::Console; + Win32::Console->import(); + $have_win32_console = 1; + }; + eval 'sub HAVE_WIN32_CONSOLE { $have_win32_console }'; + } else { + sub HAVE_WIN32_CONSOLE { 0 }; + } +} + +if (-t STDOUT) { + if (IS_WINDOWS and HAVE_WIN32_CONSOLE) { + $set_titlebar = sub {Win32::Console::Title $_[0];}; + } elsif (defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) { + $set_titlebar = sub { print "\e];$_[0]\a"; }; + } +} + + main(); sub have_wsrep() { @@ -1039,7 +1065,7 @@ sub run_test_server ($$$) { delete $next->{reserved}; } - xterm_stat(scalar(@$tests)); + titlebar_stat(scalar(@$tests)) if $set_titlebar; if ($next) { # We don't need this any more @@ -6639,19 +6665,16 @@ sub time_format($) { our $num_tests; -sub xterm_stat { - if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) { - my ($left) = @_; +sub titlebar_stat { + my ($left) = @_; - # 2.5 -> best by test - $num_tests = $left + 2.5 unless $num_tests; + # 2.5 -> best by test + $num_tests = $left + 2.5 unless $num_tests; - my $done = $num_tests - $left; - my $spent = time - $^T; + my $done = $num_tests - $left; + my $spent = time - $^T; - syswrite STDOUT, sprintf - "\e];mtr: spent %s on %d tests. %s (%d tests) left\a", + &$set_titlebar(sprintf "mtr: spent %s on %d tests. %s (%d tests) left", time_format($spent), $done, - time_format($spent/$done * $left), $left; - } + time_format($spent/$done * $left), $left); } |