[Piglit] [PATCH 1/2] opencv: Automatically run tests concurrently when render-nodes are present

Tom Stellard thomas.stellard at amd.com
Fri Jan 23 09:54:58 PST 2015


---
 framework/test/opencv.py | 11 ++++++-----
 tests/cl.py              |  9 ++++-----
 tests/quick_cl.py        |  4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/framework/test/opencv.py b/framework/test/opencv.py
index 2c3d627..2eca948 100644
--- a/framework/test/opencv.py
+++ b/framework/test/opencv.py
@@ -38,14 +38,14 @@ __all__ = [
 
 
 class OpenCVTest(GTest):
-    def __init__(self, test_prog, testname):
+    def __init__(self, test_prog, testname, should_run_concurrent):
         options = [test_prog, '--gtest_filter=' + testname, '--gtest_color=no']
         if PIGLIT_CONFIG.has_option('opencv', 'workdir'):
             options.append('-w {}'.format(PIGLIT_CONFIG.get('opencv', 'workdir')))
-        GTest.__init__(self, options)
+        GTest.__init__(self, options, run_concurrent = should_run_concurrent)
 
 
-def add_opencv_tests(profile):
+def add_opencv_tests(profile, should_run_concurrent = False):
     if not PIGLIT_CONFIG.has_option('opencv', 'opencv_test_ocl_bindir'):
         return
 
@@ -69,7 +69,7 @@ def add_opencv_tests(profile):
             full_test_name = 'opencv/{}'.format(group_desc)
             if not individual:
                 profile.tests[full_test_name] = OpenCVTest(opencv_test_ocl,
-                    '{}*'.format(group_name))
+                    '{}*'.format(group_name), should_run_concurrent)
             continue
 
         if not individual:
@@ -80,4 +80,5 @@ def add_opencv_tests(profile):
         if m:
             test_name = m.group(1)
             profile.tests[grouptools.join(full_test_name, test_name)] = \
-                OpenCVTest(opencv_test_ocl, '{}{}'.format(group_name ,test_name))
+                OpenCVTest(opencv_test_ocl, '{}{}'.format(group_name ,test_name),
+                           should_run_concurrent)
diff --git a/tests/cl.py b/tests/cl.py
index 06301af..0915279 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -22,13 +22,12 @@ __all__ = ['profile']
 ######
 # Helper functions
 
-can_do_concurrent = (not sys.platform.startswith('linux') or
-                     glob.glob('/dev/dri/render*'))
-
+def cl_can_do_concurrent():
+        return (not sys.platform.startswith('linux') or
+                glob.glob('/dev/dri/render*'))
 
 def add_plain_test(group, name, args):
-    group[name] = PiglitCLTest(args, run_concurrent=can_do_concurrent)
-
+        group[name] = PiglitCLTest(args, run_concurrent=cl_can_do_concurrent())
 
 def add_plain_program_tester_test(group, name, path):
     add_plain_test(group, name, ['cl-program-tester', path])
diff --git a/tests/quick_cl.py b/tests/quick_cl.py
index 7f82a86..5d46d45 100644
--- a/tests/quick_cl.py
+++ b/tests/quick_cl.py
@@ -24,8 +24,8 @@
 # Authors: Tom Stellard <thomas.stellard at amd.com>
 #
 
-from tests.cl import profile
+from tests.cl import profile, cl_can_do_concurrent
 from framework.test import add_opencv_tests, add_oclconform_tests
 
-add_opencv_tests(profile)
+add_opencv_tests(profile, cl_can_do_concurrent())
 add_oclconform_tests(profile)
-- 
1.8.5.5



More information about the Piglit mailing list