diff options
Diffstat (limited to 'lldb/test/dotest.py')
-rwxr-xr-x | lldb/test/dotest.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lldb/test/dotest.py b/lldb/test/dotest.py index 0330a3585cd..599bfda2649 100755 --- a/lldb/test/dotest.py +++ b/lldb/test/dotest.py @@ -29,6 +29,7 @@ import sys import textwrap import time import unittest2 +import progress def is_exe(fpath): """Returns true if fpath is an executable.""" @@ -1302,6 +1303,30 @@ for ia in range(len(archs) if iterArchs else 1): __singleton__ = None __ignore_singleton__ = False + @staticmethod + def getTerminalSize(): + import os + env = os.environ + def ioctl_GWINSZ(fd): + try: + import fcntl, termios, struct, os + cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, + '1234')) + except: + return + return cr + cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2) + if not cr: + try: + fd = os.open(os.ctermid(), os.O_RDONLY) + cr = ioctl_GWINSZ(fd) + os.close(fd) + except: + pass + if not cr: + cr = (env.get('LINES', 25), env.get('COLUMNS', 80)) + return int(cr[1]), int(cr[0]) + def __init__(self, *args): if not LLDBTestResult.__ignore_singleton__ and LLDBTestResult.__singleton__: raise Exception("LLDBTestResult instantiated more than once") @@ -1316,6 +1341,9 @@ for ia in range(len(archs) if iterArchs else 1): self.indentation = ' ' * (counterWidth + 2) # This counts from 1 .. suite.countTestCases(). self.counter = 0 + (width, height) = LLDBTestResult.getTerminalSize() + if width > 10: + self.progressbar = progress.AnimatedProgressBar(stdout=self.stream,start=0,end=suite.countTestCases(),width=width-10) def _exc_info_to_string(self, err, test): """Overrides superclass TestResult's method in order to append |