summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2017-11-01 15:06:58 -0600
committerBrian Paul <brianp@vmware.com>2017-11-09 21:10:27 -0700
commita1f430ce81cf3ea3ade1c7c6279bf16c053289cc (patch)
tree8e471ee757556ed741c0aff6a7a7bad58c386126
parentedc41a1db7e21489eda463745a117feec10df5da (diff)
framework: fix wflinfo issues in opengl module
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. v2: Pass env argument to subprocess.check_output() instead of using the find_wflinfo() function, per Dylan. Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
-rw-r--r--framework/wflinfo.py31
1 files changed, 25 insertions, 6 deletions
diff --git a/framework/wflinfo.py b/framework/wflinfo.py
index b9a05f8ee..a34600310 100644
--- a/framework/wflinfo.py
+++ b/framework/wflinfo.py
@@ -24,11 +24,13 @@ from __future__ import (
import errno
import os
import subprocess
+import sys
import six
from framework import exceptions, core
from framework.options import OPTIONS
+from framework.test import piglit_test
class StopWflinfo(exceptions.PiglitException):
@@ -77,16 +79,34 @@ class WflInfo(object):
"""
with open(os.devnull, 'w') as d:
try:
- raw = subprocess.check_output(
- ['wflinfo',
- '--platform', OPTIONS.env['PIGLIT_PLATFORM']] + opts,
- stderr=d)
+ # 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"
+
+ if sys.platform in ['windows', 'cygwin']:
+ bin = 'wflinfo.exe'
+ else:
+ bin = 'wflinfo'
+
+ cmd = [bin, '--platform', platform] + opts
+
+ # setup execution environment where we extend the PATH env var
+ # to include the piglit TEST_BIN_DIR
+ new_env = os.environ
+ new_env['PATH'] = ':'.join([piglit_test.TEST_BIN_DIR,
+ os.environ['PATH']])
+
+ raw = subprocess.check_output(cmd, env=new_env, 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.", file=sys.stderr)
if e.errno == errno.ENOENT:
raise StopWflinfo('OSError')
raise
@@ -122,8 +142,7 @@ class WflInfo(object):
try:
ret = self.__call_wflinfo(const + [var])
except StopWflinfo as e:
- # This means tat the particular api or profile is
- # unsupported
+ # This means the particular api or profile is unsupported
if e.reason == 'Called':
continue
else: