@@ -535,7 +535,7 @@ void testMoveConstructContextNonNull(void);
535535void testMoveConstructContextNull (void );
536536MAKE_MOVE_TESTS (Context, make_context, clReleaseContext, contextPool)
537537
538- static cl_context clCreateContext_testEmptyDevices (
538+ static cl_context clCreateContext_EmptyDevices (
539539 const cl_context_properties* properties,
540540 cl_uint num_devices,
541541 const cl_device_id* devices,
@@ -560,7 +560,7 @@ static cl_context clCreateContext_testEmptyDevices(
560560void testContextCreateEmptyDevices (void )
561561{
562562#ifndef CL_HPP_ENABLE_EXCEPTIONS
563- clCreateContext_StubWithCallback (clCreateContext_testEmptyDevices );
563+ clCreateContext_StubWithCallback (clCreateContext_EmptyDevices );
564564
565565 cl::vector<cl::Device> vec;
566566 cl::Context context (vec);
@@ -2001,6 +2001,15 @@ void testKernelSetArgBySetKernelArgSVMPointerWithVectorType(void)
20012001#endif
20022002}
20032003
2004+ void testKernelSetArgBySetKernelArgSVMPointerWithEmptyVectorType (void )
2005+ {
2006+ #if CL_HPP_TARGET_OPENCL_VERSION >= 200
2007+ VECTOR_CLASS<int > vec;
2008+ clSetKernelArgSVMPointer_ExpectAndReturn (make_kernel (1 ), 2 , nullptr , CL_SUCCESS);
2009+ TEST_ASSERT_EQUAL (kernelPool[1 ].setArg (2 , vec), CL_SUCCESS);
2010+ #endif
2011+ }
2012+
20042013void testKernelSetArgBySetKernelArgSVMPointerWithPointerType (void )
20052014{
20062015#if CL_HPP_TARGET_OPENCL_VERSION >= 200
@@ -2061,7 +2070,7 @@ void testKernelSetSVMPointers(void)
20612070#endif
20622071}
20632072
2064- void testKernelSetSVMPointersEmpty (void )
2073+ void testKernelSetSVMPointersEmptyVec (void )
20652074{
20662075#if CL_HPP_TARGET_OPENCL_VERSION >= 200
20672076 clSetKernelExecInfo_ExpectAndReturn (make_kernel (0 ),
@@ -2075,6 +2084,20 @@ void testKernelSetSVMPointersEmpty(void)
20752084#endif
20762085}
20772086
2087+ void testKernelSetSVMPointersEmptyArray (void )
2088+ {
2089+ #if CL_HPP_TARGET_OPENCL_VERSION >= 200
2090+ clSetKernelExecInfo_ExpectAndReturn (make_kernel (0 ),
2091+ CL_KERNEL_EXEC_INFO_SVM_PTRS,
2092+ 0 , nullptr , CL_SUCCESS);
2093+
2094+ std::array<void *, 0 > arr;
2095+ cl_int ret = kernelPool[0 ].setSVMPointers <0 >(arr);
2096+
2097+ TEST_ASSERT_EQUAL_HEX (CL_SUCCESS, ret);
2098+ #endif
2099+ }
2100+
20782101cl_int clSetKernelExecInfo_EnableFineGrainedSystemSVM (cl_kernel kernel,
20792102 cl_kernel_exec_info param_name,
20802103 size_t param_value_size,
@@ -2227,6 +2250,118 @@ void testCopyHostToBuffer(void)
22272250* Tests for building Programs
22282251****************************************************************************/
22292252
2253+ static cl_program clCreateProgramWithSource_EmptySource (
2254+ cl_context context,
2255+ cl_uint count,
2256+ const char ** strings,
2257+ const size_t * lengths,
2258+ cl_int* errcode_ret,
2259+ int num_calls)
2260+ {
2261+ TEST_ASSERT_EQUAL (context, make_context (1 ));
2262+ TEST_ASSERT_EQUAL (count, 0 );
2263+ TEST_ASSERT_EQUAL (strings, nullptr );
2264+ TEST_ASSERT_EQUAL (lengths, nullptr );
2265+
2266+ if (errcode_ret) {
2267+ errcode_ret[0 ] = CL_INVALID_VALUE;
2268+ }
2269+
2270+ return nullptr ;
2271+ }
2272+
2273+ void testProgramCreateEmptySources (void )
2274+ {
2275+ #ifndef CL_HPP_ENABLE_EXCEPTIONS
2276+ clCreateProgramWithSource_StubWithCallback (clCreateProgramWithSource_EmptySource);
2277+ clReleaseContext_ExpectAndReturn (make_context (1 ), CL_SUCCESS);
2278+
2279+ cl::Context context (make_context (1 ));
2280+
2281+ cl::Program::Sources sources;
2282+ cl::Program program (context, sources);
2283+
2284+ TEST_ASSERT_EQUAL (nullptr , program ());
2285+ #endif
2286+ }
2287+
2288+ static cl_program clCreateProgramWithBinary_EmptyBinaries (
2289+ cl_context context,
2290+ cl_uint num_devices,
2291+ const cl_device_id* device_list,
2292+ const size_t * lengths,
2293+ const unsigned char ** binaries,
2294+ cl_int* binary_status,
2295+ cl_int* errcode_ret,
2296+ int num_calls)
2297+ {
2298+ TEST_ASSERT_EQUAL (context, make_context (1 ));
2299+ TEST_ASSERT_EQUAL (num_devices, 0 );
2300+ TEST_ASSERT_EQUAL (device_list, nullptr );
2301+ TEST_ASSERT_EQUAL (lengths, nullptr );
2302+ TEST_ASSERT_EQUAL (binaries, nullptr );
2303+ TEST_ASSERT_EQUAL (binary_status, nullptr );
2304+
2305+ if (errcode_ret) {
2306+ errcode_ret[0 ] = CL_INVALID_VALUE;
2307+ }
2308+
2309+ return nullptr ;
2310+ }
2311+
2312+ void testProgramCreateEmptyBinaries (void )
2313+ {
2314+ #ifndef CL_HPP_ENABLE_EXCEPTIONS
2315+ clCreateProgramWithBinary_StubWithCallback (clCreateProgramWithBinary_EmptyBinaries);
2316+ clReleaseContext_ExpectAndReturn (make_context (1 ), CL_SUCCESS);
2317+
2318+ cl::Context context (make_context (1 ));
2319+
2320+ cl::vector<cl::Device> devices;
2321+ cl::Program::Binaries binaries;
2322+ cl::Program program (context, devices, binaries);
2323+
2324+ TEST_ASSERT_EQUAL (nullptr , program ());
2325+ #endif
2326+ }
2327+
2328+ static cl_program clCreateProgramWithBuiltInKernels_EmptyDevices (
2329+ cl_context context,
2330+ cl_uint num_devices,
2331+ const cl_device_id* device_list,
2332+ const char * kernel_names,
2333+ cl_int* errcode_ret,
2334+ int num_calls)
2335+ {
2336+ TEST_ASSERT_EQUAL (context, make_context (1 ));
2337+ TEST_ASSERT_EQUAL (num_devices, 0 );
2338+ TEST_ASSERT_EQUAL (device_list, nullptr );
2339+ TEST_ASSERT_EQUAL_STRING (kernel_names, " foo" );
2340+
2341+ if (errcode_ret) {
2342+ errcode_ret[0 ] = CL_INVALID_VALUE;
2343+ }
2344+
2345+ return nullptr ;
2346+ }
2347+
2348+ void testProgramCreateBuiltinKernelsEmptyDevices (void )
2349+ {
2350+ #if CL_HPP_TARGET_OPENCL_VERSION >= 120
2351+ #ifndef CL_HPP_ENABLE_EXCEPTIONS
2352+ clCreateProgramWithBuiltInKernels_StubWithCallback (clCreateProgramWithBuiltInKernels_EmptyDevices);
2353+ clReleaseContext_ExpectAndReturn (make_context (1 ), CL_SUCCESS);
2354+
2355+ cl::Context context (make_context (1 ));
2356+
2357+ cl::vector<cl::Device> devices;
2358+ cl::Program program (context, devices, " foo" );
2359+
2360+ TEST_ASSERT_EQUAL (nullptr , program ());
2361+ #endif
2362+ #endif
2363+ }
2364+
22302365static cl_int clGetDeviceInfo_testGetBuildInfo (
22312366 cl_device_id device,
22322367 cl_device_info param_name,
0 commit comments