From aa4aec41f5bade8d8ea2fe26e314c9202a9c0181 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 14 Mar 2015 12:33:54 +0100 Subject: [PATCH] =?UTF-8?q?tests:=20don=E2=80=99t=20print=20interactive=20?= =?UTF-8?q?status=20when=20running=20on=20travis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (or without a tty) --- testcases/lib/StatusLine.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/testcases/lib/StatusLine.pm b/testcases/lib/StatusLine.pm index 823c6713..379fd3d6 100644 --- a/testcases/lib/StatusLine.pm +++ b/testcases/lib/StatusLine.pm @@ -15,6 +15,13 @@ my %ansi_line_upwards; my $tests_total; +sub noninteractive { + # CONTINUOUS_INTEGRATION gets set when running under Travis, see + # http://docs.travis-ci.com/user/ci-environment/ and + # https://github.com/travis-ci/travis-ci/issues/1337 + return (! -t STDOUT) || $ENV{CONTINUOUS_INTEGRATION} eq 'true'; +} + # setup %ansi_line_upwards to map all working displays to the # specific movement commands and initialize all status lines sub status_init { @@ -22,6 +29,8 @@ sub status_init { my $displays = $args{displays}; $tests_total = $args{tests}; + return if noninteractive(); + for my $n (1 .. @$displays) { # since we are moving upwards, get $display in reverse order my $display = $displays->[-$n]; @@ -41,6 +50,8 @@ sub status { my ($display, $msg) = @_; my $status = "[$display] $msg"; + return $status if noninteractive(); + print $ansi_save_cursor, $ansi_line_upwards{$display}, @@ -53,6 +64,9 @@ sub status { sub status_completed { my $num = shift; + + return if noninteractive(); + print $ansi_save_cursor, $ansi_clear_line,