[Piglit] [PATCH 1/6] framework: fix wflinfo issues in opengl module

Brian Paul brianp at vmware.com
Fri Oct 13 04:23:05 UTC 2017


1. If the PIGLIT_PLATFORM string is 'mixed_glx_egl' we need to convert
it to 'glx' so that wflinfo understands it.

2. Look in the piglit bin/ directory for the wflinfo.exe program.
When we build piglit, we copy wflinfo.exe into the bin/ directory for
packaging to avoid having to install waffle on target machines.  If
it's not found there, assume it's in our PATH just like before.
---
 framework/test/opengl.py | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/framework/test/opengl.py b/framework/test/opengl.py
index 091aeb0..20e1c4f 100644
--- a/framework/test/opengl.py
+++ b/framework/test/opengl.py
@@ -33,6 +33,7 @@ import six
 from framework import exceptions, core
 from framework.options import OPTIONS
 from .base import TestIsSkip
+from framework.test import piglit_test
 
 # pylint: disable=too-few-public-methods
 
@@ -53,6 +54,17 @@ class StopWflinfo(exceptions.PiglitException):
         self.reason = reason
 
 
+def find_wflinfo():
+    """Find location of the wflinfo executable."""
+    # First check if it's in our piglit bin/ directory
+    wflinfo = os.path.join(piglit_test.TEST_BIN_DIR, "wflinfo.exe")
+    if os.path.exists(wflinfo):
+        return wflinfo
+    else:
+        # Assume it's in $PATH
+        return "wflinfo"
+
+
 class WflInfo(object):
     """Class representing platform information as provided by wflinfo.
 
@@ -92,16 +104,23 @@ class WflInfo(object):
         """
         with open(os.devnull, 'w') as d:
             try:
+                # Get the piglit platform string and, if needed, convert it
+                # to something that wflinfo understands.
+                platform = OPTIONS.env['PIGLIT_PLATFORM']
+                if platform == "mixed_glx_egl":
+                    platform = "glx"
+
+                wflinfo = find_wflinfo()
+
                 raw = subprocess.check_output(
-                    ['wflinfo',
-                     '--platform', OPTIONS.env['PIGLIT_PLATFORM']] + opts,
-                    stderr=d)
+                    [wflinfo, '--platform', platform] + opts, stderr=d)
             except subprocess.CalledProcessError:
                 # When we hit this error it usually going to be because we have
                 # an incompatible platform/profile combination
                 raise StopWflinfo('Called')
             except OSError as e:
                 # If we get a 'no wflinfo' warning then just return
+                print("wflinfo utility not found.")
                 if e.errno == errno.ENOENT:
                     raise StopWflinfo('OSError')
                 raise
-- 
1.9.1



More information about the Piglit mailing list