diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2015-01-28 15:59:01 -0800 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2015-03-05 09:46:47 -0800 |
commit | 559f3cd72a747feba8f63f7fe357e541f860f214 (patch) | |
tree | 202f8f943fbf03ba701e6febd3abb926528c9fe9 | |
parent | c5686080654af5da67f44772f7087aec88dd4651 (diff) |
framework: Override run_concurrent for CL test classes
This patch changes where the OpenCL tests get their run_concurrent flag
from. After this patch it is computed automatically, leaving no need to
set the flag manually unless one wants to force a non default behavior
for their platform.
v2: - fix some formatting
XXX: This assumes Thomas Stellard's
"opencv: Automatically run tests concurrently..." patch
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
-rw-r--r-- | framework/test/opencv.py | 3 | ||||
-rw-r--r-- | framework/test/piglit_test.py | 21 | ||||
-rw-r--r-- | tests/cl.py | 28 |
3 files changed, 22 insertions, 30 deletions
diff --git a/framework/test/opencv.py b/framework/test/opencv.py index 3490c8ab6..157102e51 100644 --- a/framework/test/opencv.py +++ b/framework/test/opencv.py @@ -29,6 +29,7 @@ from os import path from .gtest import GTest from framework.core import PIGLIT_CONFIG +from framework.test import CL_CONCURRENT import framework.grouptools as grouptools __all__ = [ @@ -42,7 +43,7 @@ class OpenCVTest(GTest): 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=CL_CONCURRENT) def add_opencv_tests(profile): diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py index 7511df217..51aa8e896 100644 --- a/framework/test/piglit_test.py +++ b/framework/test/piglit_test.py @@ -24,6 +24,8 @@ from __future__ import print_function, absolute_import import os +import sys +import glob try: import simplejson as json except ImportError: @@ -34,9 +36,10 @@ import framework.core as core __all__ = [ - 'PiglitGLTest', 'PiglitCLTest', - 'TEST_BIN_DIR' + 'PiglitGLTest', + 'CL_CONCURRENT', + 'TEST_BIN_DIR', ] if 'PIGLIT_BUILD_DIR' in os.environ: @@ -45,6 +48,9 @@ else: TEST_BIN_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), '../../bin')) +CL_CONCURRENT = (not sys.platform.startswith('linux') or + glob.glob('/dev/dri/render*')) + class PiglitBaseTest(Test): """ @@ -136,6 +142,11 @@ class PiglitGLTest(WindowResizeMixin, PiglitBaseTest): return super(PiglitGLTest, self).command + ['-auto', '-fbo'] -class PiglitCLTest(PiglitBaseTest): - """ OpenCL specific Test class """ - pass +class PiglitCLTest(PiglitBaseTest): # pylint: disable=too-few-public-methods + """ OpenCL specific Test class. + + Set concurrency based on CL requirements. + + """ + def __init__(self, command, run_concurrent=CL_CONCURRENT, **kwargs): + super(PiglitCLTest, self).__init__(command, run_concurrent, **kwargs) diff --git a/tests/cl.py b/tests/cl.py index 6ac1e75ba..6e0eb6e9d 100644 --- a/tests/cl.py +++ b/tests/cl.py @@ -10,8 +10,6 @@ from __future__ import division, absolute_import, print_function import os -import sys -import glob from framework.profile import TestProfile from framework.test import PiglitCLTest @@ -20,35 +18,17 @@ from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR __all__ = ['profile'] - -can_do_concurrent = (not sys.platform.startswith('linux') or - glob.glob('/dev/dri/render*')) - - -def cl_test(*args, **kwargs): - """Wrapper for PiglitCLTest that sets run_concurrent. - - Always set concurrent to can_do_concurrent, but allow it to be turned off - explicitely. - - """ - if kwargs.get('run_concurrent') is not False: - kwargs['run_concurrent'] = can_do_concurrent - return PiglitCLTest(*args, **kwargs) - - profile = TestProfile() - # Custom -with profile.group_manager(cl_test, 'custom') as g: +with profile.group_manager(PiglitCLTest, 'custom') as g: g(['cl-custom-run-simple-kernel'], 'Run simple kernel') g(['cl-custom-flush-after-enqueue-kernel'], 'Flush after enqueue kernel') g(['cl-custom-r600-create-release-buffer-bug'], 'r600 create release buffer bug') g(['cl-custom-buffer-flags'], 'Buffer flags') -with profile.group_manager(cl_test, 'api') as g: +with profile.group_manager(PiglitCLTest, 'api') as g: # Platform g(['cl-api-get-platform-ids'], 'clGetPlatformIDs') g(['cl-api-get-platform-info'], 'clGetPlatformInfo') @@ -105,7 +85,7 @@ with profile.group_manager(cl_test, 'api') as g: g(['cl-api-get-event-info'], 'clGetEventInfo') g(['cl-api-retain_release-event'], 'clRetainEvent and clReleaseEvent') -with profile.group_manager(cl_test, 'program') as g: +with profile.group_manager(PiglitCLTest, 'program') as g: g(['cl-program-max-work-item-sizes'], 'Run kernel with max work item sizes') g(['cl-program-bitcoin-phatk'], 'Bitcoin: phatk kernel') @@ -117,7 +97,7 @@ def add_program_test_dir(group, dirpath): if ext not in ['.cl', '.program_test']: continue - profile.test_list[grouptools.join(group, testname)] = cl_test( + profile.test_list[grouptools.join(group, testname)] = PiglitCLTest( ['cl-program-tester', os.path.join(dirpath, filename)]) |