[Piglit] [PATCH 3/6] dmesg: setup dmesg to be able to mark a test warn or fail

Dylan Baker baker.dylan.c at gmail.com
Thu Nov 14 08:04:20 PST 2013


On Thursday, November 14, 2013 02:52:41 PM Daniel Vetter wrote:
> On Tue, Nov 12, 2013 at 07:54:01AM -0800, Dylan Baker wrote:
> > This gives the dmesg class lists of statuses that will make a test a
> > warn or a fail, it includes a few basic checks, namely i915 errors and
> > that tests have not segfaulted.
> > 
> > Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> > ---
> > 
> >  framework/dmesg.py    | 36 ++++++++++++++++++++++++++++++++----
> >  framework/exectest.py | 22 +++++++++++++++-------
> >  2 files changed, 47 insertions(+), 11 deletions(-)
> > 
> > diff --git a/framework/dmesg.py b/framework/dmesg.py
> > index 9a23c14..edbea88 100644
> > --- a/framework/dmesg.py
> > +++ b/framework/dmesg.py
> > @@ -22,6 +22,7 @@
> > 
> >  """ Module implementing classes for reading posix dmesg """
> >  
> >  import os
> > 
> > +import re
> > 
> >  import subprocess
> >  from threads import synchronized_self
> > 
> > @@ -29,8 +30,10 @@ __all__ = ['Dmesg']
> > 
> >  # plain text list of statuses to be considered either a warn or a fail,
> >  any
> >  # statuses not on this list will simply be ignored.
> > 
> > -WARN_STATUSES = []
> > -FAIL_STATUSES = []
> > +WARN_STATUSES = ['segfault']
> > +FAIL_STATUSES = ['\[drm:.*\] \*ERROR\*',
> > +                 '\[drm\] stuck on [a-zA-Z]* ring',
> > +                 '\[drm\] GPU crash dump saved']
> 
> I think now that we filter out all the info/debug noise maybe we could go
> the other direction and blacklist a few of the remaining things from the
> core kernel we don't care about. E.g.
> 
> [ 3867.022895] gem_evict_every (2671) used greatest stack depth: 2216 bytes
> left
> 
> is a warn level message, but I don't care one bit about it (as long as it
> doesn't approach 0). But there's other warn level stuff which is fairly
> interesting.
> 
> Just something to throw out there, I'm not sure what the best way would be
> to integrate dmesg reporting for piglit in general.
> -Daniel
> 

My personal problem with the dmesg code we have now (and with *just* 
blacklisting) is that I have an alps touchpad, it spams dmesg about 10 times a 
minute, so I can't use dmesg reporting because of the massive number of false 
positives; we could use some combination of blacklisting and whitelisting 
however.

> >  class PosixDmesg(object):
> > @@ -45,6 +48,9 @@ class PosixDmesg(object):
> >      only be considered authoratative when running non-concurrently.
> >      
> >      """
> > 
> > +    _warns = [re.compile(r) for r in WARN_STATUSES]
> > +    _fails = [re.compile(r) for r in FAIL_STATUSES]
> > +
> > 
> >      def __init__(self):
> >          """ Create a dmesg instance """
> >          self.dmesg = []
> > 
> > @@ -57,10 +63,32 @@ class PosixDmesg(object):
> >      @synchronized_self
> > 
> >      def update_dmesg(self):
> > -        """ Call dmesg and look for changes. """
> > +        """ Call dmesg and look for changes
> > +
> > +        This class calls a helper that checks dmesg for changes, and then
> > +        processes those changes looking for warns and fails according to
> > the +        WARN_STATUSES and FAIL_STATUSES variables.
> > +
> > +        If there are no warns or fails it will return None. Otherwise it
> > will +        return a tuple containing a list of warns and a list of
> > fails +        respectively
> > +
> > +        """
> > +        def is_error(type, error):
> > +            """ Filter statuses that are warns or fails """
> > +            for pattern in type:
> > +                if pattern.search(error):
> > +                    return True
> > +            return False
> > +
> > 
> >          self._call_dmesg()
> > 
> > +        warns = [s for s in self._new_messages if is_error(self._warns,
> > s)] +        fails = [s for s in self._new_messages if
> > is_error(self._fails, s)]
> > 
> > -        return self._new_messages
> > +        if warns or fails:
> > +            return (warns, fails)
> > +        else:
> > +            return None
> > 
> >      def _call_dmesg(self):
> >          """ Call dmesg using subproces.check_output
> > 
> > diff --git a/framework/exectest.py b/framework/exectest.py
> > index a6c7719..827840b 100644
> > --- a/framework/exectest.py
> > +++ b/framework/exectest.py
> > 
> > @@ -86,7 +86,7 @@ class ExecTest(Test):
> >                  else:
> >                      (out, err, returncode) = \
> >                      
> >                          self.get_command_result(command, fullenv)
> > 
> > -                    dmesg_diff = dmesg.update_dmesg()
> > +                    dmesg_status = dmesg.update_dmesg()
> > 
> >                  # https://bugzilla.gnome.org/show_bug.cgi?id=680214 is
> >                  # affecting many developers.  If we catch it
> > 
> > @@ -121,7 +121,8 @@ class ExecTest(Test):
> >                  results['result'] = 'skip'
> >              
> >              else:
> >                  results['result'] = 'fail'
> > 
> > -                out = self.interpretResult(out, returncode, results,
> > dmesg_diff) +                out = self.interpretResult(out, returncode,
> > results, +                                           dmesg_status)
> > 
> >              crash_codes = [
> >              
> >                  # Unix: terminated by a signal
> > 
> > @@ -165,7 +166,10 @@ class ExecTest(Test):
> >                                                               err, out)
> >              
> >              results['returncode'] = returncode
> >              results['command'] = ' '.join(self.command)
> > 
> > -            results['dmesg'] = dmesg_diff
> > +            if dmesg_status:
> > +                results['dmesg'] = {}
> > +                results['dmesg']['warns'] = dmesg_status[0]
> > +                results['dmesg']['fails'] = dmesg_status[1]
> > 
> >              self.handleErr(results, err)
> > 
> > @@ -227,10 +231,14 @@ class PlainExecTest(ExecTest):
> >          outpiglit = map(lambda s: s[7:],
> >          
> >                          filter(lambda s: s.startswith('PIGLIT:'),
> >                          outlines))
> > 
> > -        if dmesg:
> > -            outpiglit = map(lambda s: s.replace("'pass'",
> > "'dmesg-warn'"), outpiglit) -            outpiglit = map(lambda s:
> > s.replace("'warn'", "'dmesg-warn'"), outpiglit) -            outpiglit =
> > map(lambda s: s.replace("'fail'", "'dmesg-fail'"), outpiglit) +       
> > try:
> > +            if dmesg[1]:
> > +                outpiglit = map(lambda s: s.replace("pass", "fail"),
> > outpiglit) +                outpiglit = map(lambda s: s.replace("warn",
> > "fail"), outpiglit) +            elif dmesg[0]:
> > +                outpiglit = map(lambda s: s.replace("pass", "warn"),
> > outpiglit) +        except TypeError:
> > +            pass
> > 
> >          if len(outpiglit) > 0:
> >              try:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131114/09cc1470/attachment-0001.pgp>


More information about the Piglit mailing list