[Piglit] [PATCH v2] arb_texture_barrier: use itertools.product instead of nested loops

Dylan Baker dylan at pnwbakers.com
Fri Jul 22 19:53:32 UTC 2016


Quoting Alejandro PiƱeiro (2016-07-22 06:35:50)
> v2: move the array definitions out of line (Ilia)
> ---
> 
> Although Ilia suggested RESOLUTIONS, I used lowercase names, as when I searched
> on all.py, most of the array definitions are lowercase.
> 
> I also used the _set suffix, instead of pluralize the name of the parameter, because
> that was hard with the parameters that are already on plural (like draw_passes).
> 
>  tests/all.py | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/all.py b/tests/all.py
> index 2c78b0a..3846d07 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4719,16 +4719,19 @@ with profile.group_manager(
>                '{} with {}'.format(object_type, operation))
>  
>  # Group ARB_texture_barrier
> +resolution_set = ['32', '512']
> +blend_passes_set = ['1', '42']
> +num_textures_set = ['1', '8']
> +granularity_set = ['8', '64', '128']
> +draw_passes_set = ['1', '2', '3', '4', '7', '8']
> +
>  with profile.group_manager(
>          PiglitGLTest,
>          grouptools.join('spec', 'arb_texture_barrier')) as g:
> -    for resolution in ['32', '512']:
> -        for blend_passes in ['1', '42']:
> -            for num_textures in ['1', '8']:
> -                for granularity in ['8', '64', '128']:
> -                    for draw_passes in ['1', '2', '3', '4', '7', '8']:
> -                        g(['arb_texture_barrier-blending-in-shader', resolution,
> -                           blend_passes, num_textures, granularity, draw_passes])
> +    for resolution, blend_passes, num_textures, granularity, draw_passes in itertools.product(
> +            resolution_set, blend_passes_set, num_textures_set, granularity_set, draw_passes_set):
> +        g(['arb_texture_barrier-blending-in-shader', resolution,
> +           blend_passes, num_textures, granularity, draw_passes])
>  
>  
>  # Group ARB_invalidate_subdata
> -- 
> 2.7.4
> 

This looks good to me, I like Ilia's suggestion to use constant names
better too, but it sounded like he liked it better as is. I don't have a
strong preference either way, though I think this is more readable.

whether you choose to commit this or not,
Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20160722/9d463c68/attachment-0001.sig>


More information about the Piglit mailing list