Skip to content

Commit 794d332

Browse files
authored
Migrate API suite to the new test registration framework (#2196)
Contributes to #2181 Signed-off-by: Ahmed Hesham <[email protected]>
1 parent 2316c63 commit 794d332

40 files changed

+794
-1245
lines changed

test_conformance/api/main.cpp

Lines changed: 2 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -13,164 +13,11 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515
//
16-
#include "harness/compat.h"
17-
#include <stdio.h>
18-
#include <stdlib.h>
1916

20-
#include <string.h>
21-
#include "procs.h"
2217
#include "harness/testHarness.h"
2318

24-
#if !defined(_WIN32)
25-
#include <unistd.h>
26-
#endif
27-
28-
// FIXME: To use certain functions in harness/imageHelpers.h
29-
// (for example, generate_random_image_data()), the tests are required to
30-
// declare the following variables (<rdar://problem/11111245>):
31-
32-
test_definition test_list[] = {
33-
ADD_TEST(get_platform_info),
34-
ADD_TEST_VERSION(get_sampler_info, Version(2, 0)),
35-
ADD_TEST(get_sampler_info_compatibility),
36-
ADD_TEST_VERSION(get_command_queue_info, Version(2, 0)),
37-
ADD_TEST(get_command_queue_info_compatibility),
38-
ADD_TEST(get_context_info),
39-
ADD_TEST(get_device_info),
40-
ADD_TEST(enqueue_task),
41-
ADD_TEST(binary_get),
42-
ADD_TEST(binary_create),
43-
ADD_TEST(kernel_required_group_size),
44-
45-
ADD_TEST(release_kernel_order),
46-
ADD_TEST(release_during_execute),
47-
48-
ADD_TEST(load_single_kernel),
49-
ADD_TEST(load_two_kernels),
50-
ADD_TEST(load_two_kernels_in_one),
51-
ADD_TEST(load_two_kernels_manually),
52-
ADD_TEST(get_program_info_kernel_names),
53-
ADD_TEST(get_kernel_arg_info),
54-
ADD_TEST(create_kernels_in_program),
55-
ADD_TEST(get_kernel_info),
56-
ADD_TEST(kernel_private_memory_size),
57-
ADD_TEST(execute_kernel_local_sizes),
58-
ADD_TEST(set_kernel_arg_by_index),
59-
ADD_TEST(set_kernel_arg_constant),
60-
ADD_TEST(set_kernel_arg_struct_array),
61-
ADD_TEST(kernel_global_constant),
62-
ADD_TEST(kernel_attributes),
63-
64-
ADD_TEST(min_max_thread_dimensions),
65-
ADD_TEST(min_max_work_items_sizes),
66-
ADD_TEST(min_max_work_group_size),
67-
ADD_TEST(min_max_read_image_args),
68-
ADD_TEST(min_max_write_image_args),
69-
ADD_TEST(min_max_mem_alloc_size),
70-
ADD_TEST(min_max_image_2d_width),
71-
ADD_TEST(min_max_image_2d_height),
72-
ADD_TEST(min_max_image_3d_width),
73-
ADD_TEST(min_max_image_3d_height),
74-
ADD_TEST(min_max_image_3d_depth),
75-
ADD_TEST(min_max_image_array_size),
76-
ADD_TEST(min_max_image_buffer_size),
77-
ADD_TEST(min_max_parameter_size),
78-
ADD_TEST(min_max_samplers),
79-
ADD_TEST(min_max_constant_buffer_size),
80-
ADD_TEST(min_max_constant_args),
81-
ADD_TEST(min_max_compute_units),
82-
ADD_TEST(min_max_address_bits),
83-
ADD_TEST(min_max_single_fp_config),
84-
ADD_TEST(min_max_double_fp_config),
85-
ADD_TEST(min_max_local_mem_size),
86-
ADD_TEST(min_max_kernel_preferred_work_group_size_multiple),
87-
ADD_TEST(min_max_execution_capabilities),
88-
ADD_TEST(min_max_queue_properties),
89-
ADD_TEST(min_max_device_version),
90-
ADD_TEST(min_max_language_version),
91-
92-
ADD_TEST(kernel_arg_changes),
93-
ADD_TEST(kernel_arg_multi_setup_random),
94-
95-
ADD_TEST(native_kernel),
96-
97-
ADD_TEST(create_context_from_type),
98-
ADD_TEST(create_context_from_type_device_type_all),
99-
ADD_TEST(create_context_from_type_device_type_default),
100-
101-
ADD_TEST(platform_extensions),
102-
ADD_TEST(get_platform_ids),
103-
ADD_TEST(bool_type),
104-
105-
ADD_TEST(repeated_setup_cleanup),
106-
107-
ADD_TEST(retain_queue_single),
108-
ADD_TEST(retain_queue_multiple),
109-
ADD_TEST(retain_mem_object_single),
110-
ADD_TEST(retain_mem_object_multiple),
111-
ADD_TEST(retain_mem_object_set_kernel_arg),
112-
ADD_TEST(min_data_type_align_size_alignment),
113-
114-
ADD_TEST_VERSION(context_destructor_callback, Version(3, 0)),
115-
ADD_TEST(mem_object_destructor_callback),
116-
ADD_TEST(null_buffer_arg),
117-
ADD_TEST(get_buffer_info),
118-
ADD_TEST(get_image2d_info),
119-
ADD_TEST(get_image3d_info),
120-
ADD_TEST(get_image1d_info),
121-
ADD_TEST(get_image1d_array_info),
122-
ADD_TEST(get_image2d_array_info),
123-
ADD_TEST(queue_flush_on_release),
124-
ADD_TEST(queue_hint),
125-
ADD_TEST(queue_properties),
126-
ADD_TEST_VERSION(sub_group_dispatch, Version(2, 1)),
127-
ADD_TEST_VERSION(clone_kernel, Version(2, 1)),
128-
ADD_TEST_VERSION(zero_sized_enqueue, Version(2, 1)),
129-
130-
ADD_TEST_VERSION(buffer_properties_queries, Version(3, 0)),
131-
ADD_TEST_VERSION(image_properties_queries, Version(3, 0)),
132-
ADD_TEST_VERSION(queue_properties_queries, Version(3, 0)),
133-
ADD_TEST_VERSION(pipe_properties_queries, Version(3, 0)),
134-
135-
ADD_TEST_VERSION(consistency_svm, Version(3, 0)),
136-
ADD_TEST_VERSION(consistency_memory_model, Version(3, 0)),
137-
ADD_TEST_VERSION(consistency_device_enqueue, Version(3, 0)),
138-
ADD_TEST_VERSION(consistency_pipes, Version(3, 0)),
139-
ADD_TEST_VERSION(consistency_progvar, Version(3, 0)),
140-
ADD_TEST_VERSION(consistency_non_uniform_work_group, Version(3, 0)),
141-
ADD_TEST_VERSION(consistency_read_write_images, Version(3, 0)),
142-
ADD_TEST_VERSION(consistency_2d_image_from_buffer, Version(3, 0)),
143-
ADD_TEST_VERSION(consistency_depth_images, Version(3, 0)),
144-
ADD_TEST_VERSION(consistency_device_and_host_timer, Version(3, 0)),
145-
ADD_TEST_VERSION(consistency_il_programs, Version(3, 0)),
146-
ADD_TEST_VERSION(consistency_subgroups, Version(3, 0)),
147-
ADD_TEST_VERSION(consistency_prog_ctor_dtor, Version(3, 0)),
148-
ADD_TEST_VERSION(consistency_3d_image_writes, Version(3, 0)),
149-
ADD_TEST(consistency_requirements_fp64),
150-
ADD_TEST(consistency_requirements_fp16),
151-
152-
ADD_TEST(min_image_formats),
153-
ADD_TEST(set_command_queue_property),
154-
155-
ADD_TEST(negative_get_platform_info),
156-
ADD_TEST(negative_get_platform_ids),
157-
158-
ADD_TEST(work_group_suggested_local_size_1D),
159-
ADD_TEST(work_group_suggested_local_size_2D),
160-
ADD_TEST(work_group_suggested_local_size_3D),
161-
162-
ADD_TEST(negative_create_command_queue),
163-
ADD_TEST_VERSION(negative_create_command_queue_with_properties,
164-
Version(2, 0)),
165-
ADD_TEST(negative_create_command_queue_with_properties_khr),
166-
ADD_TEST(kernel_local_memory_size),
167-
168-
ADD_TEST_VERSION(set_default_device_command_queue, Version(2, 1)),
169-
};
170-
171-
const int test_num = ARRAY_SIZE(test_list);
172-
17319
int main(int argc, const char *argv[])
17420
{
175-
return runTestHarness(argc, argv, test_num, test_list, false, 0);
21+
return runTestHarness(argc, argv, test_registry::getInstance().num_tests(),
22+
test_registry::getInstance().definitions(), false, 0);
17623
}

test_conformance/api/negative_platform.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
#include "testBase.h"
1818

19-
int test_negative_get_platform_ids(cl_device_id deviceID, cl_context context,
20-
cl_command_queue queue, int num_elements)
19+
REGISTER_TEST(negative_get_platform_ids)
2120
{
2221
cl_platform_id platform;
2322
cl_int err = clGetPlatformIDs(0, &platform, nullptr);
@@ -37,10 +36,9 @@ int test_negative_get_platform_ids(cl_device_id deviceID, cl_context context,
3736
return TEST_PASS;
3837
}
3938

40-
int test_negative_get_platform_info(cl_device_id deviceID, cl_context context,
41-
cl_command_queue queue, int num_elements)
39+
REGISTER_TEST(negative_get_platform_info)
4240
{
43-
cl_platform_id platform = getPlatformFromDevice(deviceID);
41+
cl_platform_id platform = getPlatformFromDevice(device);
4442

4543
constexpr cl_platform_info INVALID_PARAM_VALUE = 0;
4644
cl_int err =

test_conformance/api/negative_queue.cpp

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
#include "testBase.h"
1717
#include "harness/typeWrappers.h"
1818

19-
int test_negative_create_command_queue(cl_device_id deviceID,
20-
cl_context context,
21-
cl_command_queue queue, int num_elements)
19+
REGISTER_TEST(negative_create_command_queue)
2220
{
2321
cl_command_queue_properties device_props = 0;
24-
cl_int error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_PROPERTIES,
22+
cl_int error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
2523
sizeof(device_props), &device_props, NULL);
2624
test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed");
2725

@@ -40,7 +38,7 @@ int test_negative_create_command_queue(cl_device_id deviceID,
4038
// code
4139
cl_int test_error = CL_SUCCESS;
4240
clCommandQueueWrapper test_queue = clCreateCommandQueue(
43-
context, deviceID, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &test_error);
41+
context, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &test_error);
4442

4543
test_failure_error_ret(
4644
test_error, CL_INVALID_QUEUE_PROPERTIES,
@@ -52,18 +50,16 @@ int test_negative_create_command_queue(cl_device_id deviceID,
5250
return TEST_PASS;
5351
}
5452

55-
int test_negative_create_command_queue_with_properties(cl_device_id deviceID,
56-
cl_context context,
57-
cl_command_queue queue,
58-
int num_elements)
53+
REGISTER_TEST_VERSION(negative_create_command_queue_with_properties,
54+
Version(2, 0))
5955
{
6056
cl_command_queue_properties device_props = 0;
61-
cl_int error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_PROPERTIES,
57+
cl_int error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
6258
sizeof(device_props), &device_props, NULL);
6359
test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed");
6460

6561
cl_command_queue_properties device_on_host_props = 0;
66-
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES,
62+
error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES,
6763
sizeof(device_on_host_props), &device_on_host_props,
6864
NULL);
6965
test_error(error,
@@ -97,7 +93,7 @@ int test_negative_create_command_queue_with_properties(cl_device_id deviceID,
9793

9894
cl_int test_error = CL_SUCCESS;
9995
clCommandQueueWrapper test_queue = clCreateCommandQueueWithProperties(
100-
context, deviceID, queue_prop_def, &test_error);
96+
context, device, queue_prop_def, &test_error);
10197

10298
test_failure_error_ret(test_error, CL_INVALID_QUEUE_PROPERTIES,
10399
"clCreateCommandQueueWithProperties should "
@@ -110,17 +106,15 @@ int test_negative_create_command_queue_with_properties(cl_device_id deviceID,
110106
return TEST_PASS;
111107
}
112108

113-
int test_negative_create_command_queue_with_properties_khr(
114-
cl_device_id deviceID, cl_context context, cl_command_queue queue,
115-
int num_elements)
109+
REGISTER_TEST(negative_create_command_queue_with_properties_khr)
116110
{
117-
if (!is_extension_available(deviceID, "cl_khr_create_command_queue"))
111+
if (!is_extension_available(device, "cl_khr_create_command_queue"))
118112
{
119113
return TEST_SKIPPED_ITSELF;
120114
}
121115

122116
cl_platform_id platform;
123-
cl_int error = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM,
117+
cl_int error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM,
124118
sizeof(cl_platform_id), &platform, NULL);
125119
test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed");
126120

@@ -136,7 +130,7 @@ int test_negative_create_command_queue_with_properties_khr(
136130
}
137131

138132
cl_command_queue_properties device_props = 0;
139-
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_PROPERTIES,
133+
error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
140134
sizeof(device_props), &device_props, NULL);
141135
test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed");
142136

@@ -160,7 +154,7 @@ int test_negative_create_command_queue_with_properties_khr(
160154

161155
cl_int test_error = CL_SUCCESS;
162156
clCommandQueueWrapper test_khr_queue =
163-
clCreateCommandQueueWithPropertiesKHR(context, deviceID, queue_prop_def,
157+
clCreateCommandQueueWithPropertiesKHR(context, device, queue_prop_def,
164158
&test_error);
165159

166160
test_failure_error_ret(test_error, CL_INVALID_QUEUE_PROPERTIES,

0 commit comments

Comments
 (0)