diff options
author | Enrico Granata <egranata@apple.com> | 2013-02-09 00:37:07 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2013-02-09 00:37:07 +0000 |
commit | eba9e4a3aaaf280d76db0e8eb4af80f374a3a04e (patch) | |
tree | bf3c7999b278d62efee02f2a76f6e513f4e7d022 /lldb/test/progress.py | |
parent | fac770b865f59cbe615241dad153ad20d5138b9e (diff) | |
download | bcm5719-llvm-eba9e4a3aaaf280d76db0e8eb4af80f374a3a04e.tar.gz bcm5719-llvm-eba9e4a3aaaf280d76db0e8eb4af80f374a3a04e.zip |
The new progress bar mode was losing us information compared to the old dots mode in that we would have no way of knowing about test failures (short of peeking into the test result directory.. and you're not supposed to peek!)
Added a new line of information that reports the count of tests that pass, fail or have other things happen to them.
Again no flag to have the dots back. If you care, let us know!
llvm-svn: 174784
Diffstat (limited to 'lldb/test/progress.py')
-rwxr-xr-x | lldb/test/progress.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lldb/test/progress.py b/lldb/test/progress.py index 2d400a6e446..e35080bc5bc 100755 --- a/lldb/test/progress.py +++ b/lldb/test/progress.py @@ -96,6 +96,46 @@ class AnimatedProgressBar(ProgressBar): self.stdout.write(str(self)) self.stdout.flush() +class ProgressWithEvents(AnimatedProgressBar): + """Extends AnimatedProgressBar to allow you to track a set of events that + cause the progress to move. For instance, in a deletion progress bar, you + can track files that were nuked and files that the user doesn't have access to + """ + def __init__(self, + start=0, + end=10, + width=12, + fill=unichr(0x25C9).encode("utf-8"), + blank=unichr(0x25CC).encode("utf-8"), + marker=unichr(0x25CE).encode("utf-8"), + format='[%(fill)s%(marker)s%(blank)s] %(progress)s%%', + incremental=True, + stdout=sys.stdout): + super(ProgressWithEvents, self).__init__(start,end,width,fill,blank,marker,format,incremental,stdout) + self.events = {} + + def add_event(self,event): + if event in self.events: + self.events[event] += 1 + else: + self.events[event] = 1 + + def show_progress(self): + isatty = hasattr(self.stdout, 'isatty') and self.stdout.isatty() + if isatty: + self.stdout.write('\r') + else: + self.stdout.write('\n') + self.stdout.write(str(self)) + if len(self.events) == 0: + return + self.stdout.write('\n') + for key in self.events.keys(): + self.stdout.write(str(key) + ' = ' + str(self.events[key]) + ' ') + if isatty: + self.stdout.write('\033[1A') + self.stdout.flush() + if __name__ == '__main__': p = AnimatedProgressBar(end=200, width=200) |