Title: [139831] trunk/Tools
- Revision
- 139831
- Author
- dpra...@chromium.org
- Date
- 2013-01-15 20:44:48 -0800 (Tue, 15 Jan 2013)
Log Message
test-webkitpy: truncate output to the terminal width when necessary
https://bugs.webkit.org/show_bug.cgi?id=106973
Reviewed by Ojan Vafai.
this implements the same logic for test-webkitpy that we have
for run-webkit-tests (and ninja).
No tests written as this is exercised by running test-webkitpy itself.
* Scripts/webkitpy/test/printer.py:
(Printer.configure):
(Printer._test_line):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (139830 => 139831)
--- trunk/Tools/ChangeLog 2013-01-16 04:42:47 UTC (rev 139830)
+++ trunk/Tools/ChangeLog 2013-01-16 04:44:48 UTC (rev 139831)
@@ -1,5 +1,21 @@
2013-01-15 Dirk Pranke <dpra...@chromium.org>
+ test-webkitpy: truncate output to the terminal width when necessary
+ https://bugs.webkit.org/show_bug.cgi?id=106973
+
+ Reviewed by Ojan Vafai.
+
+ this implements the same logic for test-webkitpy that we have
+ for run-webkit-tests (and ninja).
+
+ No tests written as this is exercised by running test-webkitpy itself.
+
+ * Scripts/webkitpy/test/printer.py:
+ (Printer.configure):
+ (Printer._test_line):
+
+2013-01-15 Dirk Pranke <dpra...@chromium.org>
+
remove extraneous output in test-webkitpy
https://bugs.webkit.org/show_bug.cgi?id=106971
Modified: trunk/Tools/Scripts/webkitpy/test/printer.py (139830 => 139831)
--- trunk/Tools/Scripts/webkitpy/test/printer.py 2013-01-16 04:42:47 UTC (rev 139830)
+++ trunk/Tools/Scripts/webkitpy/test/printer.py 2013-01-16 04:44:48 UTC (rev 139831)
@@ -25,6 +25,7 @@
import StringIO
from webkitpy.common.system import outputcapture
+from webkitpy.common.system.systemhost import SystemHost
from webkitpy.layout_tests.views.metered_stream import MeteredStream
_log = logging.getLogger(__name__)
@@ -57,7 +58,8 @@
elif options.verbose == 2:
log_level = logging.DEBUG
- self.meter = MeteredStream(self.stream, (options.verbose == 2))
+ self.meter = MeteredStream(self.stream, (options.verbose == 2),
+ number_of_columns=SystemHost().platform.terminal_width())
handler = logging.StreamHandler(self.stream)
# We constrain the level on the handler rather than on the root
@@ -159,7 +161,19 @@
self.completed_tests = []
def _test_line(self, test_name, suffix):
- return '[%d/%d] %s%s' % (self.num_completed, self.num_tests, test_name, suffix)
+ format_string = '[%d/%d] %s%s'
+ status_line = format_string % (self.num_completed, self.num_tests, test_name, suffix)
+ if len(status_line) > self.meter.number_of_columns():
+ overflow_columns = len(status_line) - self.meter.number_of_columns()
+ ellipsis = '...'
+ if len(test_name) < overflow_columns + len(ellipsis) + 3:
+ # We don't have enough space even if we elide, just show the test method name.
+ test_name = test_name.split('.')[-1]
+ else:
+ new_length = len(test_name) - overflow_columns - len(ellipsis)
+ prefix = int(new_length / 2)
+ test_name = test_name[:prefix] + ellipsis + test_name[-(new_length - prefix):]
+ return format_string % (self.num_completed, self.num_tests, test_name, suffix)
def print_result(self, run_time):
write = self.meter.writeln
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes