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

Dylan Baker baker.dylan.c at gmail.com
Wed Jul 16 09:40:20 PDT 2014


On Wednesday, July 16, 2014 10:31:45 AM Brian Paul wrote:
> The GLSLParserTest, ShaderTest and GleanTest subclasses of the Test
> class were prepending the TEST_BIN_DIR variable onto the executable
> name (such as "glslparsertest", "shader_runner", and "glean").  But
> the Test class itself also does that so we were prepending TEST_BIN_DIR
> twice.

That's not quite right, PiglitTest (not Test) prepends TEST_BIN_DIR to the 
first element of the command. It's an important distinction because GleanTest 
doesn't descend from PiglitTest, only GLSLParserTest and ShaderTest do.

So, the change to GleanTest is incorrect (try running it, they'll all return 
skip). But the changes to GLSLParserTest and ShaderTest look fine. It might be 
worth adding an assert to the PiglitTest constructor for this; something like
'assert not self._command[0].startswith(TEST_BIN_DIR)'

> 
> 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 base
> Test class.
> 
> This issue was only encountered when the PIGLIT_BUILD_DIR env var was set,
> which I just recently tried for the first time.
> ---
>  framework/gleantest.py        |    4 ++--
>  framework/glsl_parser_test.py |    4 ++--
>  framework/shader_test.py      |    8 ++++----
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/framework/gleantest.py b/framework/gleantest.py
> index 5229cf5..359a7cf 100644
> --- a/framework/gleantest.py
> +++ b/framework/gleantest.py
> @@ -23,9 +23,9 @@
> 
>  import os
> 
> -from .exectest import Test, TEST_BIN_DIR
> +from .exectest import Test
> 
> -glean_executable = os.path.join(TEST_BIN_DIR, "glean")
> +glean_executable = "glean"
> 
>  # GleanTest: Execute a sub-test of Glean
>  class GleanTest(Test):
> 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")
-------------- 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/874dd524/attachment-0001.sig>


More information about the Piglit mailing list