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

2017-11-09 Thread Dylan Baker
Quoting Brian Paul (2017-11-09 15:16:32)
> 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.
> ---
>  framework/wflinfo.py | 31 +--
>  1 file changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/framework/wflinfo.py b/framework/wflinfo.py
> index b9a05f8..3849838 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.")

maybe send this to stderr:
print("...", 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:
> -- 
> 1.9.1
> 

Either way,
Reviewed-by: Dylan Baker 


signature.asc
Description: signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


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

2017-11-09 Thread Brian Paul
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.
---
 framework/wflinfo.py | 31 +--
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/framework/wflinfo.py b/framework/wflinfo.py
index b9a05f8..3849838 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.")
 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:
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit