summary/html: escape html
[piglit.git] / tests / cl.py
blob7d4e17db1e9e836a4153a32a2f40ea58342b545a
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 """All OpenCL tests that come with piglit, using default settings."""
5 # Because these profiles put all of the names in the global scope and rely on
6 # __all__ to hide private names there will be a lot errors from pylint about
7 # invalid constant names, they're not really fixable, so just hide them.
8 # pylint: disable=invalid-name
10 from __future__ import (
11 absolute_import, division, print_function, unicode_literals
14 import os
16 from framework.profile import TestProfile
17 from framework.test.piglit_test import PiglitCLTest, CLProgramTester, ROOT_DIR
18 from framework import grouptools
19 from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR
21 __all__ = ['profile']
23 profile = TestProfile()
25 # Custom
26 with profile.test_list.group_manager(PiglitCLTest, 'custom') as g:
27 g(['cl-custom-run-simple-kernel'], 'Run simple kernel')
28 g(['cl-custom-flush-after-enqueue-kernel'], 'Flush after enqueue kernel')
29 g(['cl-custom-r600-create-release-buffer-bug'],
30 'r600 create release buffer bug')
31 g(['cl-custom-buffer-flags'], 'Buffer flags')
33 with profile.test_list.group_manager(PiglitCLTest, 'api') as g:
34 # Platform
35 g(['cl-api-get-platform-ids'], 'clGetPlatformIDs')
36 g(['cl-api-get-platform-info'], 'clGetPlatformInfo')
37 g(['cl-api-get-extension-function-address-for-platform'],
38 'clGetExtensionFunctionAddressForPlatform')
40 # Device
41 g(['cl-api-get-device-ids'], 'clGetDeviceIDs')
42 g(['cl-api-get-device-info'], 'clGetDeviceInfo')
44 # Context
45 g(['cl-api-create-context'], 'clCreateContext')
46 g(['cl-api-create-context-from-type'], 'clCreateContextFromType')
47 g(['cl-api-get-context-info'], 'clGetContextInfo')
48 g(['cl-api-retain_release-context'],
49 'clRetainContext and clReleaseContext')
51 # Command Queues
52 g(['cl-api-create-command-queue'], 'clCreateCommandQueue')
53 g(['cl-api-retain_release-command-queue'],
54 'clRetainComandQueue and clReleaseCommandQueue')
55 g(['cl-api-get-command-queue-info'], 'clGetCommandQueueInfo')
57 # Memory objects
58 g(['cl-api-create-buffer'], 'clCreateBuffer')
59 g(['cl-api-create-image'], 'clCreateImage')
60 g(['cl-api-create-sampler'], 'clCreateSampler')
61 g(['cl-api-enqueue-copy-buffer'], 'clEnqueueCopyBuffer')
62 g(['cl-api-enqueue-copy-buffer-rect'], 'clEnqueueCopyBufferRect')
63 g(['cl-api-enqueue-read_write-buffer'],
64 'clEnqueueReadBuffer and clEnqueueWriteBuffer')
65 g(['cl-api-enqueue-fill-buffer'], 'clEnqueueFillBuffer')
66 g(['cl-api-enqueue-fill-image'], 'clEnqueueFillImage')
67 g(['cl-api-enqueue-migrate-mem-objects'], 'clEnqueueMigrateMemObjects')
68 g(['cl-api-get-mem-object-info'], 'clGetMemObjectInfo')
69 g(['cl-api-get-image-info'], 'clGetImageInfo')
70 g(['cl-api-retain_release-mem-object'],
71 'clRetainMemObject and clReleaseMemObject')
73 g(['cl-api-create-program-with-binary'], 'clCreateProgramWithBinary')
74 g(['cl-api-create-program-with-source'], 'clCreateProgramWithSource')
75 g(['cl-api-build-program'], 'clBuildProgram')
76 g(['cl-api-compile-program'], 'clCompileProgram')
77 g(['cl-api-link-program'], 'clLinkProgram')
78 g(['cl-api-get-program-info'], 'clGetProgramInfo')
79 g(['cl-api-get-program-build-info'], 'clGetProgramBuildInfo')
80 g(['cl-api-retain_release-program'],
81 'clRetainProgram and clReleaseProgram')
82 g(['cl-api-unload-compiler'], 'clUnloadCompiler')
84 # Kernel
85 g(['cl-api-create-kernel'], 'clCreateKernel')
86 g(['cl-api-create-kernels-in-program'], 'clCreateKernelsInProgram')
87 g(['cl-api-get-kernel-arg-info'], 'clGetKernelArgInfo')
88 g(['cl-api-get-kernel-info'], 'clGetKernelInfo')
89 g(['cl-api-get-kernel-work-group-info'], 'clGetKernelWorkGroupInfo')
90 g(['cl-api-retain_release-kernel'], 'clRetainKernel and clReleaseKernel')
91 g(['cl-api-set-kernel-arg'], 'clSetKernelArg')
93 # Event
94 g(['cl-api-get-event-info'], 'clGetEventInfo')
95 g(['cl-api-retain_release-event'], 'clRetainEvent and clReleaseEvent')
97 with profile.test_list.group_manager(PiglitCLTest, 'program') as g:
98 g(['cl-program-max-work-item-sizes'],
99 'Run kernel with max work item sizes')
100 g(['cl-program-bitcoin-phatk'], 'Bitcoin: phatk kernel')
101 g(['cl-program-predefined-macros'], 'Check predefined preprocessor macros')
103 with profile.test_list.group_manager(PiglitCLTest, 'interop') as g:
104 g(['cl-interop-egl_khr_cl_event2'], 'EGL_KHR_cl_event2')
107 def add_program_test_dir(group, dirpath, buildbase, installbase):
108 for filename in os.listdir(os.path.join(buildbase, dirpath)):
109 testname, ext = os.path.splitext(filename)
110 if ext not in ['.cl', '.program_test']:
111 continue
113 profile.test_list[grouptools.join(group, testname)] = CLProgramTester(
114 os.path.join(installbase, dirpath, os.path.basename(filename)))
117 base_test_dir = os.path.basename(TESTS_DIR)
118 base_gen_dir = os.path.basename(GENERATED_TESTS_DIR)
120 add_program_test_dir(grouptools.join('program', 'build'),
121 os.path.join('cl', 'program', 'build'),
122 TESTS_DIR,
123 base_test_dir)
124 add_program_test_dir(grouptools.join('program', 'build', 'fail'),
125 os.path.join('cl', 'program', 'build', 'fail'),
126 TESTS_DIR,
127 base_test_dir)
128 add_program_test_dir(grouptools.join('program', 'execute'),
129 os.path.join('cl', 'program', 'execute'),
130 TESTS_DIR,
131 base_test_dir)
132 add_program_test_dir(grouptools.join('program', 'execute'),
133 os.path.join('cl', 'program', 'execute', 'builtin', 'atomic'),
134 TESTS_DIR,
135 base_test_dir)
136 add_program_test_dir(grouptools.join('program', 'execute'),
137 os.path.join('cl', 'program', 'execute', 'builtin', 'convert'),
138 TESTS_DIR,
139 base_test_dir)
141 # Run generated built-in tests
142 add_program_test_dir(grouptools.join('program', 'execute', 'builtin'),
143 os.path.join('cl', 'builtin', 'int'),
144 GENERATED_TESTS_DIR,
145 base_gen_dir)
146 add_program_test_dir(grouptools.join('program', 'execute', 'builtin'),
147 os.path.join('cl', 'builtin', 'math'),
148 GENERATED_TESTS_DIR,
149 base_gen_dir)
150 add_program_test_dir(grouptools.join('program', 'execute', 'builtin'),
151 os.path.join('cl', 'builtin', 'relational'),
152 GENERATED_TESTS_DIR,
153 base_gen_dir)
154 add_program_test_dir(grouptools.join('program', 'execute', 'builtin'),
155 os.path.join('cl', 'builtin', 'common'),
156 GENERATED_TESTS_DIR,
157 base_gen_dir)
158 add_program_test_dir(grouptools.join('program', 'execute', 'builtin'),
159 os.path.join('cl', 'builtin', 'misc'),
160 GENERATED_TESTS_DIR,
161 base_gen_dir)
162 add_program_test_dir(grouptools.join('program', 'execute', 'store'),
163 os.path.join('cl', 'store'),
164 GENERATED_TESTS_DIR,
165 base_gen_dir)
166 add_program_test_dir(grouptools.join('program', 'execute', 'vstore'),
167 os.path.join('cl', 'vstore'),
168 GENERATED_TESTS_DIR,
169 base_gen_dir)
170 add_program_test_dir(grouptools.join('program', 'execute', 'vload'),
171 os.path.join('cl', 'vload'),
172 GENERATED_TESTS_DIR,
173 base_gen_dir)