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(common)
24 add_subdirectory(compressor)
25 add_subdirectory(crush)
26 add_subdirectory(direct_messenger)
27 add_subdirectory(encoding)
28 add_subdirectory(erasure-code)
29 add_subdirectory(filestore)
31 add_subdirectory(journal)
32 add_subdirectory(libcephfs)
33 add_subdirectory(librados)
34 add_subdirectory(librados_test_stub)
35 if(WITH_LIBRADOSSTRIPER)
36 add_subdirectory(libradosstriper)
39 add_subdirectory(librbd)
41 add_subdirectory(messenger)
47 add_subdirectory(msgr)
48 add_subdirectory(ObjectMap)
49 add_subdirectory(objectstore)
52 add_subdirectory(osdc)
53 add_subdirectory(pybind)
56 if(WITH_RADOSGW_AMQP_ENDPOINT)
57 list(APPEND rgw_libs amqp_mock)
62 add_subdirectory(rbd_mirror)
65 add_subdirectory(crimson)
67 add_subdirectory(system)
68 if(WITH_FIO OR WITH_SYSTEM_FIO)
73 add_executable(ceph_test_timers
76 target_link_libraries(ceph_test_timers global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
78 # test_signal_handlers
79 add_executable(ceph_test_signal_handlers
82 target_link_libraries(ceph_test_signal_handlers global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
84 # test_rewrite_latency
85 add_executable(ceph_test_rewrite_latency
86 test_rewrite_latency.cc
88 target_link_libraries(ceph_test_rewrite_latency ceph-common
90 ${CMAKE_THREAD_LIBS_INIT} ${CRYPTO_LIBS} m ${EXTRALIBS})
93 add_executable(test_crypto
96 target_link_libraries(test_crypto
105 add_executable(test_build_libcommon buildtest_skeleton.cc)
106 target_link_libraries(test_build_libcommon ceph-common pthread ${CRYPTO_LIBS} ${EXTRALIBS})
109 add_executable(test_build_librgw buildtest_skeleton.cc)
110 target_link_libraries(test_build_librgw rgw_a pthread ${CRYPTO_LIBS} ${EXTRALIBS})
114 add_executable(test_build_librgw_admin_user buildtest_skeleton.cc)
115 target_link_libraries(test_build_librgw_admin_user pthread ${CRYPTO_LIBS} ${EXTRALIBS})
119 # From src/test/Makefile-client.am: I dont get this one... testing the osdc build but link in libcephfs?
120 add_executable(test_build_libcephfs buildtest_skeleton.cc)
121 target_link_libraries(test_build_libcephfs cephfs pthread ${CRYPTO_LIBS} ${EXTRALIBS})
122 endif(WITH_LIBCEPHFS)
124 add_executable(test_build_librados buildtest_skeleton.cc)
125 target_link_libraries(test_build_librados librados pthread ${CRYPTO_LIBS} ${EXTRALIBS} osdc osd os ceph-common cls_lock_client ${BLKID_LIBRARIES})
131 add_executable(ceph_bench_log
134 target_link_libraries(ceph_bench_log global pthread rt ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
137 add_executable(ceph_test_mutate
140 target_link_libraries(ceph_test_mutate global librados ${BLKID_LIBRARIES}
144 add_executable(test_trans
147 target_link_libraries(test_trans os global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
156 add_executable(ceph_omapbench
159 target_link_libraries(ceph_omapbench
161 Boost::program_options
169 set(kvstorebench_srcs
171 ${CMAKE_SOURCE_DIR}/src/key_value_store/kv_flat_btree_async.cc
173 add_executable(ceph_kvstorebench ${kvstorebench_srcs})
174 target_link_libraries(ceph_kvstorebench librados global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
175 install(TARGETS ceph_kvstorebench DESTINATION bin)
178 # ceph_objectstore_bench
179 add_executable(ceph_objectstore_bench objectstore_bench.cc)
180 target_link_libraries(ceph_objectstore_bench os global ${BLKID_LIBRARIES})
184 set(test_cors_srcs test_cors.cc)
185 add_executable(test_cors
188 target_link_libraries(test_cors
195 ${CMAKE_DL_LIBS} ${UNITTEST_LIBS})
197 # ceph_test_cls_rgw_meta
198 set(test_cls_rgw_meta_srcs test_rgw_admin_meta.cc)
199 add_executable(ceph_test_cls_rgw_meta
200 ${test_cls_rgw_meta_srcs}
202 target_link_libraries(ceph_test_cls_rgw_meta
215 ${CMAKE_DL_LIBS} ${UNITTEST_LIBS} ${CRYPTO_LIBS})
218 ceph_test_cls_rgw_meta
219 DESTINATION ${CMAKE_INSTALL_BINDIR})
221 # ceph_test_cls_rgw_log
222 set(ceph_test_cls_rgw_log_srcs
223 test_rgw_admin_log.cc
225 add_executable(ceph_test_cls_rgw_log
226 ${ceph_test_cls_rgw_log_srcs}
228 target_link_libraries(ceph_test_cls_rgw_log
247 # ceph_test_librgw_file (nfs-like RGW interface)
248 add_executable(ceph_test_librgw_file
251 if(WITH_RADOSGW_FCGI_FRONTEND)
252 target_include_directories(ceph_test_librgw_file SYSTEM PRIVATE ${FCGI_INCLUDE_DIR})
253 endif(WITH_RADOSGW_FCGI_FRONTEND)
254 target_link_libraries(ceph_test_librgw_file
262 # ceph_test_librgw_file_cd (just the rgw_file create-delete bucket ops)
263 add_executable(ceph_test_librgw_file_cd
266 target_link_libraries(ceph_test_librgw_file_cd
274 # ceph_test_librgw_file_gp (just the rgw_file get-put bucket ops)
275 add_executable(ceph_test_librgw_file_gp
278 target_link_libraries(ceph_test_librgw_file_gp
286 # ceph_test_librgw_file_nfsns (nfs namespace tests)
287 add_executable(ceph_test_librgw_file_nfsns
290 if(WITH_RADOSGW_FCGI_FRONTEND)
291 target_include_directories(ceph_test_librgw_file_nfsns SYSTEM PRIVATE ${FCGI_INCLUDE_DIR})
292 endif(WITH_RADOSGW_FCGI_FRONTEND)
293 target_link_libraries(ceph_test_librgw_file_nfsns
301 # ceph_test_librgw_file_aw (nfs write transaction [atomic write] tests)
302 add_executable(ceph_test_librgw_file_aw
305 target_link_libraries(ceph_test_librgw_file_aw
313 # ceph_test_librgw_file_marker (READDIR with string and uint64 offsets)
314 add_executable(ceph_test_librgw_file_marker
315 librgw_file_marker.cc
317 target_link_libraries(ceph_test_librgw_file_marker
325 # ceph_test_rgw_token
326 add_executable(ceph_test_rgw_token
329 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
367 ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
370 add_executable(ceph_perf_local
374 set(PERF_LOCAL_FLAGS ${SSE3_FLAGS})
377 set(PERF_LOCAL_FLAGS ${ARM_NEON_FLAGS})
380 set_target_properties(ceph_perf_local PROPERTIES COMPILE_FLAGS
383 target_link_libraries(ceph_perf_local os global ${UNITTEST_LIBS})
387 ceph_multi_stress_watch
388 ceph_objectstore_bench
393 # ceph_test_filejournal
394 add_executable(ceph_test_filejournal
397 target_link_libraries(ceph_test_filejournal
408 ceph_test_filejournal
409 DESTINATION ${CMAKE_INSTALL_BINDIR})
412 add_executable(ceph_test_keys
415 target_link_libraries(ceph_test_keys mon global ${CMAKE_DL_LIBS})
417 # ceph_test_snap_mapper
418 add_executable(ceph_test_snap_mapper
420 $<TARGET_OBJECTS:unit-main>
422 target_link_libraries(ceph_test_snap_mapper osd global ${BLKID_LIBRARIES} ${UNITTEST_LIBS})
424 add_executable(ceph_test_stress_watch
427 target_link_libraries(ceph_test_stress_watch
436 ceph_test_stress_watch
437 DESTINATION ${CMAKE_INSTALL_BINDIR})
440 add_executable(ceph_test_cfuse_cache_invalidate
441 test_cfuse_cache_invalidate.cc
443 target_link_libraries(ceph_test_cfuse_cache_invalidate
449 add_executable(test_c_headers
452 target_link_libraries(test_c_headers
455 endif(${WITH_CEPHFS})
457 if(HAVE_BLKID OR FREEBSD)
458 add_executable(ceph_test_get_blkdev_props
459 test_get_blkdev_props.cc
461 target_link_libraries(ceph_test_get_blkdev_props
468 endif(HAVE_BLKID OR FREEBSD)
470 # ceph_test_admin_socket_output
472 find_package(StdFilesystem)
473 if(StdFilesystem_FOUND)
474 add_executable(ceph_test_admin_socket_output
475 test_admin_socket_output.cc
476 admin_socket_output.cc
477 admin_socket_output_tests.cc)
478 target_link_libraries(ceph_test_admin_socket_output
479 ceph-common StdFilesystem::filesystem)
481 ceph_test_admin_socket_output
482 DESTINATION ${CMAKE_INSTALL_BINDIR})
485 #make check starts here
487 #following dependencies are run inside make check unit tests
488 add_dependencies(tests
491 get_command_descriptions
498 ceph-objectstore-tool
505 ceph_test_objectstore
506 ceph_erasure_code_non_regression
508 cython${PY_BINDING_INFIX}_modules)
510 add_dependencies(tests ceph-mds)
513 add_dependencies(tests ceph-mgr)
516 add_dependencies(tests unittest_librbd rbd)
518 add_dependencies(tests rbd-ggate)
522 add_dependencies(tests radosgw radosgw-admin)
524 #add dependency from fio just to ensure the plugin build isn't failing
525 if(WITH_FIO OR WITH_SYSTEM_FIO)
526 add_dependencies(tests fio_ceph_objectstore)
530 add_ceph_test(run-rbd-unit-tests.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh)
532 add_ceph_test(rbd-ggate.sh ${CMAKE_CURRENT_SOURCE_DIR}/rbd-ggate.sh)
535 add_ceph_test(run-cli-tests ${CMAKE_CURRENT_SOURCE_DIR}/run-cli-tests)
536 add_ceph_test(test_objectstore_memstore.sh ${CMAKE_CURRENT_SOURCE_DIR}/test_objectstore_memstore.sh)
539 #add_ceph_test(test_pidfile.sh ${CMAKE_CURRENT_SOURCE_DIR}/test_pidfile.sh)
541 add_ceph_test(smoke.sh ${CMAKE_CURRENT_SOURCE_DIR}/smoke.sh)
543 # XXX are these safe to remove? they used to be around for ceph-disk tox testing
544 set(env_vars_for_tox_tests
545 CEPH_BUILD_DIR=${CMAKE_BINARY_DIR}
546 CEPH_ROOT=${CMAKE_SOURCE_DIR}
547 CEPH_BIN=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
548 CEPH_LIB=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
549 CEPH_BUILD_VIRTUALENV=${CEPH_BUILD_VIRTUALENV}
550 LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib
551 PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:${CMAKE_SOURCE_DIR}/src
552 PYTHONPATH=${CMAKE_SOURCE_DIR}/src/pybind
553 WITH_PYTHON2=${WITH_PYTHON2}
554 WITH_PYTHON3=${WITH_PYTHON3})
557 add_test(NAME run-tox-mgr-dashboard COMMAND bash ${CMAKE_SOURCE_DIR}/src/pybind/mgr/dashboard/run-tox.sh)
558 list(APPEND tox_tests run-tox-mgr-dashboard)
559 set(MGR_DASHBOARD_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/mgr-dashboard-virtualenv)
560 list(APPEND env_vars_for_tox_tests MGR_DASHBOARD_VIRTUALENV=${MGR_DASHBOARD_VIRTUALENV})
562 add_test(NAME run-tox-mgr-insights COMMAND bash ${CMAKE_SOURCE_DIR}/src/pybind/mgr/insights/run-tox.sh)
563 list(APPEND tox_tests run-tox-mgr-insights)
564 set(MGR_INSIGHTS_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/mgr-insights-virtualenv)
565 list(APPEND env_vars_for_tox_tests MGR_INSIGHTS_VIRTUALENV=${MGR_INSIGHTS_VIRTUALENV})
567 add_test(NAME run-tox-mgr-ansible COMMAND bash ${CMAKE_SOURCE_DIR}/src/pybind/mgr/ansible/run-tox.sh)
568 list(APPEND tox_tests run-tox-mgr-ansible)
569 set(MGR_ANSIBLE_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/mgr-ansible-virtualenv)
570 list(APPEND env_vars_for_tox_tests MGR_ANSIBLE_VIRTUALENV=${MGR_ANSIBLE_VIRTUALENV})
572 add_test(NAME run-tox-mgr-orchestrator_cli COMMAND bash ${CMAKE_SOURCE_DIR}/src/pybind/mgr/orchestrator_cli/run-tox.sh)
573 list(APPEND tox_tests run-tox-mgr-orchestrator_cli)
574 set(MGR_ORCHESTRATOR_CLI_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/mgr-orchestrator_cli-virtualenv)
575 list(APPEND env_vars_for_tox_tests MGR_ORCHESTRATOR_CLI_VIRTUALENV=${MGR_ORCHESTRATOR_CLI_VIRTUALENV})
580 PROPERTY ENVIRONMENT ${env_vars_for_tox_tests})
582 # unittest_admin_socket
583 add_executable(unittest_admin_socket
585 $<TARGET_OBJECTS:unit-main>
587 add_ceph_unittest(unittest_admin_socket)
588 target_link_libraries(unittest_admin_socket global)
591 add_executable(unittest_encoding
594 add_ceph_unittest(unittest_encoding)
595 target_link_libraries(unittest_encoding ceph-common)
598 add_executable(unittest_addrs
601 add_ceph_unittest(unittest_addrs)
602 target_link_libraries(unittest_addrs ceph-common)
605 add_executable(unittest_auth
607 $<TARGET_OBJECTS:unit-main>
609 add_ceph_unittest(unittest_auth)
610 target_link_libraries(unittest_auth global)
613 add_executable(unittest_workqueue
615 $<TARGET_OBJECTS:unit-main>
617 add_ceph_unittest(unittest_workqueue)
618 target_link_libraries(unittest_workqueue global)
621 if(WITH_LIBRADOSSTRIPER)
622 add_executable(unittest_striper
624 $<TARGET_OBJECTS:unit-main>
626 add_ceph_unittest(unittest_striper)
627 target_link_libraries(unittest_striper global ${BLKID_LIBRARIES})
631 add_executable(unittest_str_list
634 add_ceph_unittest(unittest_str_list)
635 target_link_libraries(unittest_str_list global)
638 add_executable(unittest_log
639 ${CMAKE_SOURCE_DIR}/src/log/test.cc
641 add_ceph_unittest(unittest_log)
642 target_link_libraries(unittest_log global)
645 add_executable(unittest_base64
648 add_ceph_unittest(unittest_base64)
649 target_link_libraries(unittest_base64 global)
651 # unittest_ceph_argparse
652 add_executable(unittest_ceph_argparse
655 add_ceph_unittest(unittest_ceph_argparse)
656 target_link_libraries(unittest_ceph_argparse global)
658 # unittest_ceph_compatset
659 add_executable(unittest_ceph_compatset
662 add_ceph_unittest(unittest_ceph_compatset)
663 target_link_libraries(unittest_ceph_compatset global)
666 add_executable(unittest_gather
668 $<TARGET_OBJECTS:unit-main>
670 add_ceph_unittest(unittest_gather)
671 target_link_libraries(unittest_gather global)
674 add_executable(unittest_run_cmd
677 add_ceph_unittest(unittest_run_cmd)
678 target_link_libraries(unittest_run_cmd global)
681 add_executable(unittest_signals
683 $<TARGET_OBJECTS:unit-main>
685 add_ceph_unittest(unittest_signals)
686 target_link_libraries(unittest_signals global)
688 # unittest_simple_spin
689 add_executable(unittest_simple_spin
692 add_ceph_unittest(unittest_simple_spin)
693 target_link_libraries(unittest_simple_spin global)
695 # unittest_bufferlist
696 add_executable(unittest_bufferlist
698 $<TARGET_OBJECTS:unit-main>
700 add_ceph_unittest(unittest_bufferlist)
701 target_link_libraries(unittest_bufferlist global)
704 add_executable(unittest_xlist
707 add_ceph_unittest(unittest_xlist)
708 target_link_libraries(unittest_xlist ceph-common)
711 add_executable(unittest_arch
713 $<TARGET_OBJECTS:unit-main>
715 add_ceph_unittest(unittest_arch)
716 target_link_libraries(unittest_arch global)
719 add_executable(unittest_denc
722 add_ceph_unittest(unittest_denc)
723 target_link_libraries(unittest_denc global)
726 add_executable(unittest_mempool
729 add_ceph_unittest(unittest_mempool)
730 target_link_libraries(unittest_mempool global)
733 add_executable(unittest_features
736 add_ceph_unittest(unittest_features)
737 target_link_libraries(unittest_features global)
740 add_executable(unittest_crypto
742 $<TARGET_OBJECTS:unit-main>
744 add_ceph_unittest(unittest_crypto)
745 target_link_libraries(unittest_crypto global)
747 # unittest_crypto_init
748 add_executable(unittest_crypto_init
751 add_ceph_unittest(unittest_crypto_init)
752 target_link_libraries(unittest_crypto_init global)
754 # unittest_perf_counters
755 add_executable(unittest_perf_counters
758 add_ceph_unittest(unittest_perf_counters)
759 target_link_libraries(unittest_perf_counters global)
761 # unittest_ceph_crypto
762 add_executable(unittest_ceph_crypto
765 add_ceph_unittest(unittest_ceph_crypto)
766 target_link_libraries(unittest_ceph_crypto global)
769 add_executable(unittest_utf8
772 add_ceph_unittest(unittest_utf8)
773 target_link_libraries(unittest_utf8 global)
776 add_executable(unittest_mime
779 add_ceph_unittest(unittest_mime)
780 target_link_libraries(unittest_mime global)
783 add_executable(unittest_escape
786 add_ceph_unittest(unittest_escape)
787 target_link_libraries(unittest_escape global)
790 add_executable(unittest_strtol
793 add_ceph_unittest(unittest_strtol)
794 target_link_libraries(unittest_strtol global)
797 add_executable(unittest_confutils
800 add_ceph_unittest(unittest_confutils)
801 target_link_libraries(unittest_confutils global)
803 # unittest_heartbeatmap
804 add_executable(unittest_heartbeatmap
806 $<TARGET_OBJECTS:unit-main>
808 add_ceph_unittest(unittest_heartbeatmap)
809 target_link_libraries(unittest_heartbeatmap global ceph-common)
813 add_executable(unittest_formatter
815 $<TARGET_OBJECTS:unit-main>
817 add_ceph_unittest(unittest_formatter)
818 target_link_libraries(unittest_formatter global)
819 endif(${WITH_RADOSGW})
821 # unittest_daemon_config
822 add_executable(unittest_daemon_config
824 $<TARGET_OBJECTS:unit-main>
826 add_ceph_unittest(unittest_daemon_config)
827 target_link_libraries(unittest_daemon_config
835 # unittest_libcephfs_config
836 add_executable(unittest_libcephfs_config
839 add_ceph_unittest(unittest_libcephfs_config)
840 target_link_libraries(unittest_libcephfs_config cephfs)
841 endif(WITH_LIBCEPHFS)
844 # unittest_rbd_replay
845 add_executable(unittest_rbd_replay
847 add_ceph_unittest(unittest_rbd_replay)
848 target_link_libraries(unittest_rbd_replay
859 add_executable(unittest_ipaddr
861 add_ceph_unittest(unittest_ipaddr)
862 target_link_libraries(unittest_ipaddr mon global)
865 add_executable(unittest_texttable
867 $<TARGET_OBJECTS:common_texttable_obj>
869 add_ceph_unittest(unittest_texttable)
870 target_link_libraries(unittest_texttable mon global)
873 add_executable(unittest_on_exit
876 add_ceph_unittest(unittest_on_exit)
877 target_link_libraries(unittest_on_exit global)
879 # unittest_subprocess
880 add_executable(unittest_subprocess
883 add_ceph_unittest(unittest_subprocess)
884 target_link_libraries(unittest_subprocess global)
887 add_executable(unittest_pageset test_pageset.cc)
888 add_ceph_unittest(unittest_pageset)
889 target_link_libraries(unittest_pageset global)
892 add_executable(unittest_any test_any.cc)
893 add_ceph_unittest(unittest_any)
894 target_link_libraries(unittest_any)
896 #make check ends here