On Wed, Oct 18, 2017 at 6:28 PM, Dylan Baker <dy...@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 > > 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@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/piglit > > _______________________________________________ > Piglit mailing list > Piglit@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/piglit > >
_______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit