[Piglit] [PATCH 1/2] unittests/opengl_tests.py: Add some additional tests

Dylan Baker baker.dylan.c at gmail.com
Wed Apr 13 18:00:20 UTC 2016


These tests verify that the fast-skip code works when random junk is
inserted into the output of wflinfo.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 unittests/opengl_tests.py | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/unittests/opengl_tests.py b/unittests/opengl_tests.py
index 5fb75fa..cdbcc16 100644
--- a/unittests/opengl_tests.py
+++ b/unittests/opengl_tests.py
@@ -174,6 +174,38 @@ class TestWflInfo(object):
                         mock.Mock(return_value=rv)):
             nt.eq_(9.3, self._test.glsl_version)
 
+    def test_leading_junk(self):
+        """test.opengl.WflInfo.gl_version: Handles leading junk"""
+        rv = textwrap.dedent("""\
+            Warning: I'm a big fat warnngs
+            Waffle platform: gbm
+            Waffle api: gl
+            OpenGL vendor string: Intel Open Source Technology Center
+            OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
+            OpenGL version string: 18.0.1 (Core Profile) Mesa 11.0.4
+            OpenGL context flags: 0x0
+        """).encode('utf-8')
+        with mock.patch('framework.test.opengl.subprocess.check_output',
+                        mock.Mock(return_value=rv)):
+            nt.eq_(18.0, self._test.gl_version)
+
+    def test_mixed_junk(self):
+        """test.opengl.WflInfo.gl_version: Handles mixed junk"""
+        rv = textwrap.dedent("""\
+            Waffle platform: gbm
+            Waffle api: gl
+            Warning: I'm a big fat warnngs
+            OpenGL vendor string: Intel Open Source Technology Center
+            OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
+            Warning: I'm a big fat warnngs
+            Warning: I'm a big fat warnngs
+            OpenGL version string: 18.0.1 (Core Profile) Mesa 11.0.4
+            OpenGL context flags: 0x0
+        """).encode('utf-8')
+        with mock.patch('framework.test.opengl.subprocess.check_output',
+                        mock.Mock(return_value=rv)):
+            nt.eq_(18.0, self._test.gl_version)
+
 
 class TestWflInfo_WAFFLEINFO_GL_ERROR(object):
     """Test class for WflInfo when "WFLINFO_GL_ERROR" is returned."""
-- 
2.8.0



More information about the Piglit mailing list