On 1 February 2012 16:06, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This avoids the fuss of adding more add_shader_test_dir calls every time<br>
you add a new folder with shader runner tests in it. Presumably, if you<br>
drop a new .shader_test file into tests or generated_tests, you've added<br>
a new shader runner test and want it to be run. If not, you can rename<br>
it to have a different extension.<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br></blockquote><div><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
tests/all.tests | 78 ++++++++++--------------------------------------------<br>
1 files changed, 15 insertions(+), 63 deletions(-)<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 3211016..b48ef9a 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -320,22 +320,19 @@ add_fbo_depthstencil_tests(general, 'default_fb')<br>
<br>
shaders = Group()<br>
<br>
-def add_shader_test_dir(group, dirpath, recursive=False):<br>
- """Add all shader tests in a directory to the given group."""<br>
- for filename in os.listdir(dirpath):<br>
- filepath = path.join(dirpath, filename)<br>
- if path.isdir(filepath):<br>
- if not recursive:<br>
- continue<br>
- if not filename in group:<br>
- group[filename] = Group()<br>
- add_shader_test_dir(group[filename], filepath, recursive)<br>
- else:<br>
- ext = filename.rsplit('.')[-1]<br>
- if ext != 'shader_test':<br>
- continue<br>
- testname = filename[0:-(len(ext) + 1)] # +1 for '.'<br>
- group[testname] = concurrent_test('shader_runner ' + filepath)<br>
+def find_files_with_extension(top, ext_list):<br>
+ """Recursively find files in `top' with a matching file extension."""<br>
+ files = []<br>
+ for dirpath, dirnames, filenames in os.walk(top):<br>
+ matching = filter(lambda f: f.rsplit('.')[-1] in ext_list, filenames)<br>
+ files.extend(map(lambda f: path.join(dirpath, f), matching))<br>
+ return files<br>
+<br>
+# Add all .shader_test files as tests.<br>
+for dir in (testsDir, generatedTestDir):<br>
+ for test in find_files_with_extension(dir, ['shader_test']):<br>
+ name = path.splitext(path.relpath(test, dir))[0]<br>
+ profile.test_list[name] = concurrent_test('shader_runner ' + test)<br>
<br>
def add_getactiveuniform_count(group, name, expected):<br>
path = 'shaders/'<br>
@@ -344,9 +341,6 @@ def add_getactiveuniform_count(group, name, expected):<br>
path + name + '.vert',<br>
expected])<br>
<br>
-add_shader_test_dir(shaders,<br>
- testsDir + '/shaders',<br>
- recursive=True)<br>
add_plain_test(shaders, 'activeprogram-bad-program')<br>
add_plain_test(shaders, 'activeprogram-get')<br>
add_plain_test(shaders, 'ati-fs-bad-delete')<br>
@@ -862,17 +856,8 @@ import_glsl_parser_tests(spec['glsl-1.10'],<br>
import_glsl_parser_tests(spec['glsl-1.10'],<br>
os.path.join(generatedTestDir, 'spec', 'glsl-1.10'),<br>
['preprocessor', 'compiler'])<br>
-spec['glsl-1.10']['linker'] = Group()<br>
-add_shader_test_dir(spec['glsl-1.10']['linker'],<br>
- os.path.join(testsDir, 'spec', 'glsl-1.10', 'linker'),<br>
- recursive=True)<br>
spec['glsl-1.10']['execution'] = Group()<br>
-add_shader_test_dir(spec['glsl-1.10']['execution'],<br>
- os.path.join(testsDir, 'spec', 'glsl-1.10', 'execution'),<br>
- recursive=True)<br>
-add_shader_test_dir(spec['glsl-1.10']['execution'],<br>
- os.path.join(generatedTestDir, 'spec', 'glsl-1.10', 'execution'),<br>
- recursive=True)<br>
+spec['glsl-1.10']['execution']['clipping'] = Group()<br>
for mode in ['fixed', 'pos_clipvert', 'clipvert_pos']:<br>
cmdline = 'clip-plane-transformation ' + mode<br>
spec['glsl-1.10']['execution']['clipping'][cmdline] = concurrent_test(cmdline)<br>
@@ -889,12 +874,6 @@ import_glsl_parser_tests(spec['glsl-1.20'],<br>
os.path.join(generatedTestDir, 'spec', 'glsl-1.20'),<br>
['compiler'])<br>
spec['glsl-1.20']['execution'] = Group()<br>
-add_shader_test_dir(spec['glsl-1.20']['execution'],<br>
- os.path.join(testsDir, 'spec', 'glsl-1.20', 'execution'),<br>
- recursive=True)<br>
-add_shader_test_dir(spec['glsl-1.20']['execution'],<br>
- os.path.join(generatedTestDir, 'spec', 'glsl-1.20', 'execution'),<br>
- recursive=True)<br>
<br>
def add_recursion_test(group, name):<br>
# When the recursion tests fail it is usually because the GLSL<br>
@@ -932,6 +911,7 @@ import_glsl_parser_tests(spec['glsl-1.30'],<br>
os.path.join(generatedTestDir, 'spec', 'glsl-1.30'),<br>
['compiler'])<br>
spec['glsl-1.30']['execution'] = Group()<br>
+spec['glsl-1.30']['execution']['clipping'] = Group()<br>
spec['glsl-1.30']['execution']['textureSize'] = Group()<br>
spec['glsl-1.30']['execution']['texelFetch'] = Group()<br>
for stage in ['vs', 'fs']:<br>
@@ -947,12 +927,6 @@ for stage in ['vs', 'fs']:<br>
<br>
add_plain_test(spec['glsl-1.30']['execution'], 'fs-texelFetch-2D')<br>
add_plain_test(spec['glsl-1.30']['execution'], 'fs-texelFetchOffset-2D')<br>
-add_shader_test_dir(spec['glsl-1.30']['execution'],<br>
- os.path.join(testsDir, 'spec', 'glsl-1.30', 'execution'),<br>
- recursive=True)<br>
-add_shader_test_dir(spec['glsl-1.30']['execution'],<br>
- os.path.join(generatedTestDir, 'spec', 'glsl-1.30', 'execution'),<br>
- recursive=True)<br>
spec['glsl-1.30']['linker'] = Group()<br>
spec['glsl-1.30']['linker']['clipping'] = Group()<br>
add_plain_test(spec['glsl-1.30']['linker']['clipping'], 'mixing-clip-distance-and-clip-vertex-disallowed')<br>
@@ -1020,24 +994,14 @@ import_glsl_parser_tests(arb_draw_instanced,<br>
testsDir + '/spec/arb_draw_instanced',<br>
[''])<br>
<br>
-add_shader_test_dir(arb_draw_instanced,<br>
- testsDir + '/spec/arb_draw_instanced/execution',<br>
- recursive=True)<br>
-<br>
# Group ARB_fragment_program<br>
arb_fragment_program = Group()<br>
spec['ARB_fragment_program'] = arb_fragment_program<br>
-add_shader_test_dir(spec['ARB_fragment_program'],<br>
- os.path.join(testsDir, 'spec', 'arb_fragment_program'),<br>
- recursive=True)<br>
arb_fragment_program['minmax'] = concurrent_test('arb_fragment_program-minmax')<br>
<br>
# Group ARB_fragment_program_shadow<br>
arb_fragment_program_shadow = Group()<br>
spec['ARB_fragment_program_shadow'] = arb_fragment_program_shadow<br>
-add_shader_test_dir(spec['ARB_fragment_program_shadow'],<br>
- os.path.join(testsDir, 'spec', 'arb_fragment_program_shadow'),<br>
- recursive=True)<br>
<br>
# Group ARB_framebuffer_object<br>
arb_framebuffer_object = Group()<br>
@@ -1064,9 +1028,6 @@ import_glsl_parser_tests(arb_shader_texture_lod,<br>
os.path.join(testsDir, 'spec', 'arb_shader_texture_lod'),<br>
['compiler'])<br>
arb_shader_texture_lod['execution'] = Group()<br>
-add_shader_test_dir(arb_shader_texture_lod['execution'],<br>
- os.path.join(testsDir, 'spec', 'arb_shader_texture_lod', 'execution'),<br>
- recursive=True)<br>
add_plain_test(arb_shader_texture_lod['execution'], 'arb_shader_texture_lod-texgrad')<br>
arb_shader_texture_lod['execution']['tex-miplevel-selection-texture2DLod'] = PlainExecTest(['tex-miplevel-selection', '-auto', '-nobias', '-nolod', '-GL_ARB_shader_texture_lod'])<br>
arb_shader_texture_lod['execution']['tex-miplevel-selection-texture2DLod-lod'] = PlainExecTest(['tex-miplevel-selection', '-auto', '-nobias', '-GL_ARB_shader_texture_lod'])<br>
@@ -1100,9 +1061,6 @@ arb_texture_rectangle = Group()<br>
spec['ARB_texture_rectangle'] = arb_texture_rectangle<br>
add_texwrap_test1(arb_texture_rectangle, 'RECT')<br>
add_texwrap_test2(arb_texture_rectangle, 'RECT', 'proj')<br>
-add_shader_test_dir(arb_texture_rectangle,<br>
- testsDir + '/spec/arb_texture_rectangle',<br>
- recursive=True)<br>
<br>
arb_texture_storage = Group()<br>
spec['ARB_texture_storage'] = arb_texture_storage<br>
@@ -1257,9 +1215,6 @@ ext_texture_array = Group()<br>
spec['EXT_texture_array'] = ext_texture_array<br>
add_plain_test(ext_texture_array, 'fbo-generatemipmap-array')<br>
spec['EXT_texture_array']['maxlayers'] = concurrent_test('ext_texture_array-maxlayers')<br>
-add_shader_test_dir(ext_texture_array,<br>
- testsDir + '/spec/ext_texture_array',<br>
- recursive=True)<br>
<br>
ext_texture_compression_latc = Group()<br>
spec['EXT_texture_compression_latc'] = ext_texture_compression_latc<br>
@@ -1353,9 +1308,6 @@ ext_texture_integer['texture_integer_glsl130'] = concurrent_test('ext_texture_in<br>
<br>
arb_texture_rg = Group()<br>
spec['ARB_texture_rg'] = arb_texture_rg<br>
-add_shader_test_dir(arb_texture_rg,<br>
- testsDir + '/spec/arb_texture_rg/execution',<br>
- recursive=True)<br>
add_fbo_generatemipmap_extension(arb_texture_rg, 'GL_ARB_texture_rg', 'fbo-generatemipmap-formats')<br>
add_fbo_generatemipmap_extension(arb_texture_rg, 'GL_ARB_texture_rg-float', 'fbo-generatemipmap-formats-float')<br>
add_fbo_clear_extension(arb_texture_rg, 'GL_ARB_texture_rg', 'fbo-clear-formats')<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.7.6<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br>