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 add_executable(test_build_librgw_admin_user buildtest_skeleton.cc)
112 target_link_libraries(test_build_librgw_admin_user pthread ${CRYPTO_LIBS} ${EXTRALIBS})
116 # From src/test/Makefile-client.am: I dont get this one... testing the osdc build but link in libcephfs?
117 add_executable(test_build_libcephfs buildtest_skeleton.cc)
118 target_link_libraries(test_build_libcephfs cephfs pthread ${CRYPTO_LIBS} ${EXTRALIBS})
119 endif(WITH_LIBCEPHFS)
121 add_executable(test_build_librados buildtest_skeleton.cc)
122 target_link_libraries(test_build_librados librados pthread ${CRYPTO_LIBS} ${EXTRALIBS} osdc osd os ceph-common cls_lock_client ${BLKID_LIBRARIES})
128 add_executable(ceph_bench_log
131 target_link_libraries(ceph_bench_log global pthread rt ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
134 add_executable(ceph_test_mutate
137 target_link_libraries(ceph_test_mutate global librados ${BLKID_LIBRARIES}
141 add_executable(test_trans
144 target_link_libraries(test_trans os global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
153 add_executable(ceph_omapbench
156 target_link_libraries(ceph_omapbench
159 Boost::program_options)
163 set(kvstorebench_srcs
165 ${CMAKE_SOURCE_DIR}/src/key_value_store/kv_flat_btree_async.cc
167 add_executable(ceph_kvstorebench ${kvstorebench_srcs})
168 target_link_libraries(ceph_kvstorebench librados global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
169 install(TARGETS ceph_kvstorebench DESTINATION bin)
172 # ceph_objectstore_bench
173 add_executable(ceph_objectstore_bench objectstore_bench.cc)
174 target_link_libraries(ceph_objectstore_bench os global ${BLKID_LIBRARIES})
178 set(test_cors_srcs test_cors.cc)
179 add_executable(test_cors
182 target_link_libraries(test_cors
189 ${CMAKE_DL_LIBS} ${UNITTEST_LIBS})
191 # ceph_test_cls_rgw_meta
192 set(test_cls_rgw_meta_srcs test_rgw_admin_meta.cc)
193 add_executable(ceph_test_cls_rgw_meta
194 ${test_cls_rgw_meta_srcs}
196 target_link_libraries(ceph_test_cls_rgw_meta
209 ${CMAKE_DL_LIBS} ${UNITTEST_LIBS} ${CRYPTO_LIBS})
212 ceph_test_cls_rgw_meta
213 DESTINATION ${CMAKE_INSTALL_BINDIR})
215 # ceph_test_cls_rgw_log
216 set(ceph_test_cls_rgw_log_srcs
217 test_rgw_admin_log.cc
219 add_executable(ceph_test_cls_rgw_log
220 ${ceph_test_cls_rgw_log_srcs}
222 target_link_libraries(ceph_test_cls_rgw_log
241 # ceph_test_librgw_file (nfs-like RGW interface)
242 add_executable(ceph_test_librgw_file
245 if(WITH_RADOSGW_FCGI_FRONTEND)
246 target_include_directories(ceph_test_librgw_file SYSTEM PRIVATE ${FCGI_INCLUDE_DIR})
247 endif(WITH_RADOSGW_FCGI_FRONTEND)
248 target_link_libraries(ceph_test_librgw_file
256 # ceph_test_librgw_file_cd (just the rgw_file create-delete bucket ops)
257 add_executable(ceph_test_librgw_file_cd
260 target_link_libraries(ceph_test_librgw_file_cd
268 # ceph_test_librgw_file_gp (just the rgw_file get-put bucket ops)
269 add_executable(ceph_test_librgw_file_gp
272 target_link_libraries(ceph_test_librgw_file_gp
280 # ceph_test_librgw_file_nfsns (nfs namespace tests)
281 add_executable(ceph_test_librgw_file_nfsns
284 if(WITH_RADOSGW_FCGI_FRONTEND)
285 target_include_directories(ceph_test_librgw_file_nfsns SYSTEM PRIVATE ${FCGI_INCLUDE_DIR})
286 endif(WITH_RADOSGW_FCGI_FRONTEND)
287 target_link_libraries(ceph_test_librgw_file_nfsns
294 if(WITH_BOOST_CONTEXT)
295 target_link_libraries(ceph_test_librgw_file_nfsns spawn)
299 # ceph_test_librgw_file_aw (nfs write transaction [atomic write] tests)
300 add_executable(ceph_test_librgw_file_aw
303 target_link_libraries(ceph_test_librgw_file_aw
311 # ceph_test_librgw_file_marker (READDIR with string and uint64 offsets)
312 add_executable(ceph_test_librgw_file_marker
313 librgw_file_marker.cc
315 target_link_libraries(ceph_test_librgw_file_marker
322 if(WITH_BOOST_CONTEXT)
323 target_link_libraries(ceph_test_librgw_file_marker spawn)
326 # ceph_test_rgw_token
327 add_executable(ceph_test_rgw_token
330 target_link_libraries(ceph_test_rgw_token
337 # librgw_file_gp (just the rgw_file get-put bucket ops)
338 add_executable(test_rgw_ldap
339 ${CMAKE_SOURCE_DIR}/src/rgw/rgw_ldap.cc
342 target_link_libraries(test_rgw_ldap
345 ${OPENLDAP_LIBRARIES}
349 # unittest_librgw_admin_user
350 add_executable(ceph_test_librgw_admin_user test_librgw_admin_user.cc)
351 target_link_libraries(ceph_test_librgw_admin_user
360 endif(${WITH_RADOSGW})
362 # ceph_multi_stress_watch
363 add_executable(ceph_multi_stress_watch
364 multi_stress_watch.cc
366 target_link_libraries(ceph_multi_stress_watch librados global radostest-cxx)
369 add_executable(ceph_perf_local
373 set(PERF_LOCAL_FLAGS ${SSE3_FLAGS})
376 set(PERF_LOCAL_FLAGS ${ARM_NEON_FLAGS})
379 set_target_properties(ceph_perf_local PROPERTIES COMPILE_FLAGS
382 target_link_libraries(ceph_perf_local global ${UNITTEST_LIBS})
386 ceph_multi_stress_watch
387 ceph_objectstore_bench
392 # ceph_test_filejournal
393 add_executable(ceph_test_filejournal
396 target_link_libraries(ceph_test_filejournal
407 ceph_test_filejournal
408 DESTINATION ${CMAKE_INSTALL_BINDIR})
411 add_executable(ceph_test_keys
414 target_link_libraries(ceph_test_keys mon global ${CMAKE_DL_LIBS})
416 # ceph_test_snap_mapper
417 add_executable(ceph_test_snap_mapper
419 $<TARGET_OBJECTS:unit-main>
421 target_link_libraries(ceph_test_snap_mapper osd global ${BLKID_LIBRARIES} ${UNITTEST_LIBS})
423 add_executable(ceph_test_stress_watch
426 target_link_libraries(ceph_test_stress_watch
435 ceph_test_stress_watch
436 DESTINATION ${CMAKE_INSTALL_BINDIR})
439 add_executable(ceph_test_cfuse_cache_invalidate
440 test_cfuse_cache_invalidate.cc
442 target_link_libraries(ceph_test_cfuse_cache_invalidate
448 add_executable(test_c_headers
451 target_link_libraries(test_c_headers
454 endif(${WITH_CEPHFS})
456 if(HAVE_BLKID OR FREEBSD)
457 add_executable(ceph_test_get_blkdev_props
458 test_get_blkdev_props.cc
460 target_link_libraries(ceph_test_get_blkdev_props
467 endif(HAVE_BLKID OR FREEBSD)
469 # ceph_test_admin_socket_output
471 if(StdFilesystem_FOUND)
472 add_executable(ceph_test_admin_socket_output
473 test_admin_socket_output.cc
474 admin_socket_output.cc
475 admin_socket_output_tests.cc)
476 target_link_libraries(ceph_test_admin_socket_output
477 ceph-common StdFilesystem::filesystem)
479 ceph_test_admin_socket_output
480 DESTINATION ${CMAKE_INSTALL_BINDIR})
483 #make check starts here
485 #following dependencies are run inside make check unit tests
486 add_dependencies(tests
489 get_command_descriptions
496 ceph-objectstore-tool
503 ceph_test_objectstore
504 ceph_erasure_code_non_regression
508 add_dependencies(tests ceph-mds)
511 add_dependencies(tests ceph-mgr)
514 add_dependencies(tests unittest_librbd rbd)
516 add_dependencies(tests rbd-ggate)
520 add_dependencies(tests radosgwd radosgw-admin)
522 #add dependency from fio just to ensure the plugin build isn't failing
523 if(WITH_FIO OR WITH_SYSTEM_FIO)
524 add_dependencies(tests fio_ceph_objectstore)
528 # Run rbd-unit-tests separate so they an run in parallel
529 # For values see: src/include/rbd/features.h
530 add_ceph_test(run-rbd-unit-tests-N.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh N)
531 add_ceph_test(run-rbd-unit-tests-0.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 0)
532 add_ceph_test(run-rbd-unit-tests-1.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 1)
533 add_ceph_test(run-rbd-unit-tests-61.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 61)
534 add_ceph_test(run-rbd-unit-tests-109.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 109)
535 add_ceph_test(run-rbd-unit-tests-127.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh 127)
537 add_ceph_test(rbd-ggate.sh ${CMAKE_CURRENT_SOURCE_DIR}/rbd-ggate.sh)
540 add_ceph_test(run-cli-tests ${CMAKE_CURRENT_SOURCE_DIR}/run-cli-tests)
542 # flaky, see https://tracker.ceph.com/issues/44243
543 #add_ceph_test(test_objectstore_memstore.sh ${CMAKE_CURRENT_SOURCE_DIR}/test_objectstore_memstore.sh)
546 #add_ceph_test(test_pidfile.sh ${CMAKE_CURRENT_SOURCE_DIR}/test_pidfile.sh)
548 add_ceph_test(smoke.sh ${CMAKE_CURRENT_SOURCE_DIR}/smoke.sh)
552 PROPERTY ENVIRONMENT ${env_vars_for_tox_tests})
554 # unittest_admin_socket
555 add_executable(unittest_admin_socket
557 $<TARGET_OBJECTS:unit-main>
559 add_ceph_unittest(unittest_admin_socket)
560 target_link_libraries(unittest_admin_socket global)
563 add_executable(unittest_encoding
566 add_ceph_unittest(unittest_encoding)
567 target_link_libraries(unittest_encoding ceph-common)
570 add_executable(unittest_addrs
573 add_ceph_unittest(unittest_addrs)
574 target_link_libraries(unittest_addrs ceph-common)
577 add_executable(unittest_auth
579 $<TARGET_OBJECTS:unit-main>
581 add_ceph_unittest(unittest_auth)
582 target_link_libraries(unittest_auth global)
585 add_executable(unittest_workqueue
587 $<TARGET_OBJECTS:unit-main>
589 add_ceph_unittest(unittest_workqueue)
590 target_link_libraries(unittest_workqueue global)
593 if(WITH_LIBRADOSSTRIPER)
594 add_executable(unittest_striper
596 $<TARGET_OBJECTS:unit-main>
598 add_ceph_unittest(unittest_striper)
599 target_link_libraries(unittest_striper global ${BLKID_LIBRARIES})
603 add_executable(unittest_str_list
606 add_ceph_unittest(unittest_str_list)
607 target_link_libraries(unittest_str_list global)
610 add_executable(unittest_log
611 ${CMAKE_SOURCE_DIR}/src/log/test.cc
613 add_ceph_unittest(unittest_log)
614 target_link_libraries(unittest_log global)
617 add_executable(unittest_base64
620 add_ceph_unittest(unittest_base64)
621 target_link_libraries(unittest_base64 global)
623 # unittest_ceph_argparse
624 add_executable(unittest_ceph_argparse
627 add_ceph_unittest(unittest_ceph_argparse)
628 target_link_libraries(unittest_ceph_argparse global)
630 # unittest_ceph_compatset
631 add_executable(unittest_ceph_compatset
634 add_ceph_unittest(unittest_ceph_compatset)
635 target_link_libraries(unittest_ceph_compatset global)
638 add_executable(unittest_gather
640 $<TARGET_OBJECTS:unit-main>
642 add_ceph_unittest(unittest_gather)
643 target_link_libraries(unittest_gather global)
646 add_executable(unittest_run_cmd
649 add_ceph_unittest(unittest_run_cmd)
650 target_link_libraries(unittest_run_cmd global)
653 add_executable(unittest_signals
655 $<TARGET_OBJECTS:unit-main>
657 add_ceph_unittest(unittest_signals)
658 target_link_libraries(unittest_signals global)
660 # unittest_simple_spin
661 add_executable(unittest_simple_spin
664 add_ceph_unittest(unittest_simple_spin)
665 target_link_libraries(unittest_simple_spin global)
667 # unittest_bufferlist
668 add_executable(unittest_bufferlist
670 $<TARGET_OBJECTS:unit-main>
672 add_ceph_unittest(unittest_bufferlist)
673 target_link_libraries(unittest_bufferlist global)
675 # compiletest_cxx11_client
676 add_executable(compiletest_cxx11_client
679 if(CMAKE_VERSION VERSION_LESS "3.8")
680 # this is ugly as we'll end with -std=c++11 overriding the previous -std=c++17
681 # I would love to have a better way for old Cmakes
682 set_target_properties(compiletest_cxx11_client
683 PROPERTIES COMPILE_FLAGS "-std=c++11 -Werror -pedantic"
686 set_target_properties(compiletest_cxx11_client
687 PROPERTIES COMPILE_FLAGS "-Werror -pedantic"
688 CMAKE_CXX_STANDARD 11
689 CXX_STANDARD_REQUIRED ON
692 add_ceph_test(compiletest_cxx11_client
693 "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/compiletest_cxx11_client"
695 target_link_libraries(compiletest_cxx11_client global)
698 add_executable(unittest_xlist
701 add_ceph_unittest(unittest_xlist)
702 target_link_libraries(unittest_xlist ceph-common)
705 add_executable(unittest_arch
707 $<TARGET_OBJECTS:unit-main>
709 add_ceph_unittest(unittest_arch)
710 target_link_libraries(unittest_arch global)
713 add_executable(unittest_denc
716 add_ceph_unittest(unittest_denc)
717 target_link_libraries(unittest_denc global)
720 add_executable(unittest_mempool
723 add_ceph_unittest(unittest_mempool)
724 target_link_libraries(unittest_mempool global)
727 add_executable(unittest_features
730 add_ceph_unittest(unittest_features)
731 target_link_libraries(unittest_features global)
734 add_executable(unittest_crypto
736 $<TARGET_OBJECTS:unit-main>
738 add_ceph_unittest(unittest_crypto)
739 target_link_libraries(unittest_crypto global)
741 # unittest_crypto_init
742 add_executable(unittest_crypto_init
745 add_ceph_unittest(unittest_crypto_init)
746 target_link_libraries(unittest_crypto_init global)
748 # unittest_perf_counters
749 add_executable(unittest_perf_counters
752 add_ceph_unittest(unittest_perf_counters)
753 target_link_libraries(unittest_perf_counters global)
755 # unittest_ceph_crypto
756 add_executable(unittest_ceph_crypto
758 add_ceph_unittest(unittest_ceph_crypto)
759 target_link_libraries(unittest_ceph_crypto global)
762 add_executable(unittest_utf8
764 add_ceph_unittest(unittest_utf8)
765 target_link_libraries(unittest_utf8 global)
768 add_executable(unittest_mime
770 add_ceph_unittest(unittest_mime)
771 target_link_libraries(unittest_mime ceph-common)
774 add_executable(unittest_escape
776 add_ceph_unittest(unittest_escape)
777 target_link_libraries(unittest_escape ceph-common)
780 add_executable(unittest_strtol
782 add_ceph_unittest(unittest_strtol)
783 target_link_libraries(unittest_strtol ceph-common)
786 add_executable(unittest_confutils
788 add_ceph_unittest(unittest_confutils)
789 target_link_libraries(unittest_confutils ceph-common)
791 # unittest_heartbeatmap
792 add_executable(unittest_heartbeatmap
794 $<TARGET_OBJECTS:unit-main>
796 add_ceph_unittest(unittest_heartbeatmap)
797 target_link_libraries(unittest_heartbeatmap global ceph-common)
801 add_executable(unittest_formatter
803 $<TARGET_OBJECTS:unit-main>
805 add_ceph_unittest(unittest_formatter)
806 target_link_libraries(unittest_formatter global)
807 endif(${WITH_RADOSGW})
809 # unittest_daemon_config
810 add_executable(unittest_daemon_config
812 $<TARGET_OBJECTS:unit-main>
814 add_ceph_unittest(unittest_daemon_config)
815 target_link_libraries(unittest_daemon_config
823 # unittest_libcephfs_config
824 add_executable(unittest_libcephfs_config
827 add_ceph_unittest(unittest_libcephfs_config)
828 target_link_libraries(unittest_libcephfs_config cephfs)
829 endif(WITH_LIBCEPHFS)
832 # unittest_rbd_replay
833 add_executable(unittest_rbd_replay
835 add_ceph_unittest(unittest_rbd_replay)
836 target_link_libraries(unittest_rbd_replay
847 add_executable(unittest_ipaddr
849 add_ceph_unittest(unittest_ipaddr)
850 target_link_libraries(unittest_ipaddr global)
853 add_executable(unittest_utime
855 add_ceph_unittest(unittest_utime)
856 target_link_libraries(unittest_utime ceph-common)
859 add_executable(unittest_texttable
861 $<TARGET_OBJECTS:common_texttable_obj>)
862 add_ceph_unittest(unittest_texttable)
863 target_link_libraries(unittest_texttable ceph-common)
866 add_executable(unittest_on_exit
868 add_ceph_unittest(unittest_on_exit)
869 target_link_libraries(unittest_on_exit ceph-common)
871 # unittest_subprocess
872 add_executable(unittest_subprocess
874 add_ceph_unittest(unittest_subprocess)
875 target_link_libraries(unittest_subprocess ceph-common)
878 add_executable(unittest_pageset test_pageset.cc)
879 add_ceph_unittest(unittest_pageset)
880 target_link_libraries(unittest_pageset ceph-common)
882 add_executable(unittest_random_string test_random_string.cc $<TARGET_OBJECTS:unit-main>)
883 add_ceph_unittest(unittest_random_string)
884 target_link_libraries(unittest_random_string global)
887 add_executable(unittest_any test_any.cc)
888 add_ceph_unittest(unittest_any)
890 # unittest_weighted_shuffle
891 add_executable(unittest_weighted_shuffle test_weighted_shuffle.cc)
892 add_ceph_unittest(unittest_weighted_shuffle)
894 #make check ends here