[Piglit] [PATCH 2/3] all.py: use os.path.join() and string.split() to fix things for cygwin

Dylan Baker baker.dylan.c at gmail.com
Tue Jun 3 14:41:15 PDT 2014


On Tuesday, June 03, 2014 07:57:56 AM Brian Paul wrote:
> Use os.path.join() to build up file paths instead of using string
> concatenation.  In plain_test(), split up the arguments string
> using string.split() instead of shlex.split() because the later
> removes the '\' characters in Windows paths, which causes things to
> blow up.
> 
> I can't find any particular reason why shlex.split() was used in
> the first place.
> 
> v2: use intrinsic string split() method, per Dylan.
> ---
>  tests/all.py |   14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/all.py b/tests/all.py
> index aae0f54..5802227 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -33,7 +33,7 @@ generatedTestDir = path.normpath(path.join(
> 
>  # Quick wrapper for PiglitTest for our usual concurrent args.
>  def plain_test(args):
> -    return PiglitTest(shlex.split(args) + ['-auto'])
> +    return PiglitTest(args.split() + ['-auto'])
> 
>  def add_single_param_test_set(group, name, *params):
>      for param in params:
> @@ -558,7 +558,8 @@ for subtest in ('interstage', 'intrastage', 'vs-gs'):
>      shaders[cmdline] = concurrent_test(cmdline)
> 
>  def add_vpfpgeneric(group, name):
> -    group[name] = concurrent_test('vpfp-generic ' + testsDir +
> '/shaders/generic/' + name + '.vpfp') +    group[name] =
> concurrent_test('vpfp-generic ' +
> +        os.path.join(testsDir, 'shaders', 'generic', name + '.vpfp'))
> 
>  glx = {}
>  add_msaa_visual_plain_tests(glx, 'glx-copy-sub-buffer')
> @@ -1471,11 +1472,11 @@ add_plain_test(arb_draw_elements_base_vertex,
> 'arb_draw_elements_base_vertex-mul arb_draw_instanced = {}
>  spec['ARB_draw_instanced'] = arb_draw_instanced
>  import_glsl_parser_tests(arb_draw_instanced,
> -                        testsDir + '/spec/arb_draw_instanced',
> +                        os.path.join(testsDir, 'spec',
> 'arb_draw_instanced'), [''])
> 
>  add_shader_test_dir(arb_draw_instanced,
> -                    testsDir + '/spec/arb_draw_instanced/execution',
> +                    os.path.join(testsDir, 'spec', 'arb_draw_instanced',
> 'execution'), recursive=True)
>  arb_draw_instanced['dlist'] = concurrent_test('arb_draw_instanced-dlist')
>  arb_draw_instanced['elements'] =
> concurrent_test('arb_draw_instanced-elements') @@ -1622,7 +1623,7 @@
> add_plain_test(arb_framebuffer_srgb, 'framebuffer-srgb') # must not be
> concurren arb_gpu_shader5 = {}
>  spec['ARB_gpu_shader5'] = arb_gpu_shader5
>  add_shader_test_dir(arb_gpu_shader5,
> -                    testsDir + '/spec/arb_gpu_shader5',
> +                    os.path.join(testsDir, 'spec', 'arb_gpu_shader5'),
>                      recursive=True)
>  import_glsl_parser_tests(arb_gpu_shader5,
>                           testsDir + '/spec/arb_gpu_shader5', [''])
> @@ -3238,7 +3239,8 @@ add_plain_test(fast_color_clear,
> 'fcc-read-to-pbo-after-clear') asmparsertest = {}
>  def add_asmparsertest(group, shader):
>      asmparsertest[group + '/' + shader] = concurrent_test(
> -        'asmparsertest ' + group + ' ' + testsDir +
> '/asmparsertest/shaders/' + group + '/' + shader) +        'asmparsertest '
> + group + ' ' +
> +        os.path.join(testsDir, 'asmparsertest', 'shaders', group, shader))
> 
>  add_asmparsertest('ARBfp1.0', 'abs-01.txt')
>  add_asmparsertest('ARBfp1.0', 'abs-02.txt')

This is a nice improvement,
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: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140603/4000091b/attachment.sig>


More information about the Piglit mailing list