[Lldb-commits] [lldb] r174784 - 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!)

Filipe Cabecinhas filcab at gmail.com
Fri Feb 8 16:52:02 PST 2013


My question is: can you run the tests?
With the latest clang trunk, a method in ClangASTSource has to be changed.
And even before that revision, clang was asserting, but I can't tell you
where, since I can't compile lldb right now.
I'm still checking out clang, but I'm not very familiar with it.

Regards,

  Filipe

P.S: Yes, progress bar mode seems like a very good idea.

  F


On Fri, Feb 8, 2013 at 4:37 PM, Enrico Granata <egranata at apple.com> wrote:

> Author: enrico
> Date: Fri Feb  8 18:37:07 2013
> New Revision: 174784
>
> URL: http://llvm.org/viewvc/llvm-project?rev=174784&view=rev
> Log:
> 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!
>
>
> Modified:
>     lldb/trunk/test/dotest.py
>     lldb/trunk/test/progress.py
>     lldb/trunk/test/unittest2/runner.py
>
> Modified: lldb/trunk/test/dotest.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=174784&r1=174783&r2=174784&view=diff
>
> ==============================================================================
> --- lldb/trunk/test/dotest.py (original)
> +++ lldb/trunk/test/dotest.py Fri Feb  8 18:37:07 2013
> @@ -1343,7 +1343,7 @@ for ia in range(len(archs) if iterArchs
>                  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)
> +                    self.progressbar =
> progress.ProgressWithEvents(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
>
> Modified: lldb/trunk/test/progress.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/progress.py?rev=174784&r1=174783&r2=174784&view=diff
>
> ==============================================================================
> --- lldb/trunk/test/progress.py (original)
> +++ lldb/trunk/test/progress.py Fri Feb  8 18:37:07 2013
> @@ -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)
>
> Modified: lldb/trunk/test/unittest2/runner.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/unittest2/runner.py?rev=174784&r1=174783&r2=174784&view=diff
>
> ==============================================================================
> --- lldb/trunk/test/unittest2/runner.py (original)
> +++ lldb/trunk/test/unittest2/runner.py Fri Feb  8 18:37:07 2013
> @@ -62,71 +62,43 @@ class TextTestResult(result.TestResult):
>              self.stream.write(" ... ")
>              self.stream.flush()
>
> -    def addSuccess(self, test):
> -        super(TextTestResult, self).addSuccess(test)
> +    def newTestResult(self,test,result_short,result_long):
>          if self.showAll:
> -            self.stream.writeln("ok")
> +            self.stream.writeln(result_long)
>          elif self.progressbar:
>              self.progressbar.__add__(1)
> +            self.progressbar.add_event(result_short)
>              self.progressbar.show_progress()
>          elif self.dots:
> -            self.stream.write('.')
> +            self.stream.write(result_short)
>              self.stream.flush()
>
> +    def addSuccess(self, test):
> +        super(TextTestResult, self).addSuccess(test)
> +        if self.progressbar:
> +            self.newTestResult(test,"ok","ok")
> +        else:
> +            self.newTestResult(test,".","ok")
> +
>      def addError(self, test, err):
>          super(TextTestResult, self).addError(test, err)
> -        if self.showAll:
> -            self.stream.writeln("ERROR")
> -        elif self.progressbar:
> -            self.progressbar.__add__(1)
> -            self.progressbar.show_progress()
> -        elif self.dots:
> -            self.stream.write('E')
> -            self.stream.flush()
> +        self.newTestResult(test,"E","ERROR")
>
>      def addFailure(self, test, err):
>          super(TextTestResult, self).addFailure(test, err)
> -        if self.showAll:
> -            self.stream.writeln("FAIL")
> -        elif self.progressbar:
> -            self.progressbar.__add__(1)
> -            self.progressbar.show_progress()
> -        elif self.dots:
> -            self.stream.write('F')
> -            self.stream.flush()
> +        self.newTestResult(test,"F","FAILURE")
>
>      def addSkip(self, test, reason):
>          super(TextTestResult, self).addSkip(test, reason)
> -        if self.showAll:
> -            self.stream.writeln("skipped %r" % (reason,))
> -        elif self.progressbar:
> -            self.progressbar.__add__(1)
> -            self.progressbar.show_progress()
> -        elif self.dots:
> -            self.stream.write("s")
> -            self.stream.flush()
> +        self.newTestResult(test,"s","skipped %r" % (reason,))
>
>      def addExpectedFailure(self, test, err):
>          super(TextTestResult, self).addExpectedFailure(test, err)
> -        if self.showAll:
> -            self.stream.writeln("expected failure")
> -        elif self.progressbar:
> -            self.progressbar.__add__(1)
> -            self.progressbar.show_progress()
> -        elif self.dots:
> -            self.stream.write("x")
> -            self.stream.flush()
> +        self.newTestResult(test,"x","expected failure")
>
>      def addUnexpectedSuccess(self, test):
>          super(TextTestResult, self).addUnexpectedSuccess(test)
> -        if self.showAll:
> -            self.stream.writeln("unexpected success")
> -        elif self.progressbar:
> -            self.progressbar.__add__(1)
> -            self.progressbar.show_progress()
> -        elif self.dots:
> -            self.stream.write("u")
> -            self.stream.flush()
> +        self.newTestResult(test,"u","unexpected success")
>
>      def printErrors(self):
>          if self.progressbar:
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130208/4d1d85c7/attachment.html>


More information about the lldb-commits mailing list