Title: [125204] trunk/Tools
Revision
125204
Author
[email protected]
Date
2012-08-09 14:35:55 -0700 (Thu, 09 Aug 2012)

Log Message

nrwt: should log progress like ninja does
https://bugs.webkit.org/show_bug.cgi?id=93563

Reviewed by Ojan Vafai.

This change modifies the output of nrwt in the
non--debug-rwt-logging modes.

In non-verbose mode, the output changes from:
  "Testing (50%): 96 ran as expected, 4 didn't, 100 left"
to:
  "[100/200] foo.html (+4)"
or:
  "[100/200] foo.html failed  unexpectedly (text diff)"

which indicates the earliest test currently running (optionally plus the
count of other currently-executing tests if we're running tests in parallel)
or the result of said test.

If the test produces unexpected results, that line is flushed
rather than erased (so we no longer need the %d didn't running
tally).

In --verbose mode, the output is similar, but every test gets a
line (and tests are logged in order of them being started, not
order of them being completed) (and in --details mode, the
first line of each test matches --verbose but the other lines
are unchanged).

The overall result should be easier to read and is simpler to
implement as well (apart from managing the number of tests that
have started but not completed, which is slightly annoying).

This also matches the output style for test-webkitpy, more-or-less.

* Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
(LayoutTestRunner.run_tests):
(LayoutTestRunner._update_summary_with_result):
(LayoutTestRunner._handle_started_test):
* Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py:
(FakePrinter):
(FakePrinter.print_started_test):
(FakePrinter.print_finished_test):
* Scripts/webkitpy/layout_tests/views/printing.py:
(Printer.__init__):
(Printer.print_started_test):
(Printer.print_finished_test):
(Printer._print_test_trace):
(Printer._print_progress):
* Scripts/webkitpy/layout_tests/views/printing_unittest.py:
(test_details):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (125203 => 125204)


--- trunk/Tools/ChangeLog	2012-08-09 21:25:32 UTC (rev 125203)
+++ trunk/Tools/ChangeLog	2012-08-09 21:35:55 UTC (rev 125204)
@@ -1,3 +1,57 @@
+2012-08-09  Dirk Pranke  <[email protected]>
+
+        nrwt: should log progress like ninja does
+        https://bugs.webkit.org/show_bug.cgi?id=93563
+
+        Reviewed by Ojan Vafai.
+
+        This change modifies the output of nrwt in the
+        non--debug-rwt-logging modes.
+
+        In non-verbose mode, the output changes from:
+          "Testing (50%): 96 ran as expected, 4 didn't, 100 left"
+        to:
+          "[100/200] foo.html (+4)"
+        or:
+          "[100/200] foo.html failed  unexpectedly (text diff)"
+
+        which indicates the earliest test currently running (optionally plus the
+        count of other currently-executing tests if we're running tests in parallel)
+        or the result of said test.
+
+        If the test produces unexpected results, that line is flushed
+        rather than erased (so we no longer need the %d didn't running
+        tally).
+
+        In --verbose mode, the output is similar, but every test gets a
+        line (and tests are logged in order of them being started, not
+        order of them being completed) (and in --details mode, the
+        first line of each test matches --verbose but the other lines
+        are unchanged).
+        
+        The overall result should be easier to read and is simpler to
+        implement as well (apart from managing the number of tests that
+        have started but not completed, which is slightly annoying).
+
+        This also matches the output style for test-webkitpy, more-or-less.
+
+        * Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
+        (LayoutTestRunner.run_tests):
+        (LayoutTestRunner._update_summary_with_result):
+        (LayoutTestRunner._handle_started_test):
+        * Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py:
+        (FakePrinter):
+        (FakePrinter.print_started_test):
+        (FakePrinter.print_finished_test):
+        * Scripts/webkitpy/layout_tests/views/printing.py:
+        (Printer.__init__):
+        (Printer.print_started_test):
+        (Printer.print_finished_test):
+        (Printer._print_test_trace):
+        (Printer._print_progress):
+        * Scripts/webkitpy/layout_tests/views/printing_unittest.py:
+        (test_details):
+
 2012-08-09  Alexey Proskuryakov  <[email protected]>
 
         [WK2] Add a process model constant for multiple processes

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py (125203 => 125204)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py	2012-08-09 21:25:32 UTC (rev 125203)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py	2012-08-09 21:35:55 UTC (rev 125204)
@@ -101,6 +101,8 @@
         self._needs_websockets = needs_websockets
         self._retrying = retrying
         self._test_files_list = [test_input.test_name for test_input in test_inputs]
+        self._printer.num_tests = len(self._test_files_list)
+        self._printer.num_completed = 0
 
         self._all_results = []
         self._group_stats = {}
@@ -202,8 +204,7 @@
 
         result_summary.add(result, expected, self._test_is_slow(result.test_name))
 
-        # FIXME: there's too many arguments to this function.
-        self._printer.print_finished_test(result, expected, exp_str, got_str, result_summary, self._retrying, self._test_files_list)
+        self._printer.print_finished_test(result, expected, exp_str, got_str)
 
         self._interrupt_if_at_failure_limits(result_summary)
 
@@ -237,8 +238,7 @@
         raise AssertionError('unknown message %s received from %s, args=%s' % (name, source, repr(args)))
 
     def _handle_started_test(self, worker_name, test_input, test_timeout_sec):
-        # FIXME: log that we've started another test.
-        pass
+        self._printer.print_started_test(test_input.test_name)
 
     def _handle_finished_test_list(self, worker_name, list_name, num_tests, elapsed_time):
         self._group_stats[list_name] = (num_tests, elapsed_time)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py (125203 => 125204)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py	2012-08-09 21:25:32 UTC (rev 125203)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py	2012-08-09 21:35:55 UTC (rev 125204)
@@ -44,12 +44,18 @@
 
 
 class FakePrinter(object):
+    num_completed = 0
+    num_tests = 0
+
     def print_workers_and_shards(self, num_workers, num_shards, num_locked_shards):
         pass
 
-    def print_finished_test(self, result, expected, exp_str, got_str, result_summary, retrying, test_names):
+    def print_started_test(self, test_name):
         pass
 
+    def print_finished_test(self, result, expected, exp_str, got_str):
+        pass
+
     def write(self, msg):
         pass
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/views/printing.py (125203 => 125204)


--- trunk/Tools/Scripts/webkitpy/layout_tests/views/printing.py	2012-08-09 21:25:32 UTC (rev 125203)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/views/printing.py	2012-08-09 21:35:55 UTC (rev 125204)
@@ -68,10 +68,14 @@
     By default the buildbot-parsed code gets logged to stdout, and regular
     output gets logged to stderr."""
     def __init__(self, port, options, regular_output, buildbot_output, logger=None):
+        self.num_completed = 0
+        self.num_tests = 0
         self._port = port
         self._options = options
         self._buildbot_stream = buildbot_output
         self._meter = MeteredStream(regular_output, options.debug_rwt_logging, logger=logger)
+        self._running_tests = []
+        self._completed_tests = []
 
     def cleanup(self):
         self._meter.cleanup()
@@ -320,20 +324,47 @@
         self._print_quiet(summary)
         self._print_quiet("")
 
-    def print_finished_test(self, result, expected, exp_str, got_str, result_summary, retrying, test_files_list):
-        self._print_test_result(result, expected, exp_str, got_str)
-        self._print_progress(result_summary, retrying, test_files_list)
+    def print_started_test(self, test_name):
+        self._running_tests.append(test_name)
+        if len(self._running_tests) > 1:
+            suffix = ' (+%d)' % (len(self._running_tests) - 1)
+        else:
+            suffix = ''
+        if self._options.verbose:
+            write = self._meter.write_update
+        else:
+            write = self._meter.write_throttled_update
+        write('[%d/%d] %s%s' % (self.num_completed, self.num_tests, test_name, suffix))
 
-    def _print_test_result(self, result, expected, exp_str, got_str):
+    def print_finished_test(self, result, expected, exp_str, got_str):
+        self.num_completed += 1
+        test_name = result.test_name
         if self._options.details:
             self._print_test_trace(result, exp_str, got_str)
         elif (self._options.verbose and not self._options.debug_rwt_logging) or not expected:
             desc = TestExpectations.EXPECTATION_DESCRIPTIONS[result.type]
-            self.writeln("%s %s%s%s" % (result.test_name, desc[1], "" if expected else " unexpectedly", desc[2]))
+            suffix = ' ' + desc[1]
+            if not expected:
+                suffix += ' unexpectedly' + desc[2]
+            self.writeln("[%d/%d] %s%s" % (self.num_completed, self.num_tests, test_name, suffix))
+        elif self.num_completed == self.num_tests:
+            self._meter.write_update('')
+        else:
+            desc = TestExpectations.EXPECTATION_DESCRIPTIONS[result.type]
+            suffix = ' ' + desc[1]
+            if test_name == self._running_tests[0]:
+                self._completed_tests.insert(0, [test_name, suffix])
+            else:
+                self._completed_tests.append([test_name, suffix])
 
+            for test_name, suffix in self._completed_tests:
+                self._meter.write_throttled_update('[%d/%d] %s%s' % (self.num_completed, self.num_tests, test_name, suffix))
+            self._completed_tests = []
+        self._running_tests.remove(test_name)
+
     def _print_test_trace(self, result, exp_str, got_str):
         test_name = result.test_name
-        self._print_default('trace: %s' % test_name)
+        self._print_default('[%d/%d] %s' % (self.num_completed, self.num_tests, test_name))
 
         base = self._port.lookup_virtual_test_base(test_name)
         if base:
@@ -359,20 +390,6 @@
 
     def _print_progress(self, result_summary, retrying, test_list):
         """Print progress through the tests as determined by --print."""
-        if result_summary.remaining == 0:
-            self._meter.write_update('')
-            return
-
-        percent_complete = 100 * (result_summary.expected +
-            result_summary.unexpected) / result_summary.total
-        action = ""
-        if retrying:
-            action = ""
-
-        self._meter.write_throttled_update("%s (%d%%): %d ran as expected, %d didn't, %d left" %
-            (action, percent_complete, result_summary.expected,
-             result_summary.unexpected, result_summary.remaining))
-
     def _print_unexpected_results(self, unexpected_results):
         # Prints to the buildbot stream
         passes = {}

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py (125203 => 125204)


--- trunk/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py	2012-08-09 21:25:32 UTC (rev 125203)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py	2012-08-09 21:35:55 UTC (rev 125204)
@@ -251,7 +251,8 @@
     def test_details(self):
         printer, err, _ = self.get_printer(['--details'])
         result = self.get_result('passes/image.html')
-        printer._print_test_result(result, expected=False, exp_str='', got_str='')
+        printer.print_started_test('passes/image.html')
+        printer.print_finished_test(result, expected=False, exp_str='', got_str='')
         self.assertNotEmpty(err)
 
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to