1 //
2 // Copyright (c) 2017 The Khronos Group Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #include "harness/compat.h"
17 #include <stdio.h>
18 #include <stdlib.h>
19
20 #include <string.h>
21 #include "procs.h"
22 #include "harness/testHarness.h"
23
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
99 ADD_TEST(platform_extensions),
100 ADD_TEST(get_platform_ids),
101 ADD_TEST(bool_type),
102
103 ADD_TEST(repeated_setup_cleanup),
104
105 ADD_TEST(retain_queue_single),
106 ADD_TEST(retain_queue_multiple),
107 ADD_TEST(retain_mem_object_single),
108 ADD_TEST(retain_mem_object_multiple),
109 ADD_TEST(retain_mem_object_set_kernel_arg),
110 ADD_TEST(min_data_type_align_size_alignment),
111
112 ADD_TEST_VERSION(context_destructor_callback, Version(3, 0)),
113 ADD_TEST(mem_object_destructor_callback),
114 ADD_TEST(null_buffer_arg),
115 ADD_TEST(get_buffer_info),
116 ADD_TEST(get_image2d_info),
117 ADD_TEST(get_image3d_info),
118 ADD_TEST(get_image1d_info),
119 ADD_TEST(get_image1d_array_info),
120 ADD_TEST(get_image2d_array_info),
121 ADD_TEST(queue_flush_on_release),
122 ADD_TEST(queue_hint),
123 ADD_TEST(queue_properties),
124 ADD_TEST_VERSION(sub_group_dispatch, Version(2, 1)),
125 ADD_TEST_VERSION(clone_kernel, Version(2, 1)),
126 ADD_TEST_VERSION(zero_sized_enqueue, Version(2, 1)),
127
128 ADD_TEST_VERSION(buffer_properties_queries, Version(3, 0)),
129 ADD_TEST_VERSION(image_properties_queries, Version(3, 0)),
130 ADD_TEST_VERSION(queue_properties_queries, Version(3, 0)),
131 ADD_TEST_VERSION(pipe_properties_queries, Version(3, 0)),
132
133 ADD_TEST_VERSION(consistency_svm, Version(3, 0)),
134 ADD_TEST_VERSION(consistency_memory_model, Version(3, 0)),
135 ADD_TEST_VERSION(consistency_device_enqueue, Version(3, 0)),
136 ADD_TEST_VERSION(consistency_pipes, Version(3, 0)),
137 ADD_TEST_VERSION(consistency_progvar, Version(3, 0)),
138 ADD_TEST_VERSION(consistency_non_uniform_work_group, Version(3, 0)),
139 ADD_TEST_VERSION(consistency_read_write_images, Version(3, 0)),
140 ADD_TEST_VERSION(consistency_2d_image_from_buffer, Version(3, 0)),
141 ADD_TEST_VERSION(consistency_depth_images, Version(3, 0)),
142 ADD_TEST_VERSION(consistency_device_and_host_timer, Version(3, 0)),
143 ADD_TEST_VERSION(consistency_il_programs, Version(3, 0)),
144 ADD_TEST_VERSION(consistency_subgroups, Version(3, 0)),
145 ADD_TEST_VERSION(consistency_prog_ctor_dtor, Version(3, 0)),
146 ADD_TEST_VERSION(consistency_3d_image_writes, Version(3, 0)),
147
148 ADD_TEST(min_image_formats),
149 ADD_TEST(negative_get_platform_info),
150 ADD_TEST(negative_get_platform_ids),
151 };
152
153 const int test_num = ARRAY_SIZE(test_list);
154
main(int argc,const char * argv[])155 int main(int argc, const char *argv[])
156 {
157 return runTestHarness(argc, argv, test_num, test_list, false, 0);
158 }
159