3 set(UNITTEST_LIBS GMock::Main GMock::GMock GTest::GTest ${CMAKE_THREAD_LIBS_INIT}
4 ${GSSAPI_LIBRARIES} ${OPENLDAP_LIBRARIES} ${CMAKE_DL_LIBS})
6 add_library(unit-main OBJECT unit.cc)
7 target_include_directories(unit-main PRIVATE
8 $<TARGET_PROPERTY:GTest::GTest,INTERFACE_INCLUDE_DIRECTORIES>)
10 add_subdirectory(cls_hello)
11 add_subdirectory(cls_lock)
12 add_subdirectory(cls_log)
13 add_subdirectory(cls_numops)
14 add_subdirectory(cls_sdk)
16 add_subdirectory(cls_journal)
17 add_subdirectory(cls_rbd)
19 add_subdirectory(cls_refcount)
20 add_subdirectory(cls_rgw)
21 add_subdirectory(cls_version)
22 add_subdirectory(cls_lua)
23 add_subdirectory(cls_rgw_gc)
24 add_subdirectory(cls_queue)
25 add_subdirectory(common)
26 add_subdirectory(compressor)
27 add_subdirectory(crush)
28 add_subdirectory(direct_messenger)
29 add_subdirectory(encoding)
30 add_subdirectory(erasure-code)
31 add_subdirectory(filestore)
33 add_subdirectory(journal)
34 add_subdirectory(libcephfs)
35 add_subdirectory(librados)
36 add_subdirectory(librados_test_stub)
37 if(WITH_LIBRADOSSTRIPER)
38 add_subdirectory(libradosstriper)
41 add_subdirectory(librbd)
48 add_subdirectory(msgr)
49 add_subdirectory(ObjectMap)
50 add_subdirectory(objectstore)
53 add_subdirectory(osdc)
54 add_subdirectory(pybind)
55 add_subdirectory(immutable_object_cache)
58 if(WITH_RADOSGW_AMQP_ENDPOINT)
59 list(APPEND rgw_libs amqp_mock)
61 if(WITH_RADOSGW_KAFKA_ENDPOINT)
62 list(APPEND rgw_libs kafka_stub)
67 add_subdirectory(rbd_mirror)
70 add_subdirectory(crimson)
72 add_subdirectory(system)
73 if(WITH_FIO OR WITH_SYSTEM_FIO)
76 add_subdirectory(lazy-omap-stats)
79 add_executable(ceph_test_timers
82 target_link_libraries(ceph_test_timers global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
84 # test_signal_handlers
85 add_executable(ceph_test_signal_handlers
88 target_link_libraries(ceph_test_signal_handlers global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
90 # test_rewrite_latency
91 add_executable(ceph_test_rewrite_latency
92 test_rewrite_latency.cc
94 target_link_libraries(ceph_test_rewrite_latency ceph-common)
97 add_executable(test_crypto
99 target_link_libraries(test_crypto
102 add_executable(test_build_libcommon buildtest_skeleton.cc)
103 target_link_libraries(test_build_libcommon ceph-common pthread ${CRYPTO_LIBS} ${EXTRALIBS})
106 add_executable(test_build_librgw buildtest_skeleton.cc)
107 target_link_libraries(test_build_librgw rgw_a pthread ${CRYPTO_LIBS} ${EXTRALIBS})
111 # From src/test/Makefile-client.am: I dont get this one... testing the osdc build but link in libcephfs?
112 add_executable(test_build_libcephfs buildtest_skeleton.cc)
113 target_link_libraries(test_build_libcephfs cephfs pthread ${CRYPTO_LIBS} ${EXTRALIBS})
114 endif(WITH_LIBCEPHFS)
116 add_executable(test_build_librados buildtest_skeleton.cc)
117 target_link_libraries(test_build_librados librados pthread ${CRYPTO_LIBS} ${EXTRALIBS} osdc osd os ceph-common cls_lock_client ${BLKID_LIBRARIES})
123 add_executable(ceph_bench_log
126 target_link_libraries(ceph_bench_log global pthread rt ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
129 add_executable(ceph_test_mutate
132 target_link_libraries(ceph_test_mutate global librados ${BLKID_LIBRARIES}
136 add_executable(test_trans
139 target_link_libraries(test_trans os global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
148 add_executable(ceph_omapbench
151 target_link_libraries(ceph_omapbench
154 Boost::program_options)
158 set(kvstorebench_srcs
160 ${CMAKE_SOURCE_DIR}/src/key_value_store/kv_flat_btree_async.cc
162 add_executable(ceph_kvstorebench ${kvstorebench_srcs})
163 target_link_libraries(ceph_kvstorebench librados global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
164 install(TARGETS ceph_kvstorebench DESTINATION bin)
167 # ceph_objectstore_bench
168 add_executable(ceph_objectstore_bench objectstore_bench.cc)
169 target_link_libraries(ceph_objectstore_bench os global ${BLKID_LIBRARIES})
173 set(test_cors_srcs test_cors.cc)
174 add_executable(test_cors
177 target_link_libraries(test_cors
184 ${CMAKE_DL_LIBS} ${UNITTEST_LIBS})
186 # ceph_test_cls_rgw_meta
187 set(test_cls_rgw_meta_srcs test_rgw_admin_meta.cc)
188 add_executable(ceph_test_cls_rgw_meta
189 ${test_cls_rgw_meta_srcs}
191 target_link_libraries(ceph_test_cls_rgw_meta
204 ${CMAKE_DL_LIBS} ${UNITTEST_LIBS} ${CRYPTO_LIBS})
207 ceph_test_cls_rgw_meta
208 DESTINATION ${CMAKE_INSTALL_BINDIR})
210 # ceph_test_cls_rgw_log
211 set(ceph_test_cls_rgw_log_srcs
212 test_rgw_admin_log.cc
214 add_executable(ceph_test_cls_rgw_log
215 ${ceph_test_cls_rgw_log_srcs}
217 target_link_libraries(ceph_test_cls_rgw_log
236 # ceph_test_librgw_file (nfs-like RGW interface)
237 add_executable(ceph_test_librgw_file
240 if(WITH_RADOSGW_FCGI_FRONTEND)
241 target_include_directories(ceph_test_librgw_file SYSTEM PRIVATE ${FCGI_INCLUDE_DIR})
242 endif(WITH_RADOSGW_FCGI_FRONTEND)
243 target_link_libraries(ceph_test_librgw_file
251 # ceph_test_librgw_file_cd (just the rgw_file create-delete bucket ops)
252 add_executable(ceph_test_librgw_file_cd
255 target_link_libraries(ceph_test_librgw_file_cd
263 # ceph_test_librgw_file_gp (just the rgw_file get-put bucket ops)
264 add_executable(ceph_test_librgw_file_gp
267 target_link_libraries(ceph_test_librgw_file_gp
275 # ceph_test_librgw_file_nfsns (nfs namespace tests)
276 add_executable(ceph_test_librgw_file_nfsns
279 target_include_directories(ceph_test_librgw_file_nfsns SYSTEM PRIVATE "${CMAKE_SOURCE_DIR}/src/rgw")
280 if(WITH_RADOSGW_FCGI_FRONTEND)
281 target_include_directories(ceph_test_librgw_file_nfsns SYSTEM PRIVATE ${FCGI_INCLUDE_DIR})
282 endif(WITH_RADOSGW_FCGI_FRONTEND)
283 target_link_libraries(ceph_test_librgw_file_nfsns
290 if(WITH_BOOST_CONTEXT)
291 target_link_libraries(ceph_test_librgw_file_nfsns spawn)
295 # ceph_test_librgw_file_aw (nfs write transaction [atomic write] tests)
296 add_executable(ceph_test_librgw_file_aw
299 target_link_libraries(ceph_test_librgw_file_aw
307 # ceph_test_librgw_file_marker (READDIR with string and uint64 offsets)
308 add_executable(ceph_test_librgw_file_marker
309 librgw_file_marker.cc
311 target_include_directories(ceph_test_librgw_file_marker SYSTEM PRIVATE "${CMAKE_SOURCE_DIR}/src/rgw")
312 target_link_libraries(ceph_test_librgw_file_marker
319 if(WITH_BOOST_CONTEXT)
320 target_link_libraries(ceph_test_librgw_file_marker spawn)
323 # ceph_test_rgw_token
324 add_executable(ceph_test_rgw_token
327 target_link_libraries(ceph_test_rgw_token
334 # librgw_file_gp (just the rgw_file get-put bucket ops)
335 add_executable(test_rgw_ldap
336 ${CMAKE_SOURCE_DIR}/src/rgw/rgw_ldap.cc
339 target_link_libraries(test_rgw_ldap
342 ${OPENLDAP_LIBRARIES}
345 endif(${WITH_RADOSGW})
347 # ceph_multi_stress_watch
348 add_executable(ceph_multi_stress_watch
349 multi_stress_watch.cc
351 target_link_libraries(ceph_multi_stress_watch librados global radostest-cxx)
354 add_executable(ceph_perf_local
358 set(PERF_LOCAL_FLAGS ${SSE3_FLAGS})
361 set(PERF_LOCAL_FLAGS ${ARM_NEON_FLAGS})
364 set_target_properties(ceph_perf_local PROPERTIES COMPILE_FLAGS
367 target_link_libraries(ceph_perf_local global ${UNITTEST_LIBS})
371 ceph_multi_stress_watch
372 ceph_objectstore_bench
377 # ceph_test_filejournal
378 add_executable(ceph_test_filejournal
381 target_link_libraries(ceph_test_filejournal
392 ceph_test_filejournal
393 DESTINATION ${CMAKE_INSTALL_BINDIR})
396 add_executable(ceph_test_keys
399 target_link_libraries(ceph_test_keys mon global ${CMAKE_DL_LIBS})
401 # ceph_test_snap_mapper
402 add_executable(ceph_test_snap_mapper
404 $<TARGET_OBJECTS:unit-main>
406 target_link_libraries(ceph_test_snap_mapper osd global ${BLKID_LIBRARIES} ${UNITTEST_LIBS})
408 add_executable(ceph_test_stress_watch
411 target_link_libraries(ceph_test_stress_watch
420 ceph_test_stress_watch
421 DESTINATION ${CMAKE_INSTALL_BINDIR})
424 add_executable(ceph_test_cfuse_cache_invalidate
425 test_cfuse_cache_invalidate.cc
427 target_link_libraries(ceph_test_cfuse_cache_invalidate
433 add_executable(test_c_headers
436 target_link_libraries(test_c_headers
439 endif(${WITH_CEPHFS})
441 if(HAVE_BLKID OR FREEBSD)
442 add_executable(ceph_test_get_blkdev_props
443 test_get_blkdev_props.cc
445 target_link_libraries(ceph_test_get_blkdev_props
452 endif(HAVE_BLKID OR FREEBSD)
454 # ceph_test_admin_socket_output
456 if(StdFilesystem_FOUND)
457 add_executable(ceph_test_admin_socket_output
458 test_admin_socket_output.cc
459 admin_socket_output.cc
460 admin_socket_output_tests.cc)
461 target_link_libraries(ceph_test_admin_socket_output
462 ceph-common StdFilesystem::filesystem)
464 ceph_test_admin_socket_output
465 DESTINATION ${CMAKE_INSTALL_BINDIR})
468 #make check starts here
470 #following dependencies are run inside make check unit tests
471 add_dependencies(tests
474 get_command_descriptions
481 ceph-objectstore-tool
488 ceph_test_objectstore
489 ceph_erasure_code_non_regression
493 add_dependencies(tests ceph-mds)
496 add_dependencies(tests ceph-mgr)
499 add_dependencies(tests unittest_librbd rbd)
501 add_dependencies(tests rbd-ggate)
505 add_dependencies(tests radosgwd radosgw-admin)
507 #add dependency from fio just to ensure the plugin build isn't failing
508 if(WITH_FIO OR WITH_SYSTEM_FIO)
509 add_dependencies(tests fio_ceph_objectstore)
513 # Run rbd-unit-tests separate so they an run in parallel
514 # For values see: src/include/rbd/features.h
515 add_ceph_test(run-rbd-unit-tests-N.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh N)
516 add_ceph_test(run-rbd-unit-tests-0.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 0)
517 add_ceph_test(run-rbd-unit-tests-1.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 1)
518 add_ceph_test(run-rbd-unit-tests-61.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 61)
519 add_ceph_test(run-rbd-unit-tests-109.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 109)
520 add_ceph_test(run-rbd-unit-tests-127.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 127)
522 add_ceph_test(rbd-ggate.sh ${CMAKE_CURRENT_SOURCE_DIR}/rbd-ggate.sh)
525 add_ceph_test(run-cli-tests ${CMAKE_CURRENT_SOURCE_DIR}/run-cli-tests)
527 # flaky, see https://tracker.ceph.com/issues/44243
528 #add_ceph_test(test_objectstore_memstore.sh ${CMAKE_CURRENT_SOURCE_DIR}/test_objectstore_memstore.sh)
531 #add_ceph_test(test_pidfile.sh ${CMAKE_CURRENT_SOURCE_DIR}/test_pidfile.sh)
533 add_ceph_test(smoke.sh ${CMAKE_CURRENT_SOURCE_DIR}/smoke.sh)
537 PROPERTY ENVIRONMENT ${env_vars_for_tox_tests})
539 # unittest_admin_socket
540 add_executable(unittest_admin_socket
542 $<TARGET_OBJECTS:unit-main>
544 add_ceph_unittest(unittest_admin_socket)
545 target_link_libraries(unittest_admin_socket global)
548 add_executable(unittest_encoding
551 add_ceph_unittest(unittest_encoding)
552 target_link_libraries(unittest_encoding ceph-common)
555 add_executable(unittest_addrs
558 add_ceph_unittest(unittest_addrs)
559 target_link_libraries(unittest_addrs ceph-common)
562 add_executable(unittest_auth
564 $<TARGET_OBJECTS:unit-main>
566 add_ceph_unittest(unittest_auth)
567 target_link_libraries(unittest_auth global)
570 add_executable(unittest_workqueue
572 $<TARGET_OBJECTS:unit-main>
574 add_ceph_unittest(unittest_workqueue)
575 target_link_libraries(unittest_workqueue global)
578 if(WITH_LIBRADOSSTRIPER)
579 add_executable(unittest_striper
581 $<TARGET_OBJECTS:unit-main>
583 add_ceph_unittest(unittest_striper)
584 target_link_libraries(unittest_striper global ${BLKID_LIBRARIES})
588 add_executable(unittest_str_list
591 add_ceph_unittest(unittest_str_list)
592 target_link_libraries(unittest_str_list global)
595 add_executable(unittest_log
596 ${CMAKE_SOURCE_DIR}/src/log/test.cc
598 add_ceph_unittest(unittest_log)
599 target_link_libraries(unittest_log global)
602 add_executable(unittest_base64
605 add_ceph_unittest(unittest_base64)
606 target_link_libraries(unittest_base64 global)
608 # unittest_ceph_argparse
609 add_executable(unittest_ceph_argparse
612 add_ceph_unittest(unittest_ceph_argparse)
613 target_link_libraries(unittest_ceph_argparse global)
615 # unittest_ceph_compatset
616 add_executable(unittest_ceph_compatset
619 add_ceph_unittest(unittest_ceph_compatset)
620 target_link_libraries(unittest_ceph_compatset global)
623 add_executable(unittest_gather
625 $<TARGET_OBJECTS:unit-main>
627 add_ceph_unittest(unittest_gather)
628 target_link_libraries(unittest_gather global)
631 add_executable(unittest_run_cmd
634 add_ceph_unittest(unittest_run_cmd)
635 target_link_libraries(unittest_run_cmd global)
638 add_executable(unittest_signals
640 $<TARGET_OBJECTS:unit-main>
642 add_ceph_unittest(unittest_signals)
643 target_link_libraries(unittest_signals global)
645 # unittest_simple_spin
646 add_executable(unittest_simple_spin
649 add_ceph_unittest(unittest_simple_spin)
650 target_link_libraries(unittest_simple_spin global)
652 # unittest_bufferlist
653 add_executable(unittest_bufferlist
655 $<TARGET_OBJECTS:unit-main>
657 add_ceph_unittest(unittest_bufferlist)
658 target_link_libraries(unittest_bufferlist global)
660 # compiletest_cxx11_client
661 add_executable(compiletest_cxx11_client
664 if(CMAKE_VERSION VERSION_LESS "3.8")
665 # this is ugly as we'll end with -std=c++11 overriding the previous -std=c++17
666 # I would love to have a better way for old Cmakes
667 set_target_properties(compiletest_cxx11_client
668 PROPERTIES COMPILE_FLAGS "-std=c++11 -Werror -pedantic"
671 set_target_properties(compiletest_cxx11_client
672 PROPERTIES COMPILE_FLAGS "-Werror -pedantic"
673 CMAKE_CXX_STANDARD 11
674 CXX_STANDARD_REQUIRED ON
677 add_ceph_test(compiletest_cxx11_client
678 "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/compiletest_cxx11_client"
680 target_link_libraries(compiletest_cxx11_client global)
683 add_executable(unittest_xlist
686 add_ceph_unittest(unittest_xlist)
687 target_link_libraries(unittest_xlist ceph-common)
690 add_executable(unittest_arch
692 $<TARGET_OBJECTS:unit-main>
694 add_ceph_unittest(unittest_arch)
695 target_link_libraries(unittest_arch global)
698 add_executable(unittest_denc
701 add_ceph_unittest(unittest_denc)
702 target_link_libraries(unittest_denc global)
705 add_executable(unittest_mempool
708 add_ceph_unittest(unittest_mempool)
709 target_link_libraries(unittest_mempool global)
712 add_executable(unittest_features
715 add_ceph_unittest(unittest_features)
716 target_link_libraries(unittest_features global)
719 add_executable(unittest_crypto
721 $<TARGET_OBJECTS:unit-main>
723 add_ceph_unittest(unittest_crypto)
724 target_link_libraries(unittest_crypto global)
726 # unittest_crypto_init
727 add_executable(unittest_crypto_init
730 add_ceph_unittest(unittest_crypto_init)
731 target_link_libraries(unittest_crypto_init global)
733 # unittest_perf_counters
734 add_executable(unittest_perf_counters
737 add_ceph_unittest(unittest_perf_counters)
738 target_link_libraries(unittest_perf_counters global)
740 # unittest_ceph_crypto
741 add_executable(unittest_ceph_crypto
743 add_ceph_unittest(unittest_ceph_crypto)
744 target_link_libraries(unittest_ceph_crypto global)
747 add_executable(unittest_utf8
749 add_ceph_unittest(unittest_utf8)
750 target_link_libraries(unittest_utf8 global)
753 add_executable(unittest_mime
755 add_ceph_unittest(unittest_mime)
756 target_link_libraries(unittest_mime ceph-common)
759 add_executable(unittest_escape
761 add_ceph_unittest(unittest_escape)
762 target_link_libraries(unittest_escape ceph-common)
765 add_executable(unittest_strtol
767 add_ceph_unittest(unittest_strtol)
768 target_link_libraries(unittest_strtol ceph-common)
771 add_executable(unittest_confutils
773 add_ceph_unittest(unittest_confutils)
774 target_link_libraries(unittest_confutils ceph-common)
776 # unittest_heartbeatmap
777 add_executable(unittest_heartbeatmap
779 $<TARGET_OBJECTS:unit-main>
781 add_ceph_unittest(unittest_heartbeatmap)
782 target_link_libraries(unittest_heartbeatmap global ceph-common)
786 add_executable(unittest_formatter
788 $<TARGET_OBJECTS:unit-main>
790 add_ceph_unittest(unittest_formatter)
791 target_link_libraries(unittest_formatter global)
792 endif(${WITH_RADOSGW})
794 # unittest_daemon_config
795 add_executable(unittest_daemon_config
797 $<TARGET_OBJECTS:unit-main>
799 add_ceph_unittest(unittest_daemon_config)
800 target_link_libraries(unittest_daemon_config
808 # unittest_libcephfs_config
809 add_executable(unittest_libcephfs_config
812 add_ceph_unittest(unittest_libcephfs_config)
813 target_link_libraries(unittest_libcephfs_config cephfs)
814 endif(WITH_LIBCEPHFS)
817 # unittest_rbd_replay
818 add_executable(unittest_rbd_replay
820 add_ceph_unittest(unittest_rbd_replay)
821 target_link_libraries(unittest_rbd_replay
832 add_executable(unittest_ipaddr
834 add_ceph_unittest(unittest_ipaddr)
835 target_link_libraries(unittest_ipaddr global)
838 add_executable(unittest_utime
840 add_ceph_unittest(unittest_utime)
841 target_link_libraries(unittest_utime ceph-common)
844 add_executable(unittest_texttable
846 $<TARGET_OBJECTS:common_texttable_obj>)
847 add_ceph_unittest(unittest_texttable)
848 target_link_libraries(unittest_texttable ceph-common)
851 add_executable(unittest_on_exit
853 add_ceph_unittest(unittest_on_exit)
854 target_link_libraries(unittest_on_exit ceph-common)
856 # unittest_subprocess
857 add_executable(unittest_subprocess
859 add_ceph_unittest(unittest_subprocess)
860 target_link_libraries(unittest_subprocess ceph-common)
863 add_executable(unittest_pageset test_pageset.cc)
864 add_ceph_unittest(unittest_pageset)
865 target_link_libraries(unittest_pageset ceph-common)
867 add_executable(unittest_random_string test_random_string.cc $<TARGET_OBJECTS:unit-main>)
868 add_ceph_unittest(unittest_random_string)
869 target_link_libraries(unittest_random_string global)
872 add_executable(unittest_any test_any.cc)
873 add_ceph_unittest(unittest_any)
875 # unittest_weighted_shuffle
876 add_executable(unittest_weighted_shuffle test_weighted_shuffle.cc)
877 add_ceph_unittest(unittest_weighted_shuffle)
879 #make check ends here