Title: [90461] trunk/Tools
- Revision
- 90461
- Author
- [email protected]
- Date
- 2011-07-06 08:44:02 -0700 (Wed, 06 Jul 2011)
Log 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.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (90460 => 90461)
--- trunk/Tools/ChangeLog 2011-07-06 15:25:40 UTC (rev 90460)
+++ trunk/Tools/ChangeLog 2011-07-06 15:44:02 UTC (rev 90461)
@@ -1,3 +1,30 @@
+2011-07-06 Adam Roben <[email protected]>
+
+ 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.
+
2011-07-06 Xan Lopez <[email protected]>
Reviewed by Gustavo Noronha.
Modified: trunk/Tools/Scripts/run-api-tests (90460 => 90461)
--- trunk/Tools/Scripts/run-api-tests 2011-07-06 15:25:40 UTC (rev 90460)
+++ trunk/Tools/Scripts/run-api-tests 2011-07-06 15:44:02 UTC (rev 90461)
@@ -36,7 +36,7 @@
use IPC::Open3;
use lib $FindBin::Bin;
use webkitdirs;
-use Term::ANSIColor qw(:constants);
+use Term::ANSIColor qw(colored);
sub buildTestTool();
sub dumpAllTests();
@@ -44,6 +44,7 @@
sub runAllTests();
sub runAllTestsInSuite($);
sub runTest($$);
+sub possiblyColored($$);
sub prepareEnvironmentForRunningTestTool();
sub testToolPath();
@@ -117,7 +118,7 @@
sub runAllTestsInSuite($)
{
my ($suite) = @_;
- print "Suite: $suite\n";
+ print "Suite: $suite\n" unless $verbose;
my $anyFailures = 0;
for my $test (@{$testsToRun{$suite}}) {
@@ -137,7 +138,7 @@
my $gtestArg = "--gtest_filter=" . $test;
- print " Test: $testName -> ";
+ print " Test: $testName -> " unless $verbose;
my $result = 0;
my $timedOut = 0;
@@ -182,12 +183,15 @@
}
if ($timedOut) {
- print BOLD YELLOW, "Timeout", RESET, "\n";
- } elsif (!$result) {
- print BOLD GREEN, "Passed", RESET, "\n";
- } else {
- print BOLD RED, "Failed", RESET, "\n";
+ print possiblyColored("bold yellow", "Timeout"), "\n";
+ } elsif (!$verbose) {
+ if ($result) {
+ print possiblyColored("bold red", "Failed"), "\n";
+ } else {
+ print possiblyColored("bold green", "Passed"), "\n";
+ }
}
+
return $timedOut || $result;
}
@@ -287,6 +291,17 @@
chdir $originalCwd;
}
+sub possiblyColored($$)
+{
+ my ($colors, $string) = @_;
+
+ if (-t STDOUT) {
+ return colored([$colors], $string);
+ } else {
+ return $string;
+ }
+}
+
sub prepareEnvironmentForRunningTestTool()
{
return unless isAppleMacWebKit();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes