[Piglit] [PATCH 2/3] all.py: check if running in cygwin, use Windows-style path for testsDir

Dylan Baker baker.dylan.c at gmail.com
Mon Jun 2 03:35:08 PDT 2014


On Sunday, June 01, 2014 03:03:21 PM Brian Paul wrote:
> Otherwise, the file path we're passing to programs such as shader_runner
> is in Unix style, which Windows programs don't understand.
> ---
>  tests/all.py |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tests/all.py b/tests/all.py
> index a42e79e..bf174b7 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -8,6 +8,7 @@ import os
>  import os.path as path
>  import platform
>  import shlex
> +import sys
> 
>  from framework.profile import TestProfile
>  from framework.exectest import PiglitTest
> @@ -17,6 +18,10 @@ from framework.shader_test import add_shader_test_dir
> 
>  # Path to tests dir, correct even when not running from the top directory.
>  testsDir = path.dirname(__file__)
> +if sys.platform == "cygwin":
> +    # convert the path to DOS style os it's parsable by shader_runner, etc.
> +    import commands
> +    testsDir = commands.getoutput('cygpath -d %s' % testsDir)

The commands module is deprecated in python 2.6 and removed in python3, please 
use subprocess instead. https://docs.python.org/2/library/commands.html

I haven't testd, but this should be equivalent.
subprocess.check_output(['cygpath', '-d', testsDir])

Just my opinion, but I would rather just have subrprocess at the top of the 
file than in the if block, but I'm not going to make a fuss either way

> 
>  # Find the generated_tests directory, by looking either in
>  # $PIGLIT_BUILD_DIR (if that environment variable exists) or in the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140602/a4130d39/attachment.sig>


More information about the Piglit mailing list