Changeset 90461 in webkit


Ignore:
Timestamp:
Jul 6, 2011 8:44:02 AM (13 years ago)
Author:
Adam Roben
Message:

Make run-api-tests output intelligible on the bots

run-api-tests's output on the bots was very hard to read for two reasons:

1) It was mixing its own output with gtest's
2) It was using ANSI escape sequences to print colored text, but the bots don't support

that

Now, the --verbose flag turns off almost all of run-api-tests's own output so that gtest's
output will not be obscured. We still print "Timeout" messages even in verbose mode, since
gtest doesn't have any native support for timeouts. Also, when our output is being
redirected to a file, we don't print ANSI escape sequences.

Fixes <http://webkit.org/b/63996> It's very hard to read run-api-tests output on the bots

Reviewed by Sam Weinig.

  • Scripts/run-api-tests: Don't use the :constants interface of Term::ANSIColor. We want to

use the colored function instead.
(runAllTestsInSuite): Don't print out suite names in verbose mode; gtest will give us enough
context that they aren't needed.
(runTest): Don't print out test names or pass/fail messages in verbose mode; gtest will do
that for us. Also, use the new possiblyColored function instead of always coloring output.
(possiblyColored): Added. When printing to a tty, returns the string with the appropriate
ANSI color escape sequences added. Otherwise just returns the string unmodified.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r90459 r90461  
     12011-07-06  Adam Roben  <aroben@apple.com>
     2
     3        Make run-api-tests output intelligible on the bots
     4
     5        run-api-tests's output on the bots was very hard to read for two reasons:
     6          1) It was mixing its own output with gtest's
     7          2) It was using ANSI escape sequences to print colored text, but the bots don't support
     8             that
     9
     10        Now, the --verbose flag turns off almost all of run-api-tests's own output so that gtest's
     11        output will not be obscured. We still print "Timeout" messages even in verbose mode, since
     12        gtest doesn't have any native support for timeouts. Also, when our output is being
     13        redirected to a file, we don't print ANSI escape sequences.
     14
     15        Fixes <http://webkit.org/b/63996> It's very hard to read run-api-tests output on the bots
     16
     17        Reviewed by Sam Weinig.
     18
     19        * Scripts/run-api-tests: Don't use the :constants interface of Term::ANSIColor. We want to
     20        use the colored function instead.
     21        (runAllTestsInSuite): Don't print out suite names in verbose mode; gtest will give us enough
     22        context that they aren't needed.
     23        (runTest): Don't print out test names or pass/fail messages in verbose mode; gtest will do
     24        that for us. Also, use the new possiblyColored function instead of always coloring output.
     25        (possiblyColored): Added. When printing to a tty, returns the string with the appropriate
     26        ANSI color escape sequences added. Otherwise just returns the string unmodified.
     27
    1282011-07-06  Xan Lopez  <xlopez@igalia.com>
    229
  • trunk/Tools/Scripts/run-api-tests

    r90408 r90461  
    3737use lib $FindBin::Bin;
    3838use webkitdirs;
    39 use Term::ANSIColor qw(:constants);
     39use Term::ANSIColor qw(colored);
    4040
    4141sub buildTestTool();
     
    4545sub runAllTestsInSuite($);
    4646sub runTest($$);
     47sub possiblyColored($$);
    4748sub prepareEnvironmentForRunningTestTool();
    4849sub testToolPath();
     
    118119{
    119120    my ($suite) = @_;
    120     print "Suite: $suite\n";
     121    print "Suite: $suite\n" unless $verbose;
    121122
    122123    my $anyFailures = 0;
     
    138139    my $gtestArg = "--gtest_filter=" . $test;
    139140
    140     print "    Test: $testName -> ";
     141    print "    Test: $testName -> " unless $verbose;
    141142
    142143    my $result = 0;
     
    183184
    184185    if ($timedOut) {
    185         print BOLD YELLOW, "Timeout", RESET, "\n";
    186     } elsif (!$result) {
    187         print BOLD GREEN, "Passed", RESET, "\n";
    188     } else {
    189         print BOLD RED, "Failed", RESET, "\n";
    190     }
     186        print possiblyColored("bold yellow", "Timeout"), "\n";
     187    } elsif (!$verbose) {
     188        if ($result) {
     189            print possiblyColored("bold red", "Failed"), "\n";
     190        } else {
     191            print possiblyColored("bold green", "Passed"), "\n";
     192        }
     193    }
     194
    191195    return $timedOut || $result;
    192196}
     
    288292}
    289293
     294sub possiblyColored($$)
     295{
     296    my ($colors, $string) = @_;
     297
     298    if (-t STDOUT) {
     299        return colored([$colors], $string);
     300    } else {
     301        return $string;
     302    }
     303}
     304
    290305sub prepareEnvironmentForRunningTestTool()
    291306{
Note: See TracChangeset for help on using the changeset viewer.