From fca2298d7233519848ba6328cf79cfb564f9b02c Mon Sep 17 00:00:00 2001 From: Christian Kern Date: Mon, 30 Mar 2015 16:26:36 +0200 Subject: [PATCH] Only run opencl tests if opencl is installed. Otherwise skip those tests. --- doc/examples/main.cc | 10 +++++++++- mtapi_opencl_c/test/main.cc | 13 +++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/doc/examples/main.cc b/doc/examples/main.cc index 54414bf..519121f 100644 --- a/doc/examples/main.cc +++ b/doc/examples/main.cc @@ -26,6 +26,7 @@ #include #include +#include "../../mtapi_opencl_c/src/embb_mtapi_opencl_runtimelinker.h" void RunMTAPI_C(); void RunMTAPI_C_Plugin(); @@ -67,7 +68,14 @@ int main() { std::cout << "RunMTAPI_C_Network() ... done" << std::endl; std::cout << "RunMTAPI_C_OpenCL() ..." << std::endl; - RunMTAPI_C_OpenCL(); + if (embb_mtapi_opencl_link_at_runtime() != 0) { + RunMTAPI_C_OpenCL(); + } + else { + ::std::cout << + "! Skipping OpenCL tests, as OpenCL is not installed on your system." << + ::std::endl; + } std::cout << "RunMTAPI_C_OpenCL() ... done" << std::endl; std::cout << "RunMTAPI_CPP() ..." << std::endl; diff --git a/mtapi_opencl_c/test/main.cc b/mtapi_opencl_c/test/main.cc index 0888cac..5ab6423 100644 --- a/mtapi_opencl_c/test/main.cc +++ b/mtapi_opencl_c/test/main.cc @@ -29,8 +29,17 @@ #include #include +#include + PT_MAIN("MTAPI OPENCL") { - PT_RUN(LinkerTest); - PT_RUN(TaskTest); + if ( embb_mtapi_opencl_link_at_runtime() != 0 ) { + PT_RUN(LinkerTest); + PT_RUN(TaskTest); + } + else { + ::std::cout << + "! Skipping OpenCL tests, as OpenCL is not installed on your system." << + ::std::endl; + } } -- libgit2 0.26.0