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

Dylan Baker dylan at pnwbakers.com
Tue Oct 24 16:57:51 UTC 2017


Quoting Brian Paul (2017-10-23 10:10:21)
> On Wed, Oct 18, 2017 at 6:28 PM, Dylan Baker <dylan at pnwbakers.com> wrote:
> 
>     Quoting Brian Paul (2017-10-12 21:23:05)
>     > 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()
>     > +
> 
>     instead of find_wflinfo, what about adding
>     "env={'PATH': '{}:{}'.format(piglit_test.TEST_BIN_DIR, os.environ['PATH'])"
>     to
>     the check_output call, and adding an if to change wflinfo to wflinfo.exe on
>     windows?
> 
> 
> 
> AFAICT, the check_output() doesn't take an env argument.  Maybe I'm
> misunderstanding.  Can you propose concrete code?
> 
> -Brian

check_output is just a wrapper around Popen, it takes all of the Popen constructor
args (except stdout):
    The arguments shown above are merely the most common ones, described below
    in Frequently Used Arguments (hence the slightly odd notation in the
    abbreviated signature). The full function signature is largely the same as
    that of the Popen constructor, except that stdout is not permitted as it is
    used internally. All other supplied arguments are passed directly through to
    the Popen constructor.

I think the correct code would be:

    if sys.platfrom in ['windows', cygwin']:
        bin = 'wflinfo.exe'
    else:
        bin = 'wflinfo'

    raw = subprocess.check_output(
        [bin, '--platform', platform] + opts,
        env={'PATH': ':'.join([piglit_test.TEST_BIN_DIR, os.environ['PATH'])},
        stderr=d)

Dylan

> 
>  
> 
>     >                  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
>     >
>     > _______________________________________________
>     > Piglit mailing list
>     > Piglit at lists.freedesktop.org
>     > https://lists.freedesktop.org/mailman/listinfo/piglit
> 
>     _______________________________________________
>     Piglit mailing list
>     Piglit at lists.freedesktop.org
>     https://lists.freedesktop.org/mailman/listinfo/piglit
> 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20171024/e8c01117/attachment.sig>


More information about the Piglit mailing list