[Piglit] [PATCH 08/13] framework/exectest.py: simplify gnome bug loop
Ilia Mirkin
imirkin at alum.mit.edu
Tue Apr 15 17:07:00 PDT 2014
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
> break
>
> results['result'] = 'fail'
> --
> 1.9.2
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list