[Beignet] [PATCH] utests: fix test_get_arg_info fail

Pan Xiuli xiuli.pan at intel.com
Sat Sep 5 20:30:21 PDT 2015


1.The fail is caused by the newly added build-option check, now is fixed
2.The utests using kernel with no build-option at all, add to be the same with piglit and spec.
TODO:The build-option check should be done in build program part, should move the check to there.

Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
---
 src/cl_api.c            | 2 +-
 utests/get_arg_info.cpp | 2 +-
 utests/utest_helper.hpp | 5 +++++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/cl_api.c b/src/cl_api.c
index d1d7a09..894070f 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -1251,7 +1251,7 @@ cl_int clGetKernelArgInfo(cl_kernel kernel, cl_uint arg_index, cl_kernel_arg_inf
   cl_int err = CL_SUCCESS;
   CHECK_KERNEL(kernel);
 
-  if(strstr(kernel->program->build_opts,"-cl-kernel-arg-info") == NULL ) {
+  if((kernel->program->build_opts == NULL) || (strstr(kernel->program->build_opts,"-cl-kernel-arg-info") == NULL)) {
     err = CL_KERNEL_ARG_INFO_NOT_AVAILABLE;
     goto error;
   }
diff --git a/utests/get_arg_info.cpp b/utests/get_arg_info.cpp
index c1ea1ef..65b29a0 100644
--- a/utests/get_arg_info.cpp
+++ b/utests/get_arg_info.cpp
@@ -10,7 +10,7 @@ void test_get_arg_info(void)
   char name[64];
 
   // Setup kernel and buffers
-  OCL_CREATE_KERNEL("test_get_arg_info");
+  OCL_CREATE_KERNEL_OPTIONS("test_get_arg_info","-cl-kernel-arg-info");
 
   //Arg 0
   ret = clGetKernelArgInfo(kernel, 0, CL_KERNEL_ARG_ADDRESS_QUALIFIER,
diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp
index 3b17606..798fb3c 100644
--- a/utests/utest_helper.hpp
+++ b/utests/utest_helper.hpp
@@ -65,6 +65,11 @@ extern EGLSurface  eglSurface;
     OCL_CALL (cl_kernel_init, NAME".cl", NAME, SOURCE, NULL); \
   } while (0)
 
+#define OCL_CREATE_KERNEL_OPTIONS(NAME,OPTIONS) \
+  do { \
+    OCL_CALL (cl_kernel_init, NAME".cl", NAME, SOURCE, (OPTIONS)); \
+  } while (0)
+
 #define OCL_DESTROY_KERNEL_KEEP_PROGRAM(KEEP_PROGRAM) \
   do { \
     cl_kernel_destroy(!(KEEP_PROGRAM)); \
-- 
2.1.4



More information about the Beignet mailing list