summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@intel.com>2015-04-14 09:53:54 +0800
committerZhigang Gong <zhigang.gong@intel.com>2015-04-14 12:42:58 +0800
commit73a5d9b249f19123ccc4b5a77b5eac61c1ce5a60 (patch)
treea3de63d164edafe6e59795f58f26f8a51ab89e4f
parent0550850807160bcb7075c69d34177c324cd78343 (diff)
downloadbeignet-73a5d9b249f19123ccc4b5a77b5eac61c1ce5a60.tar.gz
utests: don't continue to run any case when fail to initialize device.
Signed-off-by: Zhigang Gong <zhigang.gong@intel.com> Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
-rw-r--r--utests/utest_run.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/utests/utest_run.cpp b/utests/utest_run.cpp
index d797c098..3cc1b6cf 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();
}