Add negative tests for context API functions (#2494)

This PR adds negative tests for the following API functions:

- clCreateContext
- clCreateContextFromType
- clRetainContext
- clReleaseContext
- clSetContextDestructorCallback

Also, define a new macro `test_object_failure_ret` to test for an
expected error code and the returned object is `NULL` as a result of a
failure.

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
This commit is contained in:
Michael Rizkalla
2026-01-13 17:43:13 +00:00
committed by GitHub
parent b460aae39d
commit 6774fc1dc3
3 changed files with 297 additions and 0 deletions

View File

@@ -120,6 +120,12 @@ static int vlog_win32(const char *format, ...);
return retValue; \
} \
}
#define test_object_failure_ret(object, errCode, expectedErrCode, msg, \
retValue) \
{ \
test_assert_error_ret(object == nullptr, msg, retValue); \
test_failure_error_ret(errCode, expectedErrCode, msg, retValue); \
}
#define print_failure_error(errCode, expectedErrCode, msg) \
log_error("ERROR: %s! (Got %s, expected %s from %s:%d)\n", msg, \
IGetErrorString(errCode), IGetErrorString(expectedErrCode), \