[Piglit] [PATCH 08/11] all.tests: Add all .shader_test files in tests and generated_tests.

Paul Berry stereotype441 at gmail.com
Fri Feb 24 14:00:23 PST 2012


On 1 February 2012 16:06, Kenneth Graunke <kenneth at whitecape.org> wrote:

> This avoids the fuss of adding more add_shader_test_dir calls every time
> you add a new folder with shader runner tests in it.  Presumably, if you
> drop a new .shader_test file into tests or generated_tests, you've added
> a new shader runner test and want it to be run.  If not, you can rename
> it to have a different extension.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>

Reviewed-by: Paul Berry <stereotype441 at gmail.com>


> ---
>  tests/all.tests |   78
> ++++++++++--------------------------------------------
>  1 files changed, 15 insertions(+), 63 deletions(-)
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 3211016..b48ef9a 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -320,22 +320,19 @@ add_fbo_depthstencil_tests(general, 'default_fb')
>
>  shaders = Group()
>
> -def add_shader_test_dir(group, dirpath, recursive=False):
> -       """Add all shader tests in a directory to the given group."""
> -       for filename in os.listdir(dirpath):
> -               filepath = path.join(dirpath, filename)
> -               if path.isdir(filepath):
> -                       if not recursive:
> -                               continue
> -                       if not filename in group:
> -                               group[filename] = Group()
> -                       add_shader_test_dir(group[filename], filepath,
> recursive)
> -               else:
> -                       ext = filename.rsplit('.')[-1]
> -                       if ext != 'shader_test':
> -                               continue
> -                       testname = filename[0:-(len(ext) + 1)] # +1 for '.'
> -                       group[testname] = concurrent_test('shader_runner '
> + filepath)
> +def find_files_with_extension(top, ext_list):
> +       """Recursively find files in `top' with a matching file
> extension."""
> +       files = []
> +       for dirpath, dirnames, filenames in os.walk(top):
> +               matching = filter(lambda f: f.rsplit('.')[-1] in ext_list,
> filenames)
> +               files.extend(map(lambda f: path.join(dirpath, f),
> matching))
> +       return files
> +
> +# Add all .shader_test files as tests.
> +for dir in (testsDir, generatedTestDir):
> +       for test in find_files_with_extension(dir, ['shader_test']):
> +               name = path.splitext(path.relpath(test, dir))[0]
> +               profile.test_list[name] = concurrent_test('shader_runner '
> + test)
>
>  def add_getactiveuniform_count(group, name, expected):
>        path = 'shaders/'
> @@ -344,9 +341,6 @@ def add_getactiveuniform_count(group, name, expected):
>                                                                   path +
> name + '.vert',
>
> expected])
>
> -add_shader_test_dir(shaders,
> -                    testsDir + '/shaders',
> -                    recursive=True)
>  add_plain_test(shaders, 'activeprogram-bad-program')
>  add_plain_test(shaders, 'activeprogram-get')
>  add_plain_test(shaders, 'ati-fs-bad-delete')
> @@ -862,17 +856,8 @@ import_glsl_parser_tests(spec['glsl-1.10'],
>  import_glsl_parser_tests(spec['glsl-1.10'],
>                         os.path.join(generatedTestDir, 'spec',
> 'glsl-1.10'),
>                         ['preprocessor', 'compiler'])
> -spec['glsl-1.10']['linker'] = Group()
> -add_shader_test_dir(spec['glsl-1.10']['linker'],
> -                   os.path.join(testsDir, 'spec', 'glsl-1.10', 'linker'),
> -                   recursive=True)
>  spec['glsl-1.10']['execution'] = Group()
> -add_shader_test_dir(spec['glsl-1.10']['execution'],
> -                   os.path.join(testsDir, 'spec', 'glsl-1.10',
> 'execution'),
> -                   recursive=True)
> -add_shader_test_dir(spec['glsl-1.10']['execution'],
> -                   os.path.join(generatedTestDir, 'spec', 'glsl-1.10',
> 'execution'),
> -                   recursive=True)
> +spec['glsl-1.10']['execution']['clipping'] = Group()
>  for mode in ['fixed', 'pos_clipvert', 'clipvert_pos']:
>        cmdline = 'clip-plane-transformation ' + mode
>        spec['glsl-1.10']['execution']['clipping'][cmdline] =
> concurrent_test(cmdline)
> @@ -889,12 +874,6 @@ import_glsl_parser_tests(spec['glsl-1.20'],
>                         os.path.join(generatedTestDir, 'spec',
> 'glsl-1.20'),
>                         ['compiler'])
>  spec['glsl-1.20']['execution'] = Group()
> -add_shader_test_dir(spec['glsl-1.20']['execution'],
> -                   os.path.join(testsDir, 'spec', 'glsl-1.20',
> 'execution'),
> -                   recursive=True)
> -add_shader_test_dir(spec['glsl-1.20']['execution'],
> -                   os.path.join(generatedTestDir, 'spec', 'glsl-1.20',
> 'execution'),
> -                   recursive=True)
>
>  def add_recursion_test(group, name):
>        # When the recursion tests fail it is usually because the GLSL
> @@ -932,6 +911,7 @@ import_glsl_parser_tests(spec['glsl-1.30'],
>                         os.path.join(generatedTestDir, 'spec',
> 'glsl-1.30'),
>                         ['compiler'])
>  spec['glsl-1.30']['execution'] = Group()
> +spec['glsl-1.30']['execution']['clipping'] = Group()
>  spec['glsl-1.30']['execution']['textureSize'] = Group()
>  spec['glsl-1.30']['execution']['texelFetch'] = Group()
>  for stage in ['vs', 'fs']:
> @@ -947,12 +927,6 @@ for stage in ['vs', 'fs']:
>
>  add_plain_test(spec['glsl-1.30']['execution'], 'fs-texelFetch-2D')
>  add_plain_test(spec['glsl-1.30']['execution'], 'fs-texelFetchOffset-2D')
> -add_shader_test_dir(spec['glsl-1.30']['execution'],
> -                   os.path.join(testsDir, 'spec', 'glsl-1.30',
> 'execution'),
> -                   recursive=True)
> -add_shader_test_dir(spec['glsl-1.30']['execution'],
> -                   os.path.join(generatedTestDir, 'spec', 'glsl-1.30',
> 'execution'),
> -                   recursive=True)
>  spec['glsl-1.30']['linker'] = Group()
>  spec['glsl-1.30']['linker']['clipping'] = Group()
>  add_plain_test(spec['glsl-1.30']['linker']['clipping'],
> 'mixing-clip-distance-and-clip-vertex-disallowed')
> @@ -1020,24 +994,14 @@ import_glsl_parser_tests(arb_draw_instanced,
>                         testsDir + '/spec/arb_draw_instanced',
>                         [''])
>
> -add_shader_test_dir(arb_draw_instanced,
> -                    testsDir + '/spec/arb_draw_instanced/execution',
> -                    recursive=True)
> -
>  # Group ARB_fragment_program
>  arb_fragment_program = Group()
>  spec['ARB_fragment_program'] = arb_fragment_program
> -add_shader_test_dir(spec['ARB_fragment_program'],
> -                   os.path.join(testsDir, 'spec', 'arb_fragment_program'),
> -                   recursive=True)
>  arb_fragment_program['minmax'] =
> concurrent_test('arb_fragment_program-minmax')
>
>  # Group ARB_fragment_program_shadow
>  arb_fragment_program_shadow = Group()
>  spec['ARB_fragment_program_shadow'] = arb_fragment_program_shadow
> -add_shader_test_dir(spec['ARB_fragment_program_shadow'],
> -                   os.path.join(testsDir, 'spec',
> 'arb_fragment_program_shadow'),
> -                   recursive=True)
>
>  # Group ARB_framebuffer_object
>  arb_framebuffer_object = Group()
> @@ -1064,9 +1028,6 @@ import_glsl_parser_tests(arb_shader_texture_lod,
>                         os.path.join(testsDir, 'spec',
> 'arb_shader_texture_lod'),
>                         ['compiler'])
>  arb_shader_texture_lod['execution'] = Group()
> -add_shader_test_dir(arb_shader_texture_lod['execution'],
> -                   os.path.join(testsDir, 'spec',
> 'arb_shader_texture_lod', 'execution'),
> -                   recursive=True)
>  add_plain_test(arb_shader_texture_lod['execution'],
> 'arb_shader_texture_lod-texgrad')
>  arb_shader_texture_lod['execution']['tex-miplevel-selection-texture2DLod']
> = PlainExecTest(['tex-miplevel-selection', '-auto', '-nobias', '-nolod',
> '-GL_ARB_shader_texture_lod'])
>  arb_shader_texture_lod['execution']['tex-miplevel-selection-texture2DLod-lod']
> = PlainExecTest(['tex-miplevel-selection', '-auto', '-nobias',
> '-GL_ARB_shader_texture_lod'])
> @@ -1100,9 +1061,6 @@ arb_texture_rectangle = Group()
>  spec['ARB_texture_rectangle'] = arb_texture_rectangle
>  add_texwrap_test1(arb_texture_rectangle, 'RECT')
>  add_texwrap_test2(arb_texture_rectangle, 'RECT', 'proj')
> -add_shader_test_dir(arb_texture_rectangle,
> -                    testsDir + '/spec/arb_texture_rectangle',
> -                    recursive=True)
>
>  arb_texture_storage = Group()
>  spec['ARB_texture_storage'] = arb_texture_storage
> @@ -1257,9 +1215,6 @@ ext_texture_array = Group()
>  spec['EXT_texture_array'] = ext_texture_array
>  add_plain_test(ext_texture_array, 'fbo-generatemipmap-array')
>  spec['EXT_texture_array']['maxlayers'] =
> concurrent_test('ext_texture_array-maxlayers')
> -add_shader_test_dir(ext_texture_array,
> -                    testsDir + '/spec/ext_texture_array',
> -                    recursive=True)
>
>  ext_texture_compression_latc = Group()
>  spec['EXT_texture_compression_latc'] = ext_texture_compression_latc
> @@ -1353,9 +1308,6 @@ ext_texture_integer['texture_integer_glsl130'] =
> concurrent_test('ext_texture_in
>
>  arb_texture_rg = Group()
>  spec['ARB_texture_rg'] = arb_texture_rg
> -add_shader_test_dir(arb_texture_rg,
> -                    testsDir + '/spec/arb_texture_rg/execution',
> -                    recursive=True)
>  add_fbo_generatemipmap_extension(arb_texture_rg, 'GL_ARB_texture_rg',
> 'fbo-generatemipmap-formats')
>  add_fbo_generatemipmap_extension(arb_texture_rg,
> 'GL_ARB_texture_rg-float', 'fbo-generatemipmap-formats-float')
>  add_fbo_clear_extension(arb_texture_rg, 'GL_ARB_texture_rg',
> 'fbo-clear-formats')
> --
> 1.7.7.6
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120224/ee6eb6b0/attachment.htm>


More information about the Piglit mailing list