Utest: fix random assert in function cl_kernel_link.

Submitted by Yang, Rong R on Oct. 20, 2015, 7:42 a.m.

Details

Message ID 1445326951-8466-1-git-send-email-rong.r.yang@intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Yang, Rong R Oct. 20, 2015, 7:42 a.m.
err is not used, should use status in function cl_kernel_compile and cl_kernel_link.

Signed-off-by: Yang Rong <rong.r.yang@intel.com>
---
 utests/utest_helper.cpp | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index 664046c..df645a3 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -293,7 +293,6 @@  cl_kernel_compile(const char *file_name, const char *kernel_name, const char * c
   char *ker_path = NULL;
   cl_int status = CL_SUCCESS;
   static const char *prevFileName = NULL;
-  cl_int err;
 
   /* Load the program and build it */
   if (!program || (program && (!prevFileName || strcmp(prevFileName, file_name)))) {
@@ -321,7 +320,7 @@  cl_kernel_compile(const char *file_name, const char *kernel_name, const char * c
                                 NULL,
                                 NULL,
                                 NULL, NULL);
-   OCL_ASSERT(err==CL_SUCCESS);
+   OCL_ASSERT(status == CL_SUCCESS);
 
   }
 
@@ -341,7 +340,6 @@  cl_kernel_link(const char *file_name, const char *kernel_name, const char * link
   char *ker_path = NULL;
   cl_int status = CL_SUCCESS;
   static const char *prevFileName = NULL;
-  cl_int err;
 
   /* Load the program and build it */
   if (!program || (program && (!prevFileName || strcmp(prevFileName, file_name)))) {
@@ -369,11 +367,11 @@  cl_kernel_link(const char *file_name, const char *kernel_name, const char * link
                                 NULL,
                                 NULL,
                                 NULL, NULL);
-   OCL_ASSERT(err==CL_SUCCESS);
-  cl_program input_programs[1] = {program};
-  program = clLinkProgram(ctx, 1, &device, link_opt, 1, input_programs, NULL, NULL, &err);
-  OCL_ASSERT(program != NULL);
-  OCL_ASSERT(err == CL_SUCCESS);
+    OCL_ASSERT(status==CL_SUCCESS);
+    cl_program input_programs[1] = {program};
+    program = clLinkProgram(ctx, 1, &device, link_opt, 1, input_programs, NULL, NULL, &status);
+    OCL_ASSERT(program != NULL);
+    OCL_ASSERT(status == CL_SUCCESS);
   }
   
   /* Create a kernel from the program */

Comments

Lgtm

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

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

> Yang Rong

> Sent: Tuesday, October 20, 2015 3:43 PM

> To: beignet@lists.freedesktop.org

> Cc: Yang, Rong R

> Subject: [Beignet] [PATCH] Utest: fix random assert in function cl_kernel_link.

> 

> err is not used, should use status in function cl_kernel_compile and

> cl_kernel_link.

> 

> Signed-off-by: Yang Rong <rong.r.yang@intel.com>

> ---

>  utests/utest_helper.cpp | 14 ++++++--------

>  1 file changed, 6 insertions(+), 8 deletions(-)

> 

> diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp

> index 664046c..df645a3 100644

> --- a/utests/utest_helper.cpp

> +++ b/utests/utest_helper.cpp

> @@ -293,7 +293,6 @@ cl_kernel_compile(const char *file_name, const char

> *kernel_name, const char * c

>    char *ker_path = NULL;

>    cl_int status = CL_SUCCESS;

>    static const char *prevFileName = NULL;

> -  cl_int err;

> 

>    /* Load the program and build it */

>    if (!program || (program && (!prevFileName || strcmp(prevFileName,

> file_name)))) {

> @@ -321,7 +320,7 @@ cl_kernel_compile(const char *file_name, const char

> *kernel_name, const char * c

>                                  NULL,

>                                  NULL,

>                                  NULL, NULL);

> -   OCL_ASSERT(err==CL_SUCCESS);

> +   OCL_ASSERT(status == CL_SUCCESS);

> 

>    }

> 

> @@ -341,7 +340,6 @@ cl_kernel_link(const char *file_name, const char

> *kernel_name, const char * link

>    char *ker_path = NULL;

>    cl_int status = CL_SUCCESS;

>    static const char *prevFileName = NULL;

> -  cl_int err;

> 

>    /* Load the program and build it */

>    if (!program || (program && (!prevFileName || strcmp(prevFileName,

> file_name)))) {

> @@ -369,11 +367,11 @@ cl_kernel_link(const char *file_name, const char

> *kernel_name, const char * link

>                                  NULL,

>                                  NULL,

>                                  NULL, NULL);

> -   OCL_ASSERT(err==CL_SUCCESS);

> -  cl_program input_programs[1] = {program};

> -  program = clLinkProgram(ctx, 1, &device, link_opt, 1, input_programs, NULL,

> NULL, &err);

> -  OCL_ASSERT(program != NULL);

> -  OCL_ASSERT(err == CL_SUCCESS);

> +    OCL_ASSERT(status==CL_SUCCESS);

> +    cl_program input_programs[1] = {program};

> +    program = clLinkProgram(ctx, 1, &device, link_opt, 1, input_programs, NULL,

> NULL, &status);

> +    OCL_ASSERT(program != NULL);

> +    OCL_ASSERT(status == CL_SUCCESS);

>    }

> 

>    /* Create a kernel from the program */

> --

> 1.9.1

> 

> _______________________________________________

> Beignet mailing list

> Beignet@lists.freedesktop.org

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