[Piglit] [PATCH 05/15] test: Split the spurious resize code out of PiglitGLTest
Dylan Baker
baker.dylan.c at gmail.com
Fri Oct 3 17:57:46 PDT 2014
This patch splits that run method out into a separate mixin class that
overrides only the _run_command method. This split will be used in the
next patch to apply the same mixin to the GleanTest class, which
theoretically suffers from the same problem but doesn't have this catch.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/test/base.py | 21 +++++++++++++++++++++
framework/test/piglit_test.py | 18 ++++--------------
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/framework/test/base.py b/framework/test/base.py
index 87575e4..5e8afde 100644
--- a/framework/test/base.py
+++ b/framework/test/base.py
@@ -41,6 +41,7 @@ from framework.results import TestResult
__all__ = [
'Test',
+ 'WindowResizeMixin',
]
@@ -328,3 +329,23 @@ class Test(object):
self.result['out'] = out.decode('utf-8', 'replace')
self.result['err'] = err.decode('utf-8', 'replace')
self.result['returncode'] = returncode
+
+
+class WindowResizeMixin(object):
+ """ Mixin class that deals with spurious window resizes
+
+ On gnome (and possible other DE's) the window manager may decide to resize
+ a window. This causes the test to fail even though otherwise would not.
+ This Mixin overides the _run_command method to run the test 5 times, each
+ time searching for the string 'Got suprious window resize' in the output,
+ if it fails to find it it will break the loop and continue.
+
+ see: https://bugzilla.gnome.org/show_bug.cgi?id=680214
+
+ """
+ def _run_command(self):
+ """Run a test up 5 times when window resize is detected."""
+ for _ in xrange(5):
+ super(WindowResizeMixin, self)._run_command()
+ if "Got spurious window resize" not in self.result['out']:
+ break
diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index 2f11491..a232634 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -28,7 +28,7 @@ try:
except ImportError:
import json
-from .base import Test
+from .base import Test, WindowResizeMixin
__all__ = [
@@ -67,13 +67,11 @@ class PiglitBaseTest(Test):
s for s in outlines if not s.startswith('PIGLIT:'))
-class PiglitGLTest(PiglitBaseTest):
+class PiglitGLTest(WindowResizeMixin, PiglitBaseTest):
""" OpenGL specific Piglit test class
- This Subclass provides two methods that differ from PiglitBaseTest, first
- it provides an is_skip() method that skips glx tests on non-glx platforms,
- and it provides a _run_command() method that repeats tests if they fail due
- to window manager resizing bug
+ This Subclass provides provides an is_skip() implementation that skips glx
+ tests on non-glx platforms
"""
def is_skip(self):
@@ -90,14 +88,6 @@ class PiglitGLTest(PiglitBaseTest):
return True
return False
- def _run_command(self):
- # https://bugzilla.gnome.org/show_bug.cgi?id=680214 is affecting many
- # developers. If we catch it happening, try just re-running the test.
- for _ in xrange(5):
- super(PiglitGLTest, self)._run_command()
- if "Got spurious window resize" not in self.result['out']:
- break
-
class PiglitCLTest(PiglitBaseTest):
""" OpenCL specific Test class """
--
2.1.2
More information about the Piglit
mailing list