Implement negative tests for cl_device_id API functions (#2495)

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
Co-authored-by: Chetankumar Mistry <chetan.mistry@arm.com>
This commit is contained in:
Michael Rizkalla
2025-12-02 17:34:45 +00:00
committed by GitHub
parent 0c064ac017
commit 011caecb57
6 changed files with 607 additions and 2 deletions

View File

@@ -40,9 +40,20 @@ REGISTER_TEST(negative_get_platform_info)
{
cl_platform_id platform = getPlatformFromDevice(device);
cl_int err(CL_SUCCESS);
for (auto invalid_platform : get_invalid_objects<cl_platform_id>(device))
{
err = clGetPlatformInfo(invalid_platform, CL_PLATFORM_VERSION,
sizeof(char*), nullptr, nullptr);
test_failure_error_ret(err, CL_INVALID_PLATFORM,
"clGetPlatformInfo should return "
"CL_INVALID_PLATFORM when: \"platform "
"is not a valid platform\"",
TEST_FAIL);
}
constexpr cl_platform_info INVALID_PARAM_VALUE = 0;
cl_int err =
clGetPlatformInfo(platform, INVALID_PARAM_VALUE, 0, nullptr, nullptr);
err = clGetPlatformInfo(platform, INVALID_PARAM_VALUE, 0, nullptr, nullptr);
test_failure_error_ret(
err, CL_INVALID_VALUE,
"clGetPlatformInfo should return CL_INVALID_VALUE when: \"param_name "