On 8 September 2011 23:07, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</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">---<br>
tests/all.tests | 14 +++++++-------<br>
1 files changed, 7 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 03dcd59..fc66ff6 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -25,6 +25,12 @@ generatedTestDir = os.path.join(<br>
os.path.join(os.path.dirname(__file__), '..')),<br>
'generated_tests')<br>
<br>
+# Quick wrapper for PlainExecTest for our usual concurrent args.<br>
+def concurrent_test(args):<br>
+ test = PlainExecTest(args + " -auto -fbo")<br>
+ test.runConcurrent = True<br>
+ return test<br>
+<br>
######<br>
# Collecting all tests<br>
profile = TestProfile()<br>
@@ -293,12 +299,6 @@ add_fbo_depthstencil_tests(general, 'default_fb')<br>
<br>
shaders = Group()<br>
<br>
-def add_shader_test(group, filepath, test_name):<br>
- """Add a shader test to the given group."""<br>
- group[test_name] = PlainExecTest(['shader_runner', '-auto', '-fbo',<br>
- filepath])<br>
- group[test_name].runConcurrent = True<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>
@@ -314,7 +314,7 @@ def add_shader_test_dir(group, dirpath, recursive=False):<br>
if ext != 'shader_test':<br>
continue<br>
testname = filename[0:-(len(ext) + 1)] # +1 for '.'<br>
- add_shader_test(group, filepath, testname)<br>
+ group[testname] = concurrent_test('shader_runner ' + filepath)<br>
<br>
def add_getactiveuniform_count(group, name, expected):<br>
path = 'shaders/'<br>
<font color="#888888">--<br>
1.7.5.4<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org" target="_blank">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></blockquote></div><br>This patch introduces a limitation to add_shader_test_dir(): it no longer works properly when a test name or directory contains spaces. Although spaces in file/directory names are generally frowned upon in the UNIX world (and Piglit currently doesn't contain any such files or directories), I don't think that's any excuse to make the code fragile.<br>
<br>In addition, the new function concurrent_test() has the limitation that it can *only* be called with a string, not a list of strings. Since the intended purpose of concurrent_test() is to take the place of ExecTest() for tests that should be executed concurrently, it would avoid confusion if it accepted inputs in the same form that ExecTest() accepts.<br>
<br>In my experience, the best way to avoid issues like these is to convert from a space-separated string to a list as early as possible (at the top of concurrent_test()), and then manipulate everything as lists of strings thereafter.<br>