diff options
author | Kevin Lubick <kjlubick@google.com> | 2017-02-20 08:48:35 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-21 13:44:58 +0000 |
commit | 0548a21dd52d093b14d584137ffe526087ba0b45 (patch) | |
tree | e252d80def80c54db71895fc64896f75c5972288 /infra | |
parent | 0396434adf4f7cdc1880046181d72167207f8ca5 (diff) |
Stream logs in symbolized dm/nanobench
BUG=skia:
Change-Id: I693bec4daa819f3c7802aa54f452b47f228b370b
Reviewed-on: https://skia-review.googlesource.com/8673
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Diffstat (limited to 'infra')
-rwxr-xr-x | infra/bots/recipe_modules/core/resources/symbolize_stack_trace.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/infra/bots/recipe_modules/core/resources/symbolize_stack_trace.py b/infra/bots/recipe_modules/core/resources/symbolize_stack_trace.py index ccd67c7665..59e1e39e08 100755 --- a/infra/bots/recipe_modules/core/resources/symbolize_stack_trace.py +++ b/infra/bots/recipe_modules/core/resources/symbolize_stack_trace.py @@ -4,6 +4,7 @@ # found in the LICENSE file. # pylint: disable=line-too-long +import collections import os import re import subprocess @@ -28,14 +29,15 @@ import sys # about the logs of previous steps without using a wrapper like this. def main(basedir, cmd): - logs = "" - retcode = 0 - try: - logs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip() - except subprocess.CalledProcessError as e: - retcode = e.returncode - logs = e.output + logs = collections.deque(maxlen=200) + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + for line in iter(proc.stdout.readline, ''): + sys.stdout.write(line) + logs.append(line) + proc.wait() + print 'Command exited with code %s' % proc.returncode # Stacktraces generally look like: # /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7fa90e8d0c62] # /b/s/w/irISUIyA/linux_vulkan_intel_driver_debug/./libvulkan_intel.so(+0x1f4d0a) [0x7fa909eead0a] @@ -51,11 +53,18 @@ def main(basedir, cmd): # The extra_path strips off the not-useful prefix and leaves just the # important src/gpu/Frobulator.cpp:13 bit. extra_path = r'/.*\.\./' - for line in logs.splitlines(): + is_first = True + for line in logs: line = line.strip() m = re.search(stack_line, line) if m: + if is_first: + print '#######################################' + print 'symbolized stacktrace follows' + print '#######################################' + is_first = False + path = m.group('path') addr = m.group('addr') addr2 = m.group('addr2') @@ -71,10 +80,9 @@ def main(basedir, cmd): path = path[len(basedir)+1:] sym = re.sub(extra_path, '', sym) line = path + ' ' + sym + print line - print line - - sys.exit(retcode) + sys.exit(proc.returncode) if __name__ == '__main__': |