[Piglit] [PATCH 1/3] all.py: check if running in cygwin, use Windows-style path for testsDir
Dylan Baker
baker.dylan.c at gmail.com
Tue Jun 3 14:29:15 PDT 2014
On Tuesday, June 03, 2014 07:57:55 AM 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.
>
> v2: use subprocess module instead of commands module, per Dylan
> ---
> tests/all.py | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index a42e79e..aae0f54 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -7,7 +7,8 @@ import itertools
> import os
> import os.path as path
> import platform
> -import shlex
> +import subprocess
> +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 so it's parsable by shader_runner, etc.
> + testsDir = subprocess.check_output(['cygpath', '-d', testsDir]) +
> testsDir = testsDir.replace('\n', '') # remove trailing newline
you could simplify this by calling subprocess.check_output().rstrip() instead
of replace().
without arguments rstrip() removes trailing whitespace
With that change:
Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>
>
> # 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/20140603/dd2639ac/attachment.sig>
More information about the Piglit
mailing list