[Piglit] [PATCH] framework: fix duplicated TEST_BIN_DIR for cygwin

Dylan Baker baker.dylan.c at gmail.com
Wed Jul 16 10:13:34 PDT 2014


On Wednesday, July 16, 2014 10:58:08 AM Brian Paul wrote:
> The GLSLParserTest and ShaderTest subclasses of the PiglitTest class
> were prepending the TEST_BIN_DIR variable onto the executable name
> (such as "glslparsertest" and "shader_runner").  But the PiglitTest
> class itself also does that so we were prepending TEST_BIN_DIR twice.
> 
> With unix paths, os.path.join("/abs/path1", "/abs/path2") returns
> "/abs/path2".
> 
> But with cygwin, os.path.join("C:\\abspath1", "C:\\abspath2") returns
> "C:\\abspath1/C:\\abspath2" which clearly causes trouble.
> 
> The solution is to only prepend the TEST_BIN_DIR path in the PiglitTest
> class.
> 
> This issue was only encountered when the PIGLIT_BUILD_DIR env var was set,
> which I just recently tried for the first time.
> 
> v2: don't change GleanTest, it's a subclass of Test, not PiglitTest.
> ---
>  framework/glsl_parser_test.py |    4 ++--
>  framework/shader_test.py      |    8 ++++----
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
> index 27fd2ca..202ea5b 100644
> --- a/framework/glsl_parser_test.py
> +++ b/framework/glsl_parser_test.py
> @@ -27,7 +27,7 @@ import os.path as path
>  import re
>  from cStringIO import StringIO
> 
> -from .exectest import PiglitTest, TEST_BIN_DIR
> +from .exectest import PiglitTest
> 
> 
>  def add_glsl_parser_test(group, filepath, test_name):
> @@ -146,7 +146,7 @@ class GLSLParserTest(PiglitTest):
>                                                "from config".format(opt))
> 
>              # Create the command and pass it into a PiglitTest()
> -            command = [path.join(TEST_BIN_DIR, 'glslparsertest'),
> +            command = ['glslparsertest',
>                         filepath,
>                         config.get('config', 'expect_result'),
>                         config.get('config', 'glsl_version')]
> diff --git a/framework/shader_test.py b/framework/shader_test.py
> index 0083072..6cfd86a 100644
> --- a/framework/shader_test.py
> +++ b/framework/shader_test.py
> @@ -27,7 +27,7 @@ import os
>  import os.path as path
>  import re
> 
> -from .exectest import PiglitTest, TEST_BIN_DIR
> +from .exectest import PiglitTest
> 
>  __all__ = ['add_shader_test', 'add_shader_test_dir']
> 
> @@ -65,9 +65,9 @@ class ShaderTest(PiglitTest):
>                  line = line.strip()
>                  if line.startswith('GL ES'):
>                      if line.endswith('3.0'):
> -                        prog = path.join(TEST_BIN_DIR,
> 'shader_runner_gles3') +                        prog =
> 'shader_runner_gles3'
>                      elif line.endswith('2.0'):
> -                        prog = path.join(TEST_BIN_DIR,
> 'shader_runner_gles2') +                        prog =
> 'shader_runner_gles2'
>                      # If we don't set gles2 or gles3 continue the loop,
>                      # probably htting the exception in the for/else
>                      else:
> @@ -77,7 +77,7 @@ class ShaderTest(PiglitTest):
>                      # In the event that we reach the end of the config
> black # and an API hasn't been found, it's an old test and uses # "GL"
> -                    prog = path.join(TEST_BIN_DIR, 'shader_runner')
> +                    prog = 'shader_runner'
>                      break
>              else:
>                  raise ShaderTestParserException("No GL version set")

That looks good to me
Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140716/b2c7c996/attachment.sig>


More information about the Piglit mailing list