[Piglit] [PATCH 08/13] framework/exectest.py: simplify gnome bug loop

Dylan Baker baker.dylan.c at gmail.com
Wed Apr 16 14:53:47 PDT 2014


On Tuesday, April 15, 2014 20:07:00 Ilia Mirkin wrote:
> On Tue, Apr 15, 2014 at 7:12 PM, Dylan Baker 
<baker.dylan.c at gmail.com> wrote:
> > This uses a for loop instead of an incrementing while loop. This might
> > be slightly faster since xrange() doesn't do arithmetic, but the big
> > advantage is less code and it's easier to read.
> > 
> > Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> > ---
> > 
> >  framework/exectest.py | 9 ++-------
> >  1 file changed, 2 insertions(+), 7 deletions(-)
> > 
> > diff --git a/framework/exectest.py b/framework/exectest.py
> > index effe12e..8d1dbbf 100644
> > --- a/framework/exectest.py
> > +++ b/framework/exectest.py
> > 
> > @@ -154,18 +154,13 @@ class Test(object):
> >                  results['returncode'] = None
> >                  return results
> > 
> > -            i = 0
> > -            while True:
> > 
> > +            for _ in xrange(5):
> >                  out, err, returncode = self.get_command_result()
> >                  
> >                  # https://bugzilla.gnome.org/show_bug.cgi?id=680214 is
> >                  # affecting many developers.  If we catch it
> >                  # happening, try just re-running the test.
> > 
> > -                if out.find("Got spurious window resize") >= 0:
> > -                    i = i + 1
> > -                    if i >= 5:
> > -                        break
> > -                else:
> 
> > +                if out.find("Got spurious window resize") == -1:
> While on the subject of simplification, how about
> 
> if "Got spurious window resize" not in out:
>   break

Good call. I'll do that.

> 
> >                      break
> >              
> >              results['result'] = 'fail'
> > 
> > --
> > 1.9.2
> > 
> > _______________________________________________
> > Piglit mailing list
> > Piglit at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140416/23736363/attachment.html>
-------------- 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/20140416/23736363/attachment.sig>


More information about the Piglit mailing list