MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CLHPP / testCommandQueueFromSpecifiedContext

Function testCommandQueueFromSpecifiedContext

tests/test_openclhpp.cpp:968–1006  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

966#endif // #if CL_HPP_TARGET_OPENCL_VERSION < 200
967
968void testCommandQueueFromSpecifiedContext(void)
969{
970 cl_command_queue expected = make_command_queue(0);
971 cl_context expected_context = make_context(0);
972 cl_device_id expected_device = make_device_id(0);
973
974 int context_refcount = 1;
975 int device_refcount = 1;
976 prepare_contextRefcounts(1, &expected_context, &context_refcount);
977 prepare_deviceRefcounts(1, &expected_device, &device_refcount);
978
979 // This is the context we will pass in to test
980 cl::Context context = contextPool[0];
981
982 // Assumes the context contains the fi rst device
983 clGetContextInfo_StubWithCallback(clGetContextInfo_device);
984
985#if CL_HPP_TARGET_OPENCL_VERSION >= 200
986 clCreateCommandQueueWithProperties_StubWithCallback(clCreateCommandQueueWithProperties_testCommandQueueFromSpecifiedContext);
987#else // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
988 clCreateCommandQueue_StubWithCallback(clCreateCommandQueue_testCommandQueueFromSpecifiedContext);
989#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
990 clGetDeviceInfo_StubWithCallback(clGetDeviceInfo_platform);
991
992#if CL_HPP_TARGET_OPENCL_VERSION >= 200
993 clGetPlatformInfo_StubWithCallback(clGetPlatformInfo_version_2_0);
994#else // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
995 clGetPlatformInfo_StubWithCallback(clGetPlatformInfo_version_1_2);
996#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200
997 clReleaseCommandQueue_ExpectAndReturn(expected, CL_SUCCESS);
998
999 cl::CommandQueue queue(context);
1000 TEST_ASSERT_EQUAL_PTR(expected, queue());
1001
1002 // Context not destroyed yet
1003 TEST_ASSERT_EQUAL(2, context_refcount);
1004 // Device object destroyed at end of scope
1005 TEST_ASSERT_EQUAL(1, device_refcount);
1006}
1007
1008#if CL_HPP_TARGET_OPENCL_VERSION >= 310
1009static cl_int clGetKernelSuggestedLocalWorkSize_stub(

Callers

nothing calls this directly

Calls 3

make_command_queueFunction · 0.85
make_contextFunction · 0.85
make_device_idFunction · 0.85

Tested by

no test coverage detected