From a683f0d11cc2bc259aa63c7927ee7d689e9835b8 Mon Sep 17 00:00:00 2001 From: Yaming Kuang Date: Wed, 6 Mar 2024 18:43:51 -0700 Subject: [PATCH] depend on all --- src/tests/CMakeLists.txt | 115 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 2 deletions(-) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index fda049348..53f84b8ee 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -13,14 +13,125 @@ if (${build_nonio_tests}) # Ignoring sign-compare only for this test file because it uses folly concurrent_skip_list which violates this check. set_source_files_properties(test_blkalloc.cpp PROPERTIES COMPILE_OPTIONS "-Wno-sign-compare" ) + add_executable(test_blkalloc) + target_sources(test_blkalloc PRIVATE test_blkalloc.cpp $) + target_link_libraries(test_blkalloc homestore ${COMMON_TEST_DEPS} ) + add_test(NAME BlkAlloc COMMAND ${CMAKE_BINARY_DIR}/bin/test_blkalloc) + + add_executable(test_blk_cache_queue) + target_sources(test_blk_cache_queue PRIVATE test_blk_cache_queue.cpp ../lib/blkalloc/blk_cache_queue.cpp) + target_link_libraries(test_blk_cache_queue homestore ${COMMON_TEST_DEPS} ) + add_test(NAME BlkCacheQueue COMMAND test_blk_cache_queue) + + set(TEST_JOURNAL_VDEV_SOURCES test_journal_vdev.cpp) + add_executable(test_journal_vdev ${TEST_JOURNAL_VDEV_SOURCES}) + target_link_libraries(test_journal_vdev homestore ${COMMON_TEST_DEPS} GTest::gmock) + add_test(NAME JournalVDev COMMAND ${CMAKE_BINARY_DIR}/bin/test_journal_vdev) + + set(TEST_BTREENODE_SOURCE_FILES test_btree_node.cpp) + add_executable(test_btree_node ${TEST_BTREENODE_SOURCE_FILES}) + target_link_libraries(test_btree_node ${COMMON_TEST_DEPS} GTest::gtest) + add_test(NAME BtreeNode COMMAND test_btree_node) + + set(TEST_MEMBTREE_SOURCE_FILES test_mem_btree.cpp) + add_executable(test_mem_btree ${TEST_MEMBTREE_SOURCE_FILES}) + target_link_libraries(test_mem_btree ${COMMON_TEST_DEPS} GTest::gtest) + add_test(NAME MemBtree COMMAND test_mem_btree) + set_tests_properties(MemBtree PROPERTIES TIMEOUT 1200) + + add_executable(test_blk_read_tracker) + target_sources(test_blk_read_tracker PRIVATE test_blk_read_tracker.cpp ../lib/blkdata_svc/blk_read_tracker.cpp ../lib/blkalloc/blk.cpp) + target_link_libraries(test_blk_read_tracker ${COMMON_TEST_DEPS} GTest::gtest) + add_test(NAME BlkReadTracker COMMAND test_blk_read_tracker) + + set(TEST_PDEV_SOURCES test_pdev.cpp) + add_executable(test_physical_device ${TEST_PDEV_SOURCES}) + target_link_libraries(test_physical_device homestore ${COMMON_TEST_DEPS} GTest::gmock) + add_test(NAME PhysicalDev COMMAND test_physical_device) + + set(TEST_DEV_MGR_SOURCES test_device_manager.cpp) + add_executable(test_device_manager ${TEST_DEV_MGR_SOURCES}) + target_link_libraries(test_device_manager homestore ${COMMON_TEST_DEPS} GTest::gmock) + add_test(NAME DeviceManager COMMAND test_device_manager) + + add_executable(test_append_blk_allocator) + target_sources(test_append_blk_allocator PRIVATE test_append_blkalloc.cpp) + target_link_libraries(test_append_blk_allocator homestore ${COMMON_TEST_DEPS} GTest::gmock) + add_test(NAME AppendBlkAlloc COMMAND test_append_blk_allocator) + set_property(TEST AppendBlkAlloc PROPERTY ENVIRONMENT "ASAN_OPTIONS=detect_stack_use_after_return=true") + + set(TEST_BLKID_SOURCES test_blkid.cpp ../lib/blkalloc/blk.cpp) + add_executable(test_blkid ${TEST_BLKID_SOURCES}) + target_link_libraries(test_blkid ${COMMON_TEST_DEPS} GTest::gtest) + add_test(NAME TestBlkid COMMAND test_blkid) + +endif() + +can_build_io_tests(io_tests) +if (${io_tests}) + set(TEST_INDEXBTREE_SOURCE_FILES test_index_btree.cpp) + add_executable(test_index_btree ${TEST_INDEXBTREE_SOURCE_FILES}) + target_link_libraries(test_index_btree homestore ${COMMON_TEST_DEPS} GTest::gtest) + #TODO : Fix the test case and enable it + add_test(NAME IndexBtree COMMAND test_index_btree --gtest_filter=*/0.*) + set_property(TEST IndexBtree PROPERTY ENVIRONMENT "ASAN_OPTIONS=detect_stack_use_after_return=true") + set_tests_properties(IndexBtree PROPERTIES TIMEOUT 1200) + + add_executable(test_data_service) + target_sources(test_data_service PRIVATE test_data_service.cpp) + target_link_libraries(test_data_service homestore ${COMMON_TEST_DEPS} GTest::gmock) + + add_executable(test_log_store) + target_sources(test_log_store PRIVATE test_log_store.cpp) + target_link_libraries(test_log_store hs_logdev homestore ${COMMON_TEST_DEPS} ) + + set(TEST_METABLK_SOURCE_FILES test_meta_blk_mgr.cpp) + add_executable(test_meta_blk_mgr ${TEST_METABLK_SOURCE_FILES}) + target_link_libraries(test_meta_blk_mgr homestore ${COMMON_TEST_DEPS} GTest::gmock) + + add_executable(test_cp_mgr) + target_sources(test_cp_mgr PRIVATE test_cp_mgr.cpp) + target_link_libraries(test_cp_mgr homestore ${COMMON_TEST_DEPS} GTest::gtest) + add_test(NAME CPMgr COMMAND test_cp_mgr) + + add_executable(test_solo_repl_dev) + target_sources(test_solo_repl_dev PRIVATE test_solo_repl_dev.cpp) + target_link_libraries(test_solo_repl_dev homestore ${COMMON_TEST_DEPS} GTest::gmock) + + add_executable(test_home_raft_logstore) + target_sources(test_home_raft_logstore PRIVATE test_home_raft_logstore.cpp) + target_link_libraries(test_home_raft_logstore homestore ${COMMON_TEST_DEPS} GTest::gmock) add_executable(test_raft_repl_dev) target_sources(test_raft_repl_dev PRIVATE test_raft_repl_dev.cpp) target_link_libraries(test_raft_repl_dev homestore ${COMMON_TEST_DEPS} GTest::gmock) - add_test(NAME RaftReplDev-Epoll COMMAND ${CMAKE_BINARY_DIR}/bin/test_raft_repl_dev) -endif() + can_build_epoll_io_tests(epoll_tests) + if(${epoll_tests}) + # add_test(NAME LogStore-Epoll COMMAND ${CMAKE_BINARY_DIR}/bin/test_log_store) + add_test(NAME MetaBlkMgr-Epoll COMMAND ${CMAKE_BINARY_DIR}/bin/test_meta_blk_mgr) + add_test(NAME DataService-Epoll COMMAND ${CMAKE_BINARY_DIR}/bin/test_data_service) + # add_test(NAME SoloReplDev-Epoll COMMAND ${CMAKE_BINARY_DIR}/bin/test_solo_repl_dev) + # add_test(NAME HomeRaftLogStore-Epoll COMMAND ${CMAKE_BINARY_DIR}/bin/test_home_raft_logstore) + add_test(NAME RaftReplDev-Epoll COMMAND ${CMAKE_BINARY_DIR}/bin/test_raft_repl_dev) + set_tests_properties(RaftReplDev-Epoll PROPERTIES DEPENDS "DataService-Epoll;MetaBlkMgr-Epoll;MemBtree;IndexBtree;CPMgr;JournalVDev;BlkReadTracker;PhysicalDev;DeviceManager;AppendBlkAlloc;BlkAlloc;BlkCacheQueue;BtreeNode") + endif() + + can_build_spdk_io_tests(spdk_tests) + if(${spdk_tests}) + add_test(NAME LogStore-Spdk COMMAND ${CMAKE_BINARY_DIR}/bin/test_log_store -- --spdk "true") + add_test(NAME MetaBlkMgr-Spdk COMMAND ${CMAKE_BINARY_DIR}/bin/test_meta_blk_mgr -- --spdk "true") + add_test(NAME DataSerice-Spdk COMMAND ${CMAKE_BINARY_DIR}/bin/test_data_service -- --spdk "true") + add_test(NAME SoloReplDev-Spdk COMMAND ${CMAKE_BINARY_DIR}/bin/test_solo_repl_dev -- --spdk "true") + add_test(NAME HomeRaftLogStore-Spdk COMMAND ${CMAKE_BINARY_DIR}/bin/test_home_raft_logstore -- --spdk "true") + add_test(NAME RaftReplDev-Spdk COMMAND ${CMAKE_BINARY_DIR}/bin/test_raft_repl_dev -- --spdk "true") + if(${epoll_tests}) + SET_TESTS_PROPERTIES(MetaBlkMgr-Spdk PROPERTIES DEPENDS LogStore-Spdk) + SET_TESTS_PROPERTIES(DataService-Spdk PROPERTIES DEPENDS MetaBlkMgr-Spdk) + endif() + endif() +endif() is_non_coverage_build(non_coverage_build) if (${non_coverage_build})