Skip to content

Commit

Permalink
Added review corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-goras-mobica committed Aug 8, 2024
1 parent 1681bd0 commit 33310ac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
25 changes: 18 additions & 7 deletions test_conformance/api/test_create_context_from_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,7 @@ int test_create_context_from_type_device_type_all(cl_device_id deviceID,
sizeof(cl_uint), &num_devices, nullptr);
test_error(error, "clGetContextInfo CL_CONTEXT_NUM_DEVICES failed\n");

std::vector<cl_device_id> devices(num_devices);
error = clGetContextInfo(context_to_test, CL_CONTEXT_DEVICES,
num_devices * sizeof(cl_device_id), devices.data(),
nullptr);
test_error(error, "clGetContextInfo CL_CONTEXT_DEVICES failed\n");

test_assert_error(devices.size() >= 1,
test_assert_error(num_devices >= 1,
"Context must contain at least one device\n");

return 0;
Expand Down Expand Up @@ -225,5 +219,22 @@ int test_create_context_from_type_device_type_default(cl_device_id deviceID,
test_assert_error(devices.size() == 1,
"Context must contain exactly one device\n");

cl_uint num_platform_devices;

error = clGetDeviceIDs(platform, CL_DEVICE_TYPE_DEFAULT, 0, NULL,
&num_platform_devices);
test_error(error, "clGetDeviceIDs failed.\n");
test_assert_error(num_platform_devices == 1,
"clGetDeviceIDs must return exactly one device\n");

std::vector<cl_device_id> platform_devices(num_platform_devices);
error = clGetDeviceIDs(platform, CL_DEVICE_TYPE_DEFAULT,
num_platform_devices, platform_devices.data(), NULL);
test_error(error, "clGetDeviceIDs failed.\n");

test_assert_error(platform_devices[0] == devices[0],
"device in the context must be equivalent to device "
"returned by clGetDeviceIDs\n");

return 0;
}
2 changes: 1 addition & 1 deletion test_conformance/api/test_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
test_error(err, "clGetDeviceIDs failed.\n");
if (num_devices != 1)
{
log_error("clGetDeviceIDs must return exacly one device\n");
log_error("clGetDeviceIDs must return exactly one device\n");
total_errors++;
}
}
Expand Down

0 comments on commit 33310ac

Please sign in to comment.