skpbench: filter out junk spewed by Pixel C driver
authorcsmartdalton <csmartdalton@google.com>
Wed, 9 Nov 2016 21:25:23 +0000 (13:25 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 9 Nov 2016 21:25:24 +0000 (13:25 -0800)
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2488043003

Review-Url: https://codereview.chromium.org/2488043003

tools/skpbench/_hardware.py
tools/skpbench/_hardware_pixel_c.py
tools/skpbench/skpbench.py

index 525c4c1e491cce7d8bfaa2fd127b5a0968bc3638..de8848df783092e89f87ea5e198900aebdbe7bee 100644 (file)
@@ -29,6 +29,10 @@ class Hardware:
   def __exit__(self, exception_type, exception_value, traceback):
     pass
 
+  def filter_line(self, line):
+    """Returns False if the provided output line can be suppressed."""
+    return True
+
   def sanity_check(self):
     """Raises a HardwareException if any hardware state is not as expected."""
     pass
index 47f3ec4b0b355078727a9d7f6771a9e0124a1f55..a1cd17a0846df87bf0f0407f6ea05db81c9c9001 100644 (file)
@@ -23,6 +23,11 @@ class HardwarePixelC(HardwareAndroid):
                              exception_value, exception_traceback)
     self._unlock_clocks()
 
+  def filter_line(self, line):
+    JUNK = ['NvRmPrivGetChipPlatform: Could not read platform information',
+            'Expected on kernels without fuse support, using silicon']
+    return False if line in JUNK else HardwareAndroid.filter_line(self, line)
+
   def _lock_clocks(self):
     if not self._adb.is_root():
       return
index fc5082b94ee60ea1aeb761bab6beee1b8f0ef83c..907d193d4e82e5666ff34ef7cfc7192fc222c8cc 100755 (executable)
@@ -129,9 +129,10 @@ class SKPBench:
                               '--config', 'gpu',
                               '--skp', 'warmup']
     dump_commandline_if_verbose(commandline)
-    output = subprocess.check_output(commandline).decode('utf-8')
+    output = subprocess.check_output(commandline, stderr=subprocess.STDOUT)
+
     # validate the warmup run output.
-    for line in output.split('\n'):
+    for line in output.decode('utf-8').split('\n'):
       match = BenchResult.match(line.rstrip())
       if match and match.bench == 'warmup':
         return
@@ -168,7 +169,8 @@ class SKPBench:
                            _path.basename(self.skp) + '.png')
       commandline.extend(['--png', pngfile])
     dump_commandline_if_verbose(commandline)
-    self._proc = subprocess.Popen(commandline, stdout=subprocess.PIPE)
+    self._proc = subprocess.Popen(commandline, stdout=subprocess.PIPE,
+                                  stderr=subprocess.STDOUT)
     self._monitor = SubprocessMonitor(self._queue, self._proc)
     self._monitor.start()
 
@@ -179,9 +181,8 @@ class SKPBench:
         if result:
           hardware.sanity_check()
           self._process_result(result)
-        else:
+        elif hardware.filter_line(message.value):
           print(message.value, file=sys.stderr)
-        sys.stdout.flush()
         continue
       if message.message == Message.POLL_HARDWARE:
         hardware.sanity_check()
@@ -211,6 +212,7 @@ class SKPBench:
             "(%s%% instead of %s%%)." %
             (result.config, result.bench, self.best_result.stddev,
              result.stddev), file=sys.stderr)
+      sys.stdout.flush()
     if self.max_stddev and self.best_result.stddev > self.max_stddev:
       raise StddevException()