[Piglit] [RFC 27/30] cl.py: simplify add_program_test_dir

Dylan Baker baker.dylan.c at gmail.com
Tue Jan 27 14:59:01 PST 2015


This drops some nested functions, and makes a few calls simpler.

TODO: Test this...

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 tests/cl.py | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/tests/cl.py b/tests/cl.py
index 1640456..b25f55a 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -39,7 +39,6 @@ def cl_test(*args, **kwargs):
 profile = TestProfile()
 
 
-
 # Custom
 with profile.group_manager(cl_test, 'custom') as g:
     g(['cl-custom-run-simple-kernel'], 'Run simple kernel')
@@ -111,23 +110,14 @@ with profile.group_manager(cl_test, 'program') as g:
     g(['cl-program-bitcoin-phatk'], 'Bitcoin: phatk kernel')
 
 
-def add_plain_test(group, name, args):
-    group[name] = PiglitCLTest(args, run_concurrent=can_do_concurrent)
-
-
-def add_plain_program_tester_test(group, name, path):
-    add_plain_test(group, name, ['cl-program-tester', path])
-
-
 def add_program_test_dir(group, dirpath):
     for filename in os.listdir(dirpath):
-        filepath = os.path.join(dirpath, filename)
-        ext = filename.rsplit('.')[-1]
-        if ext != 'cl' and ext != 'program_test':
+        testname, ext = os.path.splitext(filename)
+        if ext not in ['.cl', '.program_test']:
             continue
-        testname = filename[0:-(len(ext) + 1)]
-        add_plain_program_tester_test(group, testname, filepath)
 
+        group[testname] = cl_test(
+            ['cl-program-tester', os.path.join(dirpath, filename)])
 
 
 add_program_test_dir(profile.tests['Program']["Build"],
-- 
2.2.2



More information about the Piglit mailing list