test case for kache error functionality
| 155 | |
| 156 | // test case for kache error functionality |
| 157 | static int |
| 158 | errorCacheTestCase( |
| 159 | const char *msg, |
| 160 | struct KernelCache *kcache, |
| 161 | solver_id_t sid, |
| 162 | SubproblemDim *dims, |
| 163 | unsigned int nrDims, |
| 164 | cl_context context, |
| 165 | cl_device_id device, |
| 166 | unsigned long extra, |
| 167 | Kernel *kern) |
| 168 | { |
| 169 | KernelKey key; |
| 170 | Kernel* krn1; |
| 171 | int r; |
| 172 | bool fail; |
| 173 | |
| 174 | key.device = device; |
| 175 | key.context = context; |
| 176 | key.nrDims = nrDims; |
| 177 | memset(key.subdims, 0, sizeof(key.subdims)); |
| 178 | r = nrDims; |
| 179 | if (nrDims > MAX_SUBDIMS) |
| 180 | r = MAX_SUBDIMS; |
| 181 | memcpy(key.subdims, dims, sizeof(SubproblemDim) * r); |
| 182 | |
| 183 | printf("%s", msg); |
| 184 | if (kern == NULL) { |
| 185 | krn1 = findKernel(kcache, sid, &key, &extra); |
| 186 | fail = (krn1 != NULL); |
| 187 | } |
| 188 | else { |
| 189 | r = addKernelToCache(kcache, sid, kern, &key, kernExtraCmp); |
| 190 | fail = (r == 0); |
| 191 | } |
| 192 | |
| 193 | if (fail) { |
| 194 | printf("FAIL\n"); |
| 195 | r = -1; |
| 196 | } |
| 197 | else { |
| 198 | printf("PASS\n"); |
| 199 | r = 0; |
| 200 | } |
| 201 | |
| 202 | return r; |
| 203 | } |
| 204 | |
| 205 | static int |
| 206 | testCache(cl_context context, cl_device_id device) |
no test coverage detected