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)
71 add_subdirectory(lazy-omap-stats)
74 add_executable(ceph_test_timers
77 target_link_libraries(ceph_test_timers global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
79 # test_signal_handlers
80 add_executable(ceph_test_signal_handlers
83 target_link_libraries(ceph_test_signal_handlers global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
85 # test_rewrite_latency
86 add_executable(ceph_test_rewrite_latency
87 test_rewrite_latency.cc
89 target_link_libraries(ceph_test_rewrite_latency ceph-common
91 ${CMAKE_THREAD_LIBS_INIT} ${CRYPTO_LIBS} m ${EXTRALIBS})
94 add_executable(test_crypto
97 target_link_libraries(test_crypto
106 add_executable(test_build_libcommon buildtest_skeleton.cc)
107 target_link_libraries(test_build_libcommon ceph-common pthread ${CRYPTO_LIBS} ${EXTRALIBS})
110 add_executable(test_build_librgw buildtest_skeleton.cc)
111 target_link_libraries(test_build_librgw rgw_a pthread ${CRYPTO_LIBS} ${EXTRALIBS})
115 add_executable(test_build_librgw_admin_user buildtest_skeleton.cc)
116 target_link_libraries(test_build_librgw_admin_user pthread ${CRYPTO_LIBS} ${EXTRALIBS})
120 # From src/test/Makefile-client.am: I dont get this one... testing the osdc build but link in libcephfs?
121 add_executable(test_build_libcephfs buildtest_skeleton.cc)
122 target_link_libraries(test_build_libcephfs cephfs pthread ${CRYPTO_LIBS} ${EXTRALIBS})
123 endif(WITH_LIBCEPHFS)
125 add_executable(test_build_librados buildtest_skeleton.cc)
126 target_link_libraries(test_build_librados librados pthread ${CRYPTO_LIBS} ${EXTRALIBS} osdc osd os ceph-common cls_lock_client ${BLKID_LIBRARIES})
132 add_executable(ceph_bench_log
135 target_link_libraries(ceph_bench_log global pthread rt ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
138 add_executable(ceph_test_mutate
141 target_link_libraries(ceph_test_mutate global librados ${BLKID_LIBRARIES}
145 add_executable(test_trans
148 target_link_libraries(test_trans os global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
157 add_executable(ceph_omapbench
160 target_link_libraries(ceph_omapbench
162 Boost::program_options
170 set(kvstorebench_srcs
172 ${CMAKE_SOURCE_DIR}/src/key_value_store/kv_flat_btree_async.cc
174 add_executable(ceph_kvstorebench ${kvstorebench_srcs})
175 target_link_libraries(ceph_kvstorebench librados global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
176 install(TARGETS ceph_kvstorebench DESTINATION bin)
179 # ceph_objectstore_bench
180 add_executable(ceph_objectstore_bench objectstore_bench.cc)
181 target_link_libraries(ceph_objectstore_bench os global ${BLKID_LIBRARIES})
185 set(test_cors_srcs test_cors.cc)
186 add_executable(test_cors
189 target_link_libraries(test_cors
196 ${CMAKE_DL_LIBS} ${UNITTEST_LIBS})
198 # ceph_test_cls_rgw_meta
199 set(test_cls_rgw_meta_srcs test_rgw_admin_meta.cc)
200 add_executable(ceph_test_cls_rgw_meta
201 ${test_cls_rgw_meta_srcs}
203 target_link_libraries(ceph_test_cls_rgw_meta
216 ${CMAKE_DL_LIBS} ${UNITTEST_LIBS} ${CRYPTO_LIBS})
219 ceph_test_cls_rgw_meta
220 DESTINATION ${CMAKE_INSTALL_BINDIR})
222 # ceph_test_cls_rgw_log
223 set(ceph_test_cls_rgw_log_srcs
224 test_rgw_admin_log.cc
226 add_executable(ceph_test_cls_rgw_log
227 ${ceph_test_cls_rgw_log_srcs}
229 target_link_libraries(ceph_test_cls_rgw_log
248 # ceph_test_librgw_file (nfs-like RGW interface)
249 add_executable(ceph_test_librgw_file
252 if(WITH_RADOSGW_FCGI_FRONTEND)
253 target_include_directories(ceph_test_librgw_file SYSTEM PRIVATE ${FCGI_INCLUDE_DIR})
254 endif(WITH_RADOSGW_FCGI_FRONTEND)
255 target_link_libraries(ceph_test_librgw_file
263 # ceph_test_librgw_file_cd (just the rgw_file create-delete bucket ops)
264 add_executable(ceph_test_librgw_file_cd
267 target_link_libraries(ceph_test_librgw_file_cd
275 # ceph_test_librgw_file_gp (just the rgw_file get-put bucket ops)
276 add_executable(ceph_test_librgw_file_gp
279 target_link_libraries(ceph_test_librgw_file_gp
287 # ceph_test_librgw_file_nfsns (nfs namespace tests)
288 add_executable(ceph_test_librgw_file_nfsns
291 if(WITH_RADOSGW_FCGI_FRONTEND)
292 target_include_directories(ceph_test_librgw_file_nfsns SYSTEM PRIVATE ${FCGI_INCLUDE_DIR})
293 endif(WITH_RADOSGW_FCGI_FRONTEND)
294 target_link_libraries(ceph_test_librgw_file_nfsns
302 # ceph_test_librgw_file_aw (nfs write transaction [atomic write] tests)
303 add_executable(ceph_test_librgw_file_aw
306 target_link_libraries(ceph_test_librgw_file_aw
314 # ceph_test_librgw_file_marker (READDIR with string and uint64 offsets)
315 add_executable(ceph_test_librgw_file_marker
316 librgw_file_marker.cc
318 target_link_libraries(ceph_test_librgw_file_marker
326 # ceph_test_rgw_token
327 add_executable(ceph_test_rgw_token
330 target_link_libraries(ceph_test_rgw_token
338 # librgw_file_gp (just the rgw_file get-put bucket ops)
339 add_executable(test_rgw_ldap
340 ${CMAKE_SOURCE_DIR}/src/rgw/rgw_ldap.cc
343 target_link_libraries(test_rgw_ldap
346 ${OPENLDAP_LIBRARIES}
350 # unittest_librgw_admin_user
351 add_executable(ceph_test_librgw_admin_user test_librgw_admin_user.cc)
352 target_link_libraries(ceph_test_librgw_admin_user
361 endif(${WITH_RADOSGW})
363 # ceph_multi_stress_watch
364 add_executable(ceph_multi_stress_watch
365 multi_stress_watch.cc
367 target_link_libraries(ceph_multi_stress_watch librados global radostest-cxx
368 ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
371 add_executable(ceph_perf_local
375 set(PERF_LOCAL_FLAGS ${SSE3_FLAGS})
378 set(PERF_LOCAL_FLAGS ${ARM_NEON_FLAGS})
381 set_target_properties(ceph_perf_local PROPERTIES COMPILE_FLAGS
384 target_link_libraries(ceph_perf_local os global ${UNITTEST_LIBS})
388 ceph_multi_stress_watch
389 ceph_objectstore_bench
394 # ceph_test_filejournal
395 add_executable(ceph_test_filejournal
398 target_link_libraries(ceph_test_filejournal
409 ceph_test_filejournal
410 DESTINATION ${CMAKE_INSTALL_BINDIR})
413 add_executable(ceph_test_keys
416 target_link_libraries(ceph_test_keys mon global ${CMAKE_DL_LIBS})
418 # ceph_test_snap_mapper
419 add_executable(ceph_test_snap_mapper
421 $<TARGET_OBJECTS:unit-main>
423 target_link_libraries(ceph_test_snap_mapper osd global ${BLKID_LIBRARIES} ${UNITTEST_LIBS})
425 add_executable(ceph_test_stress_watch
428 target_link_libraries(ceph_test_stress_watch
437 ceph_test_stress_watch
438 DESTINATION ${CMAKE_INSTALL_BINDIR})
441 add_executable(ceph_test_cfuse_cache_invalidate
442 test_cfuse_cache_invalidate.cc
444 target_link_libraries(ceph_test_cfuse_cache_invalidate
450 add_executable(test_c_headers
453 target_link_libraries(test_c_headers
456 endif(${WITH_CEPHFS})
458 if(HAVE_BLKID OR FREEBSD)
459 add_executable(ceph_test_get_blkdev_props
460 test_get_blkdev_props.cc
462 target_link_libraries(ceph_test_get_blkdev_props
469 endif(HAVE_BLKID OR FREEBSD)
471 # ceph_test_admin_socket_output
473 find_package(StdFilesystem)
474 if(StdFilesystem_FOUND)
475 add_executable(ceph_test_admin_socket_output
476 test_admin_socket_output.cc
477 admin_socket_output.cc
478 admin_socket_output_tests.cc)
479 target_link_libraries(ceph_test_admin_socket_output
480 ceph-common StdFilesystem::filesystem)
482 ceph_test_admin_socket_output
483 DESTINATION ${CMAKE_INSTALL_BINDIR})
486 #make check starts here
488 #following dependencies are run inside make check unit tests
489 add_dependencies(tests
492 get_command_descriptions
499 ceph-objectstore-tool
506 ceph_test_objectstore
507 ceph_erasure_code_non_regression
509 cython${PY_BINDING_INFIX}_modules)
511 add_dependencies(tests ceph-mds)
514 add_dependencies(tests ceph-mgr)
517 add_dependencies(tests unittest_librbd rbd)
519 add_dependencies(tests rbd-ggate)
523 add_dependencies(tests radosgw radosgw-admin)
525 #add dependency from fio just to ensure the plugin build isn't failing
526 if(WITH_FIO OR WITH_SYSTEM_FIO)
527 add_dependencies(tests fio_ceph_objectstore)
531 add_ceph_test(run-rbd-unit-tests.sh ${CMAKE_CURRENT_SOURCE_DIR}/run-rbd-unit-tests.sh)
533 add_ceph_test(rbd-ggate.sh ${CMAKE_CURRENT_SOURCE_DIR}/rbd-ggate.sh)
536 add_ceph_test(run-cli-tests ${CMAKE_CURRENT_SOURCE_DIR}/run-cli-tests)
537 add_ceph_test(test_objectstore_memstore.sh ${CMAKE_CURRENT_SOURCE_DIR}/test_objectstore_memstore.sh)
540 #add_ceph_test(test_pidfile.sh ${CMAKE_CURRENT_SOURCE_DIR}/test_pidfile.sh)
542 add_ceph_test(smoke.sh ${CMAKE_CURRENT_SOURCE_DIR}/smoke.sh)
544 # XXX are these safe to remove? they used to be around for ceph-disk tox testing
545 set(env_vars_for_tox_tests
546 CEPH_BUILD_DIR=${CMAKE_BINARY_DIR}
547 CEPH_ROOT=${CMAKE_SOURCE_DIR}
548 CEPH_BIN=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
549 CEPH_LIB=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
550 CEPH_BUILD_VIRTUALENV=${CEPH_BUILD_VIRTUALENV}
551 LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib
552 PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:${CMAKE_SOURCE_DIR}/src
553 PYTHONPATH=${CMAKE_SOURCE_DIR}/src/pybind
554 WITH_PYTHON2=${WITH_PYTHON2}
555 WITH_PYTHON3=${WITH_PYTHON3})
558 add_test(NAME run-tox-mgr-dashboard COMMAND bash ${CMAKE_SOURCE_DIR}/src/pybind/mgr/dashboard/run-tox.sh)
559 list(APPEND tox_tests run-tox-mgr-dashboard)
560 set(MGR_DASHBOARD_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/mgr-dashboard-virtualenv)
561 list(APPEND env_vars_for_tox_tests MGR_DASHBOARD_VIRTUALENV=${MGR_DASHBOARD_VIRTUALENV})
563 add_test(NAME run-tox-mgr-insights COMMAND bash ${CMAKE_SOURCE_DIR}/src/pybind/mgr/insights/run-tox.sh)
564 list(APPEND tox_tests run-tox-mgr-insights)
565 set(MGR_INSIGHTS_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/mgr-insights-virtualenv)
566 list(APPEND env_vars_for_tox_tests MGR_INSIGHTS_VIRTUALENV=${MGR_INSIGHTS_VIRTUALENV})
568 add_test(NAME run-tox-mgr-ansible COMMAND bash ${CMAKE_SOURCE_DIR}/src/pybind/mgr/ansible/run-tox.sh)
569 list(APPEND tox_tests run-tox-mgr-ansible)
570 set(MGR_ANSIBLE_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/mgr-ansible-virtualenv)
571 list(APPEND env_vars_for_tox_tests MGR_ANSIBLE_VIRTUALENV=${MGR_ANSIBLE_VIRTUALENV})
573 add_test(NAME run-tox-mgr-orchestrator_cli COMMAND bash ${CMAKE_SOURCE_DIR}/src/pybind/mgr/orchestrator_cli/run-tox.sh)
574 list(APPEND tox_tests run-tox-mgr-orchestrator_cli)
575 set(MGR_ORCHESTRATOR_CLI_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/mgr-orchestrator_cli-virtualenv)
576 list(APPEND env_vars_for_tox_tests MGR_ORCHESTRATOR_CLI_VIRTUALENV=${MGR_ORCHESTRATOR_CLI_VIRTUALENV})
581 PROPERTY ENVIRONMENT ${env_vars_for_tox_tests})
583 # unittest_admin_socket
584 add_executable(unittest_admin_socket
586 $<TARGET_OBJECTS:unit-main>
588 add_ceph_unittest(unittest_admin_socket)
589 target_link_libraries(unittest_admin_socket global)
592 add_executable(unittest_encoding
595 add_ceph_unittest(unittest_encoding)
596 target_link_libraries(unittest_encoding ceph-common)
599 add_executable(unittest_addrs
602 add_ceph_unittest(unittest_addrs)
603 target_link_libraries(unittest_addrs ceph-common)
606 add_executable(unittest_auth
608 $<TARGET_OBJECTS:unit-main>
610 add_ceph_unittest(unittest_auth)
611 target_link_libraries(unittest_auth global)
614 add_executable(unittest_workqueue
616 $<TARGET_OBJECTS:unit-main>
618 add_ceph_unittest(unittest_workqueue)
619 target_link_libraries(unittest_workqueue global)
622 if(WITH_LIBRADOSSTRIPER)
623 add_executable(unittest_striper
625 $<TARGET_OBJECTS:unit-main>
627 add_ceph_unittest(unittest_striper)
628 target_link_libraries(unittest_striper global ${BLKID_LIBRARIES})
632 add_executable(unittest_str_list
635 add_ceph_unittest(unittest_str_list)
636 target_link_libraries(unittest_str_list global)
639 add_executable(unittest_log
640 ${CMAKE_SOURCE_DIR}/src/log/test.cc
642 add_ceph_unittest(unittest_log)
643 target_link_libraries(unittest_log global)
646 add_executable(unittest_base64
649 add_ceph_unittest(unittest_base64)
650 target_link_libraries(unittest_base64 global)
652 # unittest_ceph_argparse
653 add_executable(unittest_ceph_argparse
656 add_ceph_unittest(unittest_ceph_argparse)
657 target_link_libraries(unittest_ceph_argparse global)
659 # unittest_ceph_compatset
660 add_executable(unittest_ceph_compatset
663 add_ceph_unittest(unittest_ceph_compatset)
664 target_link_libraries(unittest_ceph_compatset global)
667 add_executable(unittest_gather
669 $<TARGET_OBJECTS:unit-main>
671 add_ceph_unittest(unittest_gather)
672 target_link_libraries(unittest_gather global)
675 add_executable(unittest_run_cmd
678 add_ceph_unittest(unittest_run_cmd)
679 target_link_libraries(unittest_run_cmd global)
682 add_executable(unittest_signals
684 $<TARGET_OBJECTS:unit-main>
686 add_ceph_unittest(unittest_signals)
687 target_link_libraries(unittest_signals global)
689 # unittest_simple_spin
690 add_executable(unittest_simple_spin
693 add_ceph_unittest(unittest_simple_spin)
694 target_link_libraries(unittest_simple_spin global)
696 # unittest_bufferlist
697 add_executable(unittest_bufferlist
699 $<TARGET_OBJECTS:unit-main>
701 add_ceph_unittest(unittest_bufferlist)
702 target_link_libraries(unittest_bufferlist global)
705 add_executable(unittest_xlist
708 add_ceph_unittest(unittest_xlist)
709 target_link_libraries(unittest_xlist ceph-common)
712 add_executable(unittest_arch
714 $<TARGET_OBJECTS:unit-main>
716 add_ceph_unittest(unittest_arch)
717 target_link_libraries(unittest_arch global)
720 add_executable(unittest_denc
723 add_ceph_unittest(unittest_denc)
724 target_link_libraries(unittest_denc global)
727 add_executable(unittest_mempool
730 add_ceph_unittest(unittest_mempool)
731 target_link_libraries(unittest_mempool global)
734 add_executable(unittest_features
737 add_ceph_unittest(unittest_features)
738 target_link_libraries(unittest_features global)
741 add_executable(unittest_crypto
743 $<TARGET_OBJECTS:unit-main>
745 add_ceph_unittest(unittest_crypto)
746 target_link_libraries(unittest_crypto global)
748 # unittest_crypto_init
749 add_executable(unittest_crypto_init
752 add_ceph_unittest(unittest_crypto_init)
753 target_link_libraries(unittest_crypto_init global)
755 # unittest_perf_counters
756 add_executable(unittest_perf_counters
759 add_ceph_unittest(unittest_perf_counters)
760 target_link_libraries(unittest_perf_counters global)
762 # unittest_ceph_crypto
763 add_executable(unittest_ceph_crypto
766 add_ceph_unittest(unittest_ceph_crypto)
767 target_link_libraries(unittest_ceph_crypto global)
770 add_executable(unittest_utf8
773 add_ceph_unittest(unittest_utf8)
774 target_link_libraries(unittest_utf8 global)
777 add_executable(unittest_mime
780 add_ceph_unittest(unittest_mime)
781 target_link_libraries(unittest_mime global)
784 add_executable(unittest_escape
787 add_ceph_unittest(unittest_escape)
788 target_link_libraries(unittest_escape global)
791 add_executable(unittest_strtol
794 add_ceph_unittest(unittest_strtol)
795 target_link_libraries(unittest_strtol global)
798 add_executable(unittest_confutils
801 add_ceph_unittest(unittest_confutils)
802 target_link_libraries(unittest_confutils global)
804 # unittest_heartbeatmap
805 add_executable(unittest_heartbeatmap
807 $<TARGET_OBJECTS:unit-main>
809 add_ceph_unittest(unittest_heartbeatmap)
810 target_link_libraries(unittest_heartbeatmap global ceph-common)
814 add_executable(unittest_formatter
816 $<TARGET_OBJECTS:unit-main>
818 add_ceph_unittest(unittest_formatter)
819 target_link_libraries(unittest_formatter global)
820 endif(${WITH_RADOSGW})
822 # unittest_daemon_config
823 add_executable(unittest_daemon_config
825 $<TARGET_OBJECTS:unit-main>
827 add_ceph_unittest(unittest_daemon_config)
828 target_link_libraries(unittest_daemon_config
836 # unittest_libcephfs_config
837 add_executable(unittest_libcephfs_config
840 add_ceph_unittest(unittest_libcephfs_config)
841 target_link_libraries(unittest_libcephfs_config cephfs)
842 endif(WITH_LIBCEPHFS)
845 # unittest_rbd_replay
846 add_executable(unittest_rbd_replay
848 add_ceph_unittest(unittest_rbd_replay)
849 target_link_libraries(unittest_rbd_replay
860 add_executable(unittest_ipaddr
862 add_ceph_unittest(unittest_ipaddr)
863 target_link_libraries(unittest_ipaddr mon global)
866 add_executable(unittest_texttable
868 $<TARGET_OBJECTS:common_texttable_obj>
870 add_ceph_unittest(unittest_texttable)
871 target_link_libraries(unittest_texttable mon global)
874 add_executable(unittest_on_exit
877 add_ceph_unittest(unittest_on_exit)
878 target_link_libraries(unittest_on_exit global)
880 # unittest_subprocess
881 add_executable(unittest_subprocess
884 add_ceph_unittest(unittest_subprocess)
885 target_link_libraries(unittest_subprocess global)
888 add_executable(unittest_pageset test_pageset.cc)
889 add_ceph_unittest(unittest_pageset)
890 target_link_libraries(unittest_pageset global)
893 add_executable(unittest_any test_any.cc)
894 add_ceph_unittest(unittest_any)
895 target_link_libraries(unittest_any)
897 #make check ends here