On 8 September 2011 23:07, Eric Anholt <span dir="ltr">&lt;<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>&gt;</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__), &#39;..&#39;)),<br>
        &#39;generated_tests&#39;)<br>
<br>
+# Quick wrapper for PlainExecTest for our usual concurrent args.<br>
+def concurrent_test(args):<br>
+       test = PlainExecTest(args + &quot; -auto -fbo&quot;)<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, &#39;default_fb&#39;)<br>
<br>
 shaders = Group()<br>
<br>
-def add_shader_test(group, filepath, test_name):<br>
-       &quot;&quot;&quot;Add a shader test to the given group.&quot;&quot;&quot;<br>
-       group[test_name] = PlainExecTest([&#39;shader_runner&#39;, &#39;-auto&#39;, &#39;-fbo&#39;,<br>
-                                         filepath])<br>
-       group[test_name].runConcurrent = True<br>
-<br>
 def add_shader_test_dir(group, dirpath, recursive=False):<br>
        &quot;&quot;&quot;Add all shader tests in a directory to the given group.&quot;&quot;&quot;<br>
        for filename in os.listdir(dirpath):<br>
@@ -314,7 +314,7 @@ def add_shader_test_dir(group, dirpath, recursive=False):<br>
                        if ext != &#39;shader_test&#39;:<br>
                                continue<br>
                        testname = filename[0:-(len(ext) + 1)] # +1 for &#39;.&#39;<br>
-                       add_shader_test(group, filepath, testname)<br>
+                       group[testname] = concurrent_test(&#39;shader_runner &#39; + filepath)<br>
<br>
 def add_getactiveuniform_count(group, name, expected):<br>
        path = &#39;shaders/&#39;<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&#39;t contain any such files or directories), I don&#39;t think that&#39;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>