[Beignet] [PATCH 2/2] utests: don't continue to run any case when fail to initialize device.

Zhigang Gong zhigang.gong at intel.com
Mon Apr 13 18:55:20 PDT 2015


Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 utests/utest_run.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/utests/utest_run.cpp b/utests/utest_run.cpp
index d797c09..3cc1b6c 100644
--- a/utests/utest_run.cpp
+++ b/utests/utest_run.cpp
@@ -58,7 +58,10 @@ int main(int argc, char *argv[])
 {
 
   int c = 0;
-  cl_ocl_init();
+  if (cl_ocl_init() != CL_SUCCESS) {
+    fprintf(stderr, "Failed to initialize cl device.\n");
+    goto clean;
+  }
 
   c = getopt_long (argc, argv, shortopts, longopts, NULL);
 
@@ -124,6 +127,7 @@ int main(int argc, char *argv[])
     }
   } while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1);
 
+clean:
   cl_ocl_destroy();
 }
 
-- 
1.9.1



More information about the Beignet mailing list