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
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 #include "procs.h"
22 #include "harness/testHarness.h"
23
24 test_definition test_list[] = {
25 ADD_TEST(buffer_read_async_int),
26 ADD_TEST(buffer_read_async_uint),
27 ADD_TEST(buffer_read_async_long),
28 ADD_TEST(buffer_read_async_ulong),
29 ADD_TEST(buffer_read_async_short),
30 ADD_TEST(buffer_read_async_ushort),
31 ADD_TEST(buffer_read_async_char),
32 ADD_TEST(buffer_read_async_uchar),
33 ADD_TEST(buffer_read_async_float),
34 ADD_TEST(buffer_read_array_barrier_int),
35 ADD_TEST(buffer_read_array_barrier_uint),
36 ADD_TEST(buffer_read_array_barrier_long),
37 ADD_TEST(buffer_read_array_barrier_ulong),
38 ADD_TEST(buffer_read_array_barrier_short),
39 ADD_TEST(buffer_read_array_barrier_ushort),
40 ADD_TEST(buffer_read_array_barrier_char),
41 ADD_TEST(buffer_read_array_barrier_uchar),
42 ADD_TEST(buffer_read_array_barrier_float),
43 ADD_TEST(buffer_read_int),
44 ADD_TEST(buffer_read_uint),
45 ADD_TEST(buffer_read_long),
46 ADD_TEST(buffer_read_ulong),
47 ADD_TEST(buffer_read_short),
48 ADD_TEST(buffer_read_ushort),
49 ADD_TEST(buffer_read_float),
50 ADD_TEST(buffer_read_half),
51 ADD_TEST(buffer_read_char),
52 ADD_TEST(buffer_read_uchar),
53 ADD_TEST(buffer_read_struct),
54 ADD_TEST(buffer_read_random_size),
55 ADD_TEST(buffer_map_read_int),
56 ADD_TEST(buffer_map_read_uint),
57 ADD_TEST(buffer_map_read_long),
58 ADD_TEST(buffer_map_read_ulong),
59 ADD_TEST(buffer_map_read_short),
60 ADD_TEST(buffer_map_read_ushort),
61 ADD_TEST(buffer_map_read_char),
62 ADD_TEST(buffer_map_read_uchar),
63 ADD_TEST(buffer_map_read_float),
64 ADD_TEST(buffer_map_read_struct),
65
66 ADD_TEST(buffer_map_write_int),
67 ADD_TEST(buffer_map_write_uint),
68 ADD_TEST(buffer_map_write_long),
69 ADD_TEST(buffer_map_write_ulong),
70 ADD_TEST(buffer_map_write_short),
71 ADD_TEST(buffer_map_write_ushort),
72 ADD_TEST(buffer_map_write_char),
73 ADD_TEST(buffer_map_write_uchar),
74 ADD_TEST(buffer_map_write_float),
75 ADD_TEST(buffer_map_write_struct),
76
77 ADD_TEST(buffer_write_int),
78 ADD_TEST(buffer_write_uint),
79 ADD_TEST(buffer_write_short),
80 ADD_TEST(buffer_write_ushort),
81 ADD_TEST(buffer_write_char),
82 ADD_TEST(buffer_write_uchar),
83 ADD_TEST(buffer_write_float),
84 ADD_TEST(buffer_write_half),
85 ADD_TEST(buffer_write_long),
86 ADD_TEST(buffer_write_ulong),
87 ADD_TEST(buffer_write_struct),
88 ADD_TEST(buffer_write_async_int),
89 ADD_TEST(buffer_write_async_uint),
90 ADD_TEST(buffer_write_async_short),
91 ADD_TEST(buffer_write_async_ushort),
92 ADD_TEST(buffer_write_async_char),
93 ADD_TEST(buffer_write_async_uchar),
94 ADD_TEST(buffer_write_async_float),
95 ADD_TEST(buffer_write_async_long),
96 ADD_TEST(buffer_write_async_ulong),
97 ADD_TEST(buffer_copy),
98 ADD_TEST(buffer_partial_copy),
99 ADD_TEST(mem_read_write_flags),
100 ADD_TEST(mem_write_only_flags),
101 ADD_TEST(mem_read_only_flags),
102 ADD_TEST(mem_copy_host_flags),
103 ADD_TEST(mem_alloc_ref_flags),
104 ADD_TEST(array_info_size),
105
106 ADD_TEST(sub_buffers_read_write),
107 ADD_TEST(sub_buffers_read_write_dual_devices),
108 ADD_TEST(sub_buffers_overlapping),
109
110 ADD_TEST(buffer_fill_int),
111 ADD_TEST(buffer_fill_uint),
112 ADD_TEST(buffer_fill_short),
113 ADD_TEST(buffer_fill_ushort),
114 ADD_TEST(buffer_fill_char),
115 ADD_TEST(buffer_fill_uchar),
116 ADD_TEST(buffer_fill_long),
117 ADD_TEST(buffer_fill_ulong),
118 ADD_TEST(buffer_fill_float),
119 ADD_TEST(buffer_fill_struct),
120
121 ADD_TEST(buffer_migrate),
122 ADD_TEST(image_migrate),
123 };
124
125 const int test_num = ARRAY_SIZE( test_list );
126
127 const cl_mem_flags flag_set[] = {
128 CL_MEM_ALLOC_HOST_PTR,
129 CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR,
130 CL_MEM_USE_HOST_PTR,
131 CL_MEM_COPY_HOST_PTR,
132 0
133 };
134 const char* flag_set_names[] = {
135 "CL_MEM_ALLOC_HOST_PTR",
136 "CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR",
137 "CL_MEM_USE_HOST_PTR",
138 "CL_MEM_COPY_HOST_PTR",
139 "0"
140 };
141
main(int argc,const char * argv[])142 int main( int argc, const char *argv[] )
143 {
144 return runTestHarness(argc, argv, test_num, test_list, false, 0);
145 }
146