utests: fix test_get_arg_info fail

Submitted by Pan Xiuli on Sept. 6, 2015, 3:30 a.m.

Details

Message ID 1441510221-16983-1-git-send-email-xiuli.pan@intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Pan Xiuli Sept. 6, 2015, 3:30 a.m.
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@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(-)

Patch hide | download patch | download mbox

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)); \

Comments

Junyan also send a patch for it, because he separate to two patch, make it clearly, so pushed his patch, thanks.

> -----Original Message-----

> From: Beignet [mailto:beignet-bounces@lists.freedesktop.org] On Behalf Of

> Pan Xiuli

> Sent: Sunday, September 6, 2015 11:30

> To: beignet@lists.freedesktop.org

> Cc: Pan, Xiuli

> Subject: [Beignet] [PATCH] utests: fix test_get_arg_info fail

> 

> 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@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

> 

> _______________________________________________

> Beignet mailing list

> Beignet@lists.freedesktop.org

> http://lists.freedesktop.org/mailman/listinfo/beignet