]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # --------------------------------------------------------------------------- |
2 | # Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com> | |
3 | # | |
4 | # Distributed under the Boost Software License, Version 1.0 | |
5 | # See accompanying file LICENSE_1_0.txt or copy at | |
6 | # http://www.boost.org/LICENSE_1_0.txt | |
7 | # | |
8 | # --------------------------------------------------------------------------- | |
9 | ||
10 | include_directories(../include) | |
11 | ||
12 | set(BOOST_COMPONENTS unit_test_framework) | |
13 | ||
14 | if(${BOOST_COMPUTE_USE_CPP11}) | |
15 | # allow tests to use C++11 features | |
16 | add_definitions(-DBOOST_COMPUTE_USE_CPP11) | |
17 | endif() | |
18 | ||
19 | if (${BOOST_COMPUTE_USE_OFFLINE_CACHE}) | |
20 | set(BOOST_COMPONENTS ${BOOST_COMPONENTS} system filesystem) | |
21 | add_definitions(-DBOOST_COMPUTE_USE_OFFLINE_CACHE) | |
22 | endif() | |
23 | ||
24 | if(${BOOST_COMPUTE_THREAD_SAFE} AND NOT ${BOOST_COMPUTE_USE_CPP11}) | |
25 | set(BOOST_COMPONENTS ${BOOST_COMPONENTS} system thread) | |
26 | endif() | |
27 | ||
28 | if(MSVC AND BOOST_COMPONENTS) | |
29 | set(BOOST_COMPONENTS ${BOOST_COMPONENTS} chrono) | |
30 | endif() | |
31 | ||
32 | if(BOOST_COMPONENTS) | |
33 | list(REMOVE_DUPLICATES BOOST_COMPONENTS) | |
34 | endif() | |
35 | find_package(Boost 1.54 REQUIRED COMPONENTS ${BOOST_COMPONENTS}) | |
36 | ||
37 | if(NOT MSVC) | |
38 | add_definitions(-DBOOST_TEST_DYN_LINK) | |
39 | else() | |
40 | if(MSVC AND ${BOOST_COMPUTE_BOOST_ALL_DYN_LINK}) | |
41 | add_definitions(-DBOOST_TEST_DYN_LINK) | |
42 | endif() | |
43 | endif() | |
44 | ||
45 | # enable automatic kernel compilation error messages for tests | |
46 | add_definitions(-DBOOST_COMPUTE_DEBUG_KERNEL_COMPILATION) | |
47 | ||
48 | # enable code coverage generation (only with GCC for now) | |
49 | if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | |
50 | add_definitions(-fprofile-arcs -ftest-coverage) | |
51 | endif() | |
52 | ||
b32b8144 FG |
53 | # add path to test data dir |
54 | add_definitions(-DBOOST_COMPUTE_TEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/data") | |
55 | ||
7c673cae FG |
56 | function(add_compute_test TEST_NAME TEST_SOURCE) |
57 | get_filename_component(TEST_TARGET ${TEST_SOURCE} NAME_WE) | |
58 | add_executable(${TEST_TARGET} ${TEST_SOURCE}) | |
59 | target_link_libraries(${TEST_TARGET} | |
60 | ${OpenCL_LIBRARIES} | |
61 | ${Boost_LIBRARIES} | |
62 | ) | |
63 | ||
64 | # link with coverage library | |
65 | if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | |
66 | target_link_libraries(${TEST_TARGET} -fprofile-arcs -ftest-coverage) | |
67 | endif() | |
68 | ||
69 | add_test(${TEST_NAME} ${TEST_TARGET}) | |
70 | endfunction() | |
71 | ||
72 | add_compute_test("core.buffer" test_buffer.cpp) | |
73 | add_compute_test("core.closure" test_closure.cpp) | |
74 | add_compute_test("core.command_queue" test_command_queue.cpp) | |
75 | add_compute_test("core.context" test_context.cpp) | |
76 | add_compute_test("core.device" test_device.cpp) | |
77 | add_compute_test("core.event" test_event.cpp) | |
78 | add_compute_test("core.function" test_function.cpp) | |
79 | add_compute_test("core.kernel" test_kernel.cpp) | |
80 | add_compute_test("core.pipe" test_pipe.cpp) | |
81 | add_compute_test("core.platform" test_platform.cpp) | |
82 | add_compute_test("core.program" test_program.cpp) | |
83 | add_compute_test("core.system" test_system.cpp) | |
84 | add_compute_test("core.type_traits" test_type_traits.cpp) | |
85 | add_compute_test("core.user_event" test_user_event.cpp) | |
86 | ||
87 | add_compute_test("utility.extents" test_extents.cpp) | |
88 | add_compute_test("utility.invoke" test_invoke.cpp) | |
89 | add_compute_test("utility.program_cache" test_program_cache.cpp) | |
90 | add_compute_test("utility.wait_list" test_wait_list.cpp) | |
91 | ||
92 | add_compute_test("algorithm.accumulate" test_accumulate.cpp) | |
93 | add_compute_test("algorithm.adjacent_difference" test_adjacent_difference.cpp) | |
94 | add_compute_test("algorithm.adjacent_find" test_adjacent_find.cpp) | |
95 | add_compute_test("algorithm.any_all_none_of" test_any_all_none_of.cpp) | |
96 | add_compute_test("algorithm.binary_search" test_binary_search.cpp) | |
97 | add_compute_test("algorithm.copy" test_copy.cpp) | |
98 | add_compute_test("algorithm.copy_type_mismatch" test_copy_type_mismatch.cpp) | |
99 | add_compute_test("algorithm.copy_if" test_copy_if.cpp) | |
100 | add_compute_test("algorithm.count" test_count.cpp) | |
101 | add_compute_test("algorithm.equal" test_equal.cpp) | |
102 | add_compute_test("algorithm.equal_range" test_equal_range.cpp) | |
103 | add_compute_test("algorithm.extrema" test_extrema.cpp) | |
104 | add_compute_test("algorithm.fill" test_fill.cpp) | |
105 | add_compute_test("algorithm.find" test_find.cpp) | |
106 | add_compute_test("algorithm.find_end" test_find_end.cpp) | |
107 | add_compute_test("algorithm.for_each" test_for_each.cpp) | |
108 | add_compute_test("algorithm.gather" test_gather.cpp) | |
109 | add_compute_test("algorithm.generate" test_generate.cpp) | |
110 | add_compute_test("algorithm.includes" test_includes.cpp) | |
111 | add_compute_test("algorithm.inner_product" test_inner_product.cpp) | |
112 | add_compute_test("algorithm.inplace_merge" test_inplace_merge.cpp) | |
113 | add_compute_test("algorithm.inplace_reduce" test_inplace_reduce.cpp) | |
114 | add_compute_test("algorithm.insertion_sort" test_insertion_sort.cpp) | |
115 | add_compute_test("algorithm.iota" test_iota.cpp) | |
116 | add_compute_test("algorithm.is_permutation" test_is_permutation.cpp) | |
117 | add_compute_test("algorithm.is_sorted" test_is_sorted.cpp) | |
118 | add_compute_test("algorithm.merge_sort_gpu" test_merge_sort_gpu.cpp) | |
119 | add_compute_test("algorithm.merge" test_merge.cpp) | |
120 | add_compute_test("algorithm.mismatch" test_mismatch.cpp) | |
121 | add_compute_test("algorithm.next_permutation" test_next_permutation.cpp) | |
122 | add_compute_test("algorithm.nth_element" test_nth_element.cpp) | |
123 | add_compute_test("algorithm.partial_sum" test_partial_sum.cpp) | |
124 | add_compute_test("algorithm.partition" test_partition.cpp) | |
125 | add_compute_test("algorithm.partition_point" test_partition_point.cpp) | |
126 | add_compute_test("algorithm.prev_permutation" test_prev_permutation.cpp) | |
127 | add_compute_test("algorithm.radix_sort" test_radix_sort.cpp) | |
128 | add_compute_test("algorithm.radix_sort_by_key" test_radix_sort_by_key.cpp) | |
129 | add_compute_test("algorithm.random_fill" test_random_fill.cpp) | |
130 | add_compute_test("algorithm.random_shuffle" test_random_shuffle.cpp) | |
131 | add_compute_test("algorithm.reduce" test_reduce.cpp) | |
132 | add_compute_test("algorithm.reduce_by_key" test_reduce_by_key.cpp) | |
133 | add_compute_test("algorithm.remove" test_remove.cpp) | |
134 | add_compute_test("algorithm.replace" test_replace.cpp) | |
135 | add_compute_test("algorithm.reverse" test_reverse.cpp) | |
136 | add_compute_test("algorithm.rotate" test_rotate.cpp) | |
137 | add_compute_test("algorithm.rotate_copy" test_rotate_copy.cpp) | |
138 | add_compute_test("algorithm.scan" test_scan.cpp) | |
139 | add_compute_test("algorithm.scatter" test_scatter.cpp) | |
140 | add_compute_test("algorithm.scatter_if" test_scatter_if.cpp) | |
141 | add_compute_test("algorithm.search" test_search.cpp) | |
142 | add_compute_test("algorithm.search_n" test_search_n.cpp) | |
143 | add_compute_test("algorithm.set_difference" test_set_difference.cpp) | |
144 | add_compute_test("algorithm.set_intersection" test_set_intersection.cpp) | |
145 | add_compute_test("algorithm.set_symmetric_difference" test_set_symmetric_difference.cpp) | |
146 | add_compute_test("algorithm.set_union" test_set_union.cpp) | |
147 | add_compute_test("algorithm.sort" test_sort.cpp) | |
148 | add_compute_test("algorithm.sort_by_key" test_sort_by_key.cpp) | |
149 | add_compute_test("algorithm.stable_partition" test_stable_partition.cpp) | |
150 | add_compute_test("algorithm.stable_sort" test_stable_sort.cpp) | |
151 | add_compute_test("algorithm.stable_sort_by_key" test_stable_sort_by_key.cpp) | |
152 | add_compute_test("algorithm.transform" test_transform.cpp) | |
153 | add_compute_test("algorithm.transform_if" test_transform_if.cpp) | |
154 | add_compute_test("algorithm.transform_reduce" test_transform_reduce.cpp) | |
155 | add_compute_test("algorithm.unique" test_unique.cpp) | |
156 | add_compute_test("algorithm.unique_copy" test_unique_copy.cpp) | |
157 | add_compute_test("algorithm.lexicographical_compare" test_lexicographical_compare.cpp) | |
158 | ||
159 | add_compute_test("allocator.buffer_allocator" test_buffer_allocator.cpp) | |
160 | add_compute_test("allocator.pinned_allocator" test_pinned_allocator.cpp) | |
161 | ||
162 | add_compute_test("async.wait" test_async_wait.cpp) | |
163 | add_compute_test("async.wait_guard" test_async_wait_guard.cpp) | |
164 | ||
165 | add_compute_test("container.array" test_array.cpp) | |
166 | add_compute_test("container.dynamic_bitset" test_dynamic_bitset.cpp) | |
167 | add_compute_test("container.flat_map" test_flat_map.cpp) | |
168 | add_compute_test("container.flat_set" test_flat_set.cpp) | |
169 | add_compute_test("container.mapped_view" test_mapped_view.cpp) | |
170 | add_compute_test("container.stack" test_stack.cpp) | |
171 | add_compute_test("container.string" test_string.cpp) | |
172 | add_compute_test("container.valarray" test_valarray.cpp) | |
173 | add_compute_test("container.vector" test_vector.cpp) | |
174 | ||
175 | add_compute_test("exception.context_error" test_context_error.cpp) | |
176 | add_compute_test("exception.no_device_found" test_no_device_found.cpp) | |
177 | add_compute_test("exception.opencl_error" test_opencl_error.cpp) | |
178 | add_compute_test("exception.unsupported_extension" test_unsupported_extension.cpp) | |
179 | ||
180 | add_compute_test("functional.as" test_functional_as.cpp) | |
181 | add_compute_test("functional.bind" test_functional_bind.cpp) | |
182 | add_compute_test("functional.convert" test_functional_convert.cpp) | |
183 | add_compute_test("functional.get" test_functional_get.cpp) | |
184 | add_compute_test("functional.hash" test_functional_hash.cpp) | |
185 | add_compute_test("functional.identity" test_functional_identity.cpp) | |
186 | add_compute_test("functional.popcount" test_functional_popcount.cpp) | |
187 | add_compute_test("functional.unpack" test_functional_unpack.cpp) | |
188 | ||
189 | add_compute_test("image.image1d" test_image1d.cpp) | |
190 | add_compute_test("image.image2d" test_image2d.cpp) | |
191 | add_compute_test("image.image3d" test_image3d.cpp) | |
192 | add_compute_test("image.image_sampler" test_image_sampler.cpp) | |
193 | ||
194 | add_compute_test("iterator.buffer_iterator" test_buffer_iterator.cpp) | |
195 | add_compute_test("iterator.constant_iterator" test_constant_iterator.cpp) | |
196 | add_compute_test("iterator.counting_iterator" test_counting_iterator.cpp) | |
197 | add_compute_test("iterator.discard_iterator" test_discard_iterator.cpp) | |
198 | add_compute_test("iterator.function_input_iterator" test_function_input_iterator.cpp) | |
199 | add_compute_test("iterator.permutation_iterator" test_permutation_iterator.cpp) | |
200 | add_compute_test("iterator.strided_iterator" test_strided_iterator.cpp) | |
201 | add_compute_test("iterator.transform_iterator" test_transform_iterator.cpp) | |
202 | add_compute_test("iterator.zip_iterator" test_zip_iterator.cpp) | |
203 | ||
204 | add_compute_test("memory.local_buffer" test_local_buffer.cpp) | |
205 | add_compute_test("memory.svm_ptr" test_svm_ptr.cpp) | |
206 | ||
207 | add_compute_test("random.bernoulli_distribution" test_bernoulli_distribution.cpp) | |
208 | add_compute_test("random.discrete_distribution" test_discrete_distribution.cpp) | |
209 | add_compute_test("random.linear_congruential_engine" test_linear_congruential_engine.cpp) | |
210 | add_compute_test("random.mersenne_twister_engine" test_mersenne_twister_engine.cpp) | |
211 | add_compute_test("random.threefry_engine" test_threefry_engine.cpp) | |
212 | add_compute_test("random.normal_distribution" test_normal_distribution.cpp) | |
213 | add_compute_test("random.uniform_int_distribution" test_uniform_int_distribution.cpp) | |
214 | add_compute_test("random.uniform_real_distribution" test_uniform_real_distribution.cpp) | |
215 | ||
216 | add_compute_test("types.fundamental" test_types.cpp) | |
217 | add_compute_test("types.complex" test_complex.cpp) | |
218 | add_compute_test("types.pair" test_pair.cpp) | |
219 | add_compute_test("types.tuple" test_tuple.cpp) | |
220 | add_compute_test("types.struct" test_struct.cpp) | |
221 | ||
222 | add_compute_test("type_traits.result_of" test_result_of.cpp) | |
223 | ||
224 | add_compute_test("experimental.clamp_range" test_clamp_range.cpp) | |
225 | add_compute_test("experimental.malloc" test_malloc.cpp) | |
226 | add_compute_test("experimental.sort_by_transform" test_sort_by_transform.cpp) | |
227 | add_compute_test("experimental.tabulate" test_tabulate.cpp) | |
228 | ||
229 | # miscellaneous tests | |
230 | add_compute_test("misc.amd_cpp_kernel_language" test_amd_cpp_kernel_language.cpp) | |
231 | add_compute_test("misc.lambda" test_lambda.cpp) | |
232 | add_compute_test("misc.user_defined_types" test_user_defined_types.cpp) | |
233 | add_compute_test("misc.literal_conversion" test_literal_conversion.cpp) | |
234 | ||
235 | # extra tests (interop tests, linkage tests, etc.) | |
236 | add_subdirectory(extra) |