summaryrefslogtreecommitdiff
path: root/utests/get_cl_info.cpp
diff options
context:
space:
mode:
authorGuo Yejun <yejun.guo@intel.com>2016-07-26 07:59:42 +0800
committerYang Rong <rong.r.yang@intel.com>2016-08-03 18:20:22 +0800
commit267c55e4a756e3a1fc89e0539fb99c775448e60e (patch)
tree35684303cb60c8a1b81c819241cb610fb94df7b9 /utests/get_cl_info.cpp
parentc202faf6d2d82d7783c226cdea9732f3a959edc1 (diff)
utests: fix issue of CL_PROGRAM_BINARY_SIZES query
the return type of CL_PROGRAM_BINARY_SIZES query is unsigned char*[], and param_value_size must be >= size of the return type, see spec 1.2 section 5.6.7 (P151) Signed-off-by: Guo Yejun <yejun.guo@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'utests/get_cl_info.cpp')
-rw-r--r--utests/get_cl_info.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/utests/get_cl_info.cpp b/utests/get_cl_info.cpp
index bdd7e0c0..afdf8cae 100644
--- a/utests/get_cl_info.cpp
+++ b/utests/get_cl_info.cpp
@@ -78,9 +78,11 @@ struct Info_Result<char **> {
int *elt_size;
int size;
typedef char** type_value;
+ int array_size;
Info_Result(char **other, int *sz, int elt_num) {
- size = elt_num;
+ array_size = elt_num;
+ size = elt_num * sizeof(char**);
ret = (char **)malloc(elt_num * sizeof(char *));
memset(ret, 0, (elt_num * sizeof(char *)));
@@ -106,7 +108,7 @@ struct Info_Result<char **> {
~Info_Result(void) {
int i = 0;
- for (; i < size; i++) {
+ for (; i < array_size; i++) {
if (refer[i])
free(refer[i]);
free(ret[i]);
@@ -122,7 +124,7 @@ struct Info_Result<char **> {
bool check_result (void) {
int i = 0;
- for (; i < size; i++) {
+ for (; i < array_size; i++) {
if (refer[i] && ::memcmp(ret[i], refer[i], elt_size[i]))
return false;
}
@@ -222,7 +224,7 @@ void get_program_info(void)
expect_value = NO_STANDARD_REF;
maps.insert(make_pair(CL_PROGRAM_BINARY_SIZES,
(void *)(new Info_Result<size_t>((size_t)expect_value))));
- sz = 4096; //big enough?
+ sz = 8192; //big enough?
expect_source = NULL;
maps.insert(make_pair(CL_PROGRAM_BINARIES,
(void *)(new Info_Result<char **>(&expect_source, &sz, 1))));