Commit 03d5c849 authored by Marian Triebe's avatar Marian Triebe

Port OpenCL unit test to new framework

parent 7a0cecd5
#define CAF_SUITE opencl
#include "caf/test/unit_test.hpp"
#include <vector> #include <vector>
#include <iomanip> #include <iomanip>
#include <cassert> #include <cassert>
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include "../../unit_testing/test.hpp"
#include "caf/all.hpp" #include "caf/all.hpp"
#include "caf/opencl/spawn_cl.hpp" #include "caf/opencl/spawn_cl.hpp"
...@@ -241,8 +242,8 @@ void test_opencl() { ...@@ -241,8 +242,8 @@ void test_opencl() {
auto create_error = program::create(kernel_source_error); auto create_error = program::create(kernel_source_error);
} }
catch (const std::exception& exc) { catch (const std::exception& exc) {
CAF_PRINT(exc.what()); CAF_MESSAGE(exc.what());
CAF_CHECK_EQUAL("clBuildProgram: CL_BUILD_PROGRAM_FAILURE", exc.what()); CAF_CHECK(strcmp("clBuildProgram: CL_BUILD_PROGRAM_FAILURE", exc.what()) == 0);
} }
// test for opencl compiler flags // test for opencl compiler flags
auto prog5 = program::create(kernel_source_compiler_flag, compiler_flag); auto prog5 = program::create(kernel_source_compiler_flag, compiler_flag);
...@@ -294,12 +295,11 @@ void test_opencl() { ...@@ -294,12 +295,11 @@ void test_opencl() {
); );
} }
int main() { CAF_TEST(test_opencl) {
CAF_TEST(test_opencl);
announce<ivec>("ivec"); announce<ivec>("ivec");
matrix_type::announce(); matrix_type::announce();
test_opencl(); test_opencl();
await_all_actors_done(); await_all_actors_done();
shutdown(); shutdown();
return CAF_TEST_RESULT();
} }
cmake_minimum_required(VERSION 2.8)
project(caf_unit_tests_opencl CXX)
if (OpenCL_LIBRARIES)
add_custom_target(opencl_unit_tests)
include_directories(${LIBCAF_INCLUDE_DIRS})
macro(add_unit_test name)
add_executable(test_${name} test_${name}.cpp ../../unit_testing/test.cpp ${ARGN})
target_link_libraries(test_${name}
${LD_FLAGS}
${LIBCAF_LIBRARIES}
${PTHREAD_LIBRARIES}
${OpenCL_LIBRARIES})
add_test(${name} ${EXECUTABLE_OUTPUT_PATH}/test_${name})
add_dependencies(test_${name} all_unit_tests)
endmacro()
add_unit_test(opencl)
endif()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment