summaryrefslogtreecommitdiffstats
path: root/src/test/common/CMakeLists.txt
blob: 11e111115d7f9aa8b7e329709d6987506282f9ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
if(NOT WIN32)
# get_command_descriptions
# libmon not currently available on Windows.
add_executable(get_command_descriptions
  get_command_descriptions.cc
  $<TARGET_OBJECTS:common_texttable_obj>
  )
target_link_libraries(get_command_descriptions
  mon
  global
  ${EXTRALIBS}
  ${BLKID_LIBRARIES}
  ${CMAKE_DL_LIBS}
  )
endif(NOT WIN32)

# Though FreeBSD has blkdev support, the unittests' mocks only work in Linux
if(HAVE_BLKID AND LINUX)
  # unittest_blkdev
  add_executable(unittest_blkdev
    test_blkdev.cc)
  add_ceph_unittest(unittest_blkdev)
  target_link_libraries(unittest_blkdev global ${BLKID_LIBRARIES})
endif()

# unittest_lockdep
if(WITH_CEPH_DEBUG_MUTEX)
  add_executable(unittest_lockdep
    test_lockdep.cc)
  add_ceph_unittest(unittest_lockdep)
  target_link_libraries(unittest_lockdep ceph-common)
endif()

# unittest_counter
add_executable(unittest_counter
  test_counter.cc)
add_ceph_unittest(unittest_counter)
target_link_libraries(unittest_counter ceph-common)

# FreeBSD only has shims to support NUMA, no functional code.
if(LINUX)
# unittest_numa
add_executable(unittest_numa
  test_numa.cc
  )
add_ceph_unittest(unittest_numa)
target_link_libraries(unittest_numa ceph-common)
endif()

# unittest_bloom_filter
add_executable(unittest_bloom_filter
  test_bloom_filter.cc
  )
add_ceph_unittest(unittest_bloom_filter)
target_link_libraries(unittest_bloom_filter ceph-common)

# unittest_lruset
add_executable(unittest_lruset
  test_lruset.cc
  )
add_ceph_unittest(unittest_lruset)
target_link_libraries(unittest_lruset)

# unittest_histogram
add_executable(unittest_histogram
  histogram.cc
  )
add_ceph_unittest(unittest_histogram)
target_link_libraries(unittest_histogram ceph-common)

# unittest_prioritized_queue
add_executable(unittest_prioritized_queue
  test_prioritized_queue.cc
  )
target_link_libraries(unittest_prioritized_queue ceph-common)
add_ceph_unittest(unittest_prioritized_queue)

# unittest_str_map
add_executable(unittest_str_map
  test_str_map.cc
  )
add_ceph_unittest(unittest_str_map)
target_link_libraries(unittest_str_map ceph-common)

# unittest_json_formattable
add_executable(unittest_json_formattable
  test_json_formattable.cc
  )
add_ceph_unittest(unittest_json_formattable ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_json_formattable)
# add_dependencies(unittest_json_formattable ceph-common)
target_link_libraries(unittest_json_formattable ceph-common global ${BLKID_LIBRARIES})

# unittest_json_formatter
add_executable(unittest_json_formatter
  test_json_formatter.cc
  )
add_ceph_unittest(unittest_json_formatter ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_json_formatter)
# add_dependencies(unittest_json_formatter ceph-common)
target_link_libraries(unittest_json_formatter ceph-common global ${BLKID_LIBRARIES})

# unittest_sharedptr_registry
add_executable(unittest_sharedptr_registry
  test_sharedptr_registry.cc
  $<TARGET_OBJECTS:unit-main>
  )
add_ceph_unittest(unittest_sharedptr_registry)
target_link_libraries(unittest_sharedptr_registry global)

# unittest_shared_cache
add_executable(unittest_shared_cache
  test_shared_cache.cc
  $<TARGET_OBJECTS:unit-main>
  )
add_ceph_unittest(unittest_shared_cache)
target_link_libraries(unittest_shared_cache global)

# unittest_sloppy_crc_map
add_executable(unittest_sloppy_crc_map
  test_sloppy_crc_map.cc
  )
add_ceph_unittest(unittest_sloppy_crc_map)
target_link_libraries(unittest_sloppy_crc_map global)

# unittest_time
add_executable(unittest_time
  test_time.cc
  ${CMAKE_SOURCE_DIR}/src/common/ceph_time.cc
  )
add_ceph_unittest(unittest_time)
target_link_libraries(unittest_time ceph-common)

# unittest_util
add_executable(unittest_util
  test_util.cc
  ${CMAKE_SOURCE_DIR}/src/common/util.cc
  )
add_ceph_unittest(unittest_util)
target_link_libraries(unittest_util global StdFilesystem::filesystem)

# unittest_random
add_executable(unittest_random
  test_random.cc
  )
add_ceph_unittest(unittest_random)
target_link_libraries(unittest_random Boost::random)

# unittest_throttle
add_executable(unittest_throttle
  Throttle.cc
  $<TARGET_OBJECTS:unit-main>
  )
add_ceph_unittest(unittest_throttle PARALLEL)
target_link_libraries(unittest_throttle global) 

# unittest_lru
add_executable(unittest_lru
  test_lru.cc
  )
add_ceph_unittest(unittest_lru)
target_link_libraries(unittest_lru ceph-common)

# unittest_intrusive_lru
add_executable(unittest_intrusive_lru
  test_intrusive_lru.cc
  )
add_ceph_unittest(unittest_intrusive_lru)
target_link_libraries(unittest_intrusive_lru ceph-common)

# unittest_crc32c
add_executable(unittest_crc32c
  test_crc32c.cc
  )
add_ceph_unittest(unittest_crc32c)
target_link_libraries(unittest_crc32c ceph-common)

# unittest_config
add_executable(unittest_config
  test_config.cc
  test_hostname.cc
  )
add_ceph_unittest(unittest_config)
target_link_libraries(unittest_config ceph-common)

# unittest_context
add_executable(unittest_context
  test_context.cc
  )
add_ceph_unittest(unittest_context)
target_link_libraries(unittest_context ceph-common)

# unittest_safe_io
add_executable(unittest_safe_io
  test_safe_io.cc
  )
add_ceph_unittest(unittest_safe_io)
target_link_libraries(unittest_safe_io ceph-common)

# unittest_url_escape
add_executable(unittest_url_escape
  test_url_escape.cc
  )
add_ceph_unittest(unittest_url_escape)
target_link_libraries(unittest_url_escape ceph-common)

# unittest_pretty_binary
add_executable(unittest_pretty_binary
  test_pretty_binary.cc
  )
add_ceph_unittest(unittest_pretty_binary)
target_link_libraries(unittest_pretty_binary ceph-common)

# unittest_readahead
add_executable(unittest_readahead
  Readahead.cc
  )
add_ceph_unittest(unittest_readahead)
target_link_libraries(unittest_readahead ceph-common)

# unittest_tableformatter
add_executable(unittest_tableformatter
  test_tableformatter.cc
  )
add_ceph_unittest(unittest_tableformatter)
target_link_libraries(unittest_tableformatter ceph-common)

add_executable(unittest_xmlformatter
    test_xmlformatter.cc
    )
add_ceph_unittest(unittest_xmlformatter)
target_link_libraries(unittest_xmlformatter ceph-common)

# unittest_bit_vector
add_executable(unittest_bit_vector
  test_bit_vector.cc
  )
add_ceph_unittest(unittest_bit_vector)
target_link_libraries(unittest_bit_vector ceph-common)

# unittest_interval_map
add_executable(unittest_interval_map
  test_interval_map.cc
)
add_ceph_unittest(unittest_interval_map)
target_link_libraries(unittest_interval_map ceph-common)

# unittest_interval_set
add_executable(unittest_interval_set
  test_interval_set.cc
)
add_ceph_unittest(unittest_interval_set)
target_link_libraries(unittest_interval_set ceph-common GTest::Main)

# unittest_weighted_priority_queue
add_executable(unittest_weighted_priority_queue
  test_weighted_priority_queue.cc
  )
target_link_libraries(unittest_weighted_priority_queue ceph-common)
add_ceph_unittest(unittest_weighted_priority_queue)

if(WITH_CEPH_DEBUG_MUTEX)
  add_executable(unittest_mutex_debug
    test_mutex_debug.cc)
  add_ceph_unittest(unittest_mutex_debug)
  target_link_libraries(unittest_mutex_debug ceph-common)
endif()

# unittest_shunique_lock
add_executable(unittest_shunique_lock
  test_shunique_lock.cc
  )
add_ceph_unittest(unittest_shunique_lock)
target_link_libraries(unittest_shunique_lock ceph-common)

add_executable(unittest_fair_mutex
  test_fair_mutex.cc)
add_ceph_unittest(unittest_fair_mutex)
target_link_libraries(unittest_fair_mutex ceph-common)

# unittest_perf_histogram
add_executable(unittest_perf_histogram
  test_perf_histogram.cc
  )
add_ceph_unittest(unittest_perf_histogram)
target_link_libraries(unittest_perf_histogram ceph-common)

# unittest_perf_cache_key
add_executable(unittest_perf_counters_key test_perf_counters_key.cc)
add_ceph_unittest(unittest_perf_counters_key)
target_link_libraries(unittest_perf_counters_key ceph-common)

# unittest_global_doublefree
if(WITH_CEPHFS)
  add_executable(unittest_global_doublefree
    test_global_doublefree.cc
    )
  add_ceph_unittest(unittest_global_doublefree)
  target_link_libraries(unittest_global_doublefree cephfs librados ceph-common)
endif(WITH_CEPHFS)

if(NOT WIN32)
add_executable(unittest_dns_resolve
  dns_resolve.cc
  $<TARGET_OBJECTS:unit-main>)
target_link_libraries(unittest_dns_resolve global)
add_ceph_unittest(unittest_dns_resolve)
endif()

add_executable(unittest_back_trace
  test_back_trace.cc)
set_source_files_properties(test_back_trace.cc PROPERTIES
  COMPILE_FLAGS -fno-inline)
add_ceph_unittest(unittest_back_trace)
target_link_libraries(unittest_back_trace ceph-common)

add_executable(unittest_hostname
    test_hostname.cc)
add_ceph_unittest(unittest_hostname)
target_link_libraries(unittest_hostname ceph-common)

add_executable(unittest_iso_8601
    test_iso_8601.cc)
add_ceph_unittest(unittest_iso_8601)
target_link_libraries(unittest_iso_8601 ceph-common)

add_executable(unittest_convenience test_convenience.cc)
add_ceph_unittest(unittest_convenience)

add_executable(unittest_bounded_key_counter
  test_bounded_key_counter.cc
  $<TARGET_OBJECTS:unit-main>)
target_link_libraries(unittest_bounded_key_counter global)
add_ceph_unittest(unittest_bounded_key_counter)

add_executable(unittest_split test_split.cc)
add_ceph_unittest(unittest_split)

add_executable(unittest_static_ptr test_static_ptr.cc)
add_ceph_unittest(unittest_static_ptr)

add_executable(unittest_hobject test_hobject.cc
  $<TARGET_OBJECTS:unit-main>)
target_link_libraries(unittest_hobject global ceph-common)
add_ceph_unittest(unittest_hobject)

add_executable(unittest_async_completion test_async_completion.cc)
add_ceph_unittest(unittest_async_completion)
target_link_libraries(unittest_async_completion ceph-common Boost::system)

add_executable(unittest_async_shared_mutex test_async_shared_mutex.cc)
add_ceph_unittest(unittest_async_shared_mutex)
target_link_libraries(unittest_async_shared_mutex ceph-common Boost::system)

add_executable(unittest_cdc test_cdc.cc
  $<TARGET_OBJECTS:unit-main>)
target_link_libraries(unittest_cdc global ceph-common)
add_ceph_unittest(unittest_cdc)

add_executable(unittest_ceph_timer test_ceph_timer.cc)
add_ceph_unittest(unittest_ceph_timer)

add_executable(unittest_option test_option.cc)
target_link_libraries(unittest_option ceph-common GTest::Main)
add_ceph_unittest(unittest_option)

add_executable(unittest_fault_injector test_fault_injector.cc
  $<TARGET_OBJECTS:unit-main>)
target_link_libraries(unittest_fault_injector global)
add_ceph_unittest(unittest_fault_injector)

add_executable(unittest_blocked_completion test_blocked_completion.cc)
add_ceph_unittest(unittest_blocked_completion)
target_link_libraries(unittest_blocked_completion Boost::system GTest::GTest)

add_executable(unittest_allocate_unique test_allocate_unique.cc)
add_ceph_unittest(unittest_allocate_unique)

if(WITH_SYSTEMD)
  add_executable(unittest_journald_logger test_journald_logger.cc)
  target_link_libraries(unittest_journald_logger ceph-common)
  add_ceph_unittest(unittest_journald_logger)
endif()