1add_compile_options_disable_optimization() 2 3ADD_LIBRARY(mock_dcp OBJECT mock/mock_dcp.cc) 4SET_PROPERTY(TARGET mock_dcp PROPERTY POSITION_INDEPENDENT_CODE 1) 5add_sanitizers(mock_dcp) 6 7ADD_LIBRARY(ep_testsuite_objs OBJECT 8 ep_request_utils.cc 9 ep_testsuite_common.cc 10 ep_test_apis.cc 11 ${EventuallyPersistentEngine_SOURCE_DIR}/src/ext_meta_parser.cc 12 ${EventuallyPersistentEngine_SOURCE_DIR}/src/storeddockey.cc) 13SET_PROPERTY(TARGET ep_testsuite_objs PROPERTY POSITION_INDEPENDENT_CODE 1) 14add_sanitizers(ep_testsuite_objs) 15 16# Single executable containing all class-level unit tests involving 17# EventuallyPersistentEngine driven by GoogleTest. 18# (We end up compiling most of the src/ files of ep-engine for these unit tests, 19# so simpler / quicker just to link them into a single executable). 20ADD_EXECUTABLE(ep-engine_ep_unit_tests 21 ep_request_utils.cc 22 module_tests/atomic_unordered_map_test.cc 23 module_tests/backfill-manager_test.cc 24 module_tests/basic_ll_test.cc 25 module_tests/bloomfilter_test.cc 26 module_tests/bucket_logger_engine_test.cc 27 module_tests/bucket_logger_test.cc 28 module_tests/checkpoint_durability_test.cc 29 module_tests/checkpoint_iterator_test.cc 30 module_tests/checkpoint_remover_test.h 31 module_tests/checkpoint_remover_test.cc 32 module_tests/checkpoint_test.h 33 module_tests/checkpoint_test.cc 34 module_tests/checkpoint_utils.h 35 module_tests/collections/collections_dcp_test.cc 36 module_tests/collections/collections_kvstore_test.cc 37 module_tests/collections/evp_store_collections_dcp_test.cc 38 module_tests/collections/evp_store_collections_dcp_stream_test.cc 39 module_tests/collections/evp_store_collections_eraser_test.cc 40 module_tests/collections/evp_store_collections_test.cc 41 module_tests/collections/filter_test.cc 42 module_tests/collections/manifest_test.cc 43 module_tests/collections/test_manifest.cc 44 module_tests/collections/vbucket_manifest_test.cc 45 module_tests/collections/vbucket_manifest_entry_test.cc 46 module_tests/configuration_test.cc 47 module_tests/defragmenter_test.cc 48 module_tests/dcp_durability_stream_test.cc 49 module_tests/dcp_reflection_test.cc 50 module_tests/dcp_stream_test.cc 51 module_tests/dcp_stream_sync_repl_test.cc 52 module_tests/dcp_test.cc 53 module_tests/dcp_utils.cc 54 module_tests/diskdockey_test.cc 55 module_tests/durability_monitor_test.cc 56 module_tests/ep_unit_tests_main.cc 57 module_tests/ephemeral_bucket_test.cc 58 module_tests/ephemeral_vb_test.cc 59 module_tests/evp_engine_test.cc 60 module_tests/evp_store_durability_test.cc 61 module_tests/evp_store_rollback_test.cc 62 module_tests/evp_store_test.cc 63 module_tests/evp_store_single_threaded_test.cc 64 module_tests/evp_store_warmup_test.cc 65 module_tests/evp_store_with_meta.cc 66 module_tests/evp_vbucket_test.cc 67 module_tests/executorpool_test.cc 68 module_tests/failover_table_test.cc 69 module_tests/flusher_test.cc 70 module_tests/futurequeue_test.cc 71 module_tests/hash_table_eviction_test.cc 72 module_tests/hash_table_perspective_test.cc 73 module_tests/hash_table_test.cc 74 module_tests/hdrhistogram_test.cc 75 module_tests/item_compressor_test.cc 76 module_tests/item_eviction_test.cc 77 module_tests/item_pager_test.cc 78 module_tests/item_test.cc 79 module_tests/kvstore_test.cc 80 module_tests/kv_bucket_test.cc 81 module_tests/memory_tracker_test.cc 82 module_tests/memory_tracking_allocator_test.cc 83 module_tests/mock_hooks_api.cc 84 module_tests/monotonic_test.cc 85 module_tests/mutation_log_test.cc 86 module_tests/objectregistry_test.cc 87 module_tests/mutex_test.cc 88 module_tests/probabilistic_counter_test.cc 89 module_tests/stats_test.cc 90 module_tests/storeddockey_test.cc 91 module_tests/stored_value_test.cc 92 module_tests/stream_container_test.cc 93 module_tests/systemevent_test.cc 94 module_tests/tagged_ptr_test.cc 95 module_tests/test_helpers.cc 96 module_tests/vbucket_test.cc 97 module_tests/vbucket_durability_test.cc 98 module_tests/warmup_test.cc 99 $<TARGET_OBJECTS:mock_dcp> 100 $<TARGET_OBJECTS:ep_objs> 101 $<TARGET_OBJECTS:ep_mocks> 102 $<TARGET_OBJECTS:memory_tracking> 103 $<TARGET_OBJECTS:couchstore_test_fileops> 104 $<TARGET_OBJECTS:couchfile_upgrade_objects> 105 ${Memcached_SOURCE_DIR}/logger/logger_test_fixture.cc) 106 107TARGET_INCLUDE_DIRECTORIES(ep-engine_ep_unit_tests 108 PUBLIC 109 ${Couchstore_SOURCE_DIR}) 110 111TARGET_LINK_LIBRARIES(ep-engine_ep_unit_tests 112 cbcompress 113 dirutils 114 engine_utilities 115 ep-engine_collections 116 gtest 117 gmock 118 hdr_histogram_static 119 JSON_checker 120 memcached_logger 121 mcbp 122 mcd_util 123 mcd_tracing 124 mock_server 125 platform 126 phosphor 127 xattr 128 ${EP_STORAGE_LIBS} 129 ${MALLOC_LIBRARIES} 130 ${LIBEVENT_LIBRARIES} 131 ${FOLLY_LIBRARIES}) 132 133add_sanitizers(ep-engine_ep_unit_tests) 134 135ADD_EXECUTABLE(ep-engine_atomic_ptr_test 136 module_tests/atomic_ptr_test.cc 137 ${EventuallyPersistentEngine_SOURCE_DIR}/src/atomic.cc) 138TARGET_LINK_LIBRARIES(ep-engine_atomic_ptr_test platform) 139 140ADD_EXECUTABLE(ep-engine_couch-fs-stats_test 141 ${EventuallyPersistentEngine_SOURCE_DIR}/src/couch-kvstore/couch-fs-stats.cc 142 ${EventuallyPersistentEngine_SOURCE_DIR}/src/configuration.h 143 module_tests/couch-fs-stats_test.cc 144 ${Couchstore_SOURCE_DIR}/src/crc32.cc 145 $<TARGET_OBJECTS:couchstore_wrapped_fileops_test_framework>) 146TARGET_INCLUDE_DIRECTORIES(ep-engine_couch-fs-stats_test 147 PRIVATE 148 ${Couchstore_SOURCE_DIR} 149 ${Couchstore_SOURCE_DIR}/src) 150TARGET_LINK_LIBRARIES(ep-engine_couch-fs-stats_test 151 gtest 152 gtest_main 153 gmock 154 mcd_util 155 platform 156 phosphor) 157add_sanitizers(ep-engine_couch-fs-stats_test) 158 159ADD_EXECUTABLE(ep-engine_misc_test module_tests/misc_test.cc) 160TARGET_LINK_LIBRARIES(ep-engine_misc_test mcbp platform) 161 162ADD_EXECUTABLE(ep-engine_string_utils_test 163 module_tests/string_utils_test.cc 164 ${EventuallyPersistentEngine_SOURCE_DIR}/src/string_utils.cc) 165TARGET_LINK_LIBRARIES(ep-engine_string_utils_test gtest gtest_main platform) 166 167ADD_TEST(NAME ep-engine_atomic_ptr_test COMMAND ep-engine_atomic_ptr_test) 168ADD_TEST(NAME ep-engine_couch-fs-stats_test COMMAND ep-engine_couch-fs-stats_test) 169ADD_TEST(NAME ep-engine_ep_unit_tests COMMAND ep-engine_ep_unit_tests) 170ADD_TEST(NAME ep-engine_misc_test COMMAND ep-engine_misc_test) 171 172ADD_LIBRARY(timing_tests MODULE module_tests/timing_tests.cc) 173SET_TARGET_PROPERTIES(timing_tests PROPERTIES PREFIX "") 174TARGET_LINK_LIBRARIES(timing_tests mcbp platform) 175 176ADD_LIBRARY(ep_testsuite MODULE 177 ep_testsuite.cc 178 $<TARGET_OBJECTS:ep_testsuite_objs> 179 $<TARGET_OBJECTS:mock_dcp>) 180SET_TARGET_PROPERTIES(ep_testsuite PROPERTIES PREFIX "") 181TARGET_LINK_LIBRARIES(ep_testsuite engine_utilities mcbp mcd_util 182 ${EP_STORAGE_LIBS} cbcompress dirutils JSON_checker 183 platform xattr 184 ${LIBEVENT_LIBRARIES}) 185add_sanitizers(ep_testsuite) 186 187ADD_LIBRARY(ep_testsuite_basic MODULE 188 ep_testsuite_basic.cc 189 $<TARGET_OBJECTS:ep_testsuite_objs> 190 $<TARGET_OBJECTS:mock_dcp> 191 ) 192SET_TARGET_PROPERTIES(ep_testsuite_basic PROPERTIES PREFIX "") 193TARGET_LINK_LIBRARIES(ep_testsuite_basic 194 cbcompress 195 dirutils 196 engine_utilities 197 JSON_checker 198 mcbp 199 mcd_util 200 platform 201 ${LIBEVENT_LIBRARIES} 202 ${SNAPPY_LIBRARIES}) 203add_sanitizers(ep_testsuite_basic) 204 205ADD_LIBRARY(ep_testsuite_dcp MODULE 206 ep_testsuite_dcp.cc 207 $<TARGET_OBJECTS:ep_testsuite_objs> 208 $<TARGET_OBJECTS:mock_dcp> 209 ) 210SET_TARGET_PROPERTIES(ep_testsuite_dcp PROPERTIES PREFIX "") 211TARGET_LINK_LIBRARIES(ep_testsuite_dcp 212 cbcompress 213 dirutils 214 engine_utilities 215 JSON_checker 216 mcbp 217 mcd_util 218 platform 219 ${LIBEVENT_LIBRARIES} 220 ${SNAPPY_LIBRARIES}) 221add_sanitizers(ep_testsuite_dcp) 222 223ADD_LIBRARY(ep_testsuite_checkpoint MODULE 224 ep_testsuite_checkpoint.cc 225 $<TARGET_OBJECTS:ep_testsuite_objs>) 226SET_TARGET_PROPERTIES(ep_testsuite_checkpoint PROPERTIES PREFIX "") 227TARGET_LINK_LIBRARIES(ep_testsuite_checkpoint 228 cbcompress 229 dirutils 230 engine_utilities 231 JSON_checker 232 mcbp 233 mcd_util 234 platform 235 ${LIBEVENT_LIBRARIES} 236 ${SNAPPY_LIBRARIES}) 237add_sanitizers(ep_testsuite_checkpoint) 238 239ADD_LIBRARY(ep_testsuite_xdcr MODULE 240 ep_testsuite_xdcr.cc 241 $<TARGET_OBJECTS:ep_testsuite_objs>) 242SET_TARGET_PROPERTIES(ep_testsuite_xdcr PROPERTIES PREFIX "") 243TARGET_LINK_LIBRARIES(ep_testsuite_xdcr mcd_util engine_utilities 244 mcbp JSON_checker dirutils platform xattr 245 ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES}) 246add_sanitizers(ep_testsuite_xdcr) 247 248# MB-35234: Currently broken due to data race during warmup when enabling 249# durability. 250IF(FALSE) 251 IF (EP_USE_ROCKSDB) 252 ADD_TEST(NAME ep-engine-persistence-unit-tests.rocksdb 253 COMMAND memcached_testapp -E ep -c "backend=rocksdb" --gtest_filter=*PersistToTest*) 254 SET_TESTS_PROPERTIES(ep-engine-persistence-unit-tests.rocksdb PROPERTIES TIMEOUT 300) 255 ENDIF (EP_USE_ROCKSDB) 256ENDIF() 257# Defines a testsuite which runs in full and value eviction 258# (persistent), ephemeral buckets (which has no eviction). 259FUNCTION(ADD_TESTSUITE name timeout) 260 CMAKE_PARSE_ARGUMENTS("arg" "SKIP_MAGMA" "" "" ${ARGN}) 261 262 SET(_cmdline 263 ${Memcached_BINARY_DIR}/engine_testapp 264 -E $<TARGET_FILE:ep> 265 -T $<TARGET_FILE:${name}>) 266 267 # MB-34445: To attempt to identify the cause of the intermittent timeouts in 268 # the ephemeral testsuites, use the 'timeout' program to signal ep_testsuite 269 # with SIGABRT when we timeout; to allow a core dump to be generated of 270 # where the process is stuck. Use the 'timeout' program if applicable. If 271 # not, we just pass the timeout value into the CTest timeout feature. 272 find_program (TIMEOUT_EXE timeout) 273 IF (TIMEOUT_EXE AND NOT WIN32) 274 SET(_cmdline ${TIMEOUT_EXE} --preserve-status --signal=ABRT 275 ${timeout}s ${_cmdline}) 276 # Ideally, we would just not set the TIMEOUT property if we can use 277 # the 'timeout' program, however, it defaults to the value 1500 if we 278 # don't set it which may be smaller than the timeout that we pass into 279 # this function. So, just double the TIMEOUT value that we set so that 280 # it won't interfere with the 'timeout' programs actual timeout. 281 MATH(EXPR timeout "${timeout}*2") 282 ENDIF() 283 284 ADD_TEST(NAME ${name}.value_eviction.comp_passive 285 COMMAND ${_cmdline} -v -e "compression_mode=passive$<SEMICOLON>dbname=./${name}.value_eviction.comp_passive.db") 286 ADD_TEST(NAME ${name}.value_eviction.comp_active 287 COMMAND ${_cmdline} -v -e "compression_mode=active$<SEMICOLON>dbname=./${name}.value_eviction.comp_active.db") 288 ADD_TEST(NAME ${name}.full_eviction.comp_passive 289 COMMAND ${_cmdline} -v -e "compression_mode=passive$<SEMICOLON>item_eviction_policy=full_eviction\ 290$<SEMICOLON>dbname=./${name}.full_eviction.comp_passive.db") 291 ADD_TEST(NAME ${name}.full_eviction.comp_active 292 COMMAND ${_cmdline} -v -e "compression_mode=active$<SEMICOLON>item_eviction_policy=full_eviction\ 293$<SEMICOLON>dbname=./${name}.full_eviction.comp_active.db") 294 SET_TESTS_PROPERTIES(${name}.value_eviction.comp_passive PROPERTIES TIMEOUT ${timeout}) 295 SET_TESTS_PROPERTIES(${name}.value_eviction.comp_active PROPERTIES TIMEOUT ${timeout}) 296 SET_TESTS_PROPERTIES(${name}.full_eviction.comp_passive PROPERTIES TIMEOUT ${timeout}) 297 SET_TESTS_PROPERTIES(${name}.full_eviction.comp_active PROPERTIES TIMEOUT ${timeout}) 298 299 ADD_TEST(NAME ${name}.ephemeral.comp_passive 300 COMMAND ${_cmdline} -v -e "compression_mode=passive$<SEMICOLON>bucket_type=ephemeral\ 301$<SEMICOLON>dbname=./${name}.ephemeral.comp_passive.db") 302 ADD_TEST(NAME ${name}.ephemeral.comp_active 303 COMMAND ${_cmdline} -v -e "compression_mode=active$<SEMICOLON>bucket_type=ephemeral\ 304$<SEMICOLON>dbname=./${name}.ephemeral.comp_active.db") 305 SET_TESTS_PROPERTIES(${name}.ephemeral.comp_passive PROPERTIES TIMEOUT ${timeout}) 306 SET_TESTS_PROPERTIES(${name}.ephemeral.comp_active PROPERTIES TIMEOUT ${timeout}) 307 308 IF (EP_USE_ROCKSDB) 309 ADD_TEST(NAME ${name}.value_eviction.rocksdb 310 COMMAND ${_cmdline} -v -e "dbname=./${name}.value_eviction.rocksdb$<SEMICOLON>backend=rocksdb") 311 ADD_TEST(NAME ${name}.full_eviction.rocksdb 312 COMMAND ${_cmdline} -v -e "item_eviction_policy=full_eviction$<SEMICOLON>dbname=./${name}.full_eviction.rocksdb$<SEMICOLON>backend=rocksdb") 313 SET_TESTS_PROPERTIES(${name}.value_eviction.rocksdb PROPERTIES TIMEOUT ${timeout}) 314 SET_TESTS_PROPERTIES(${name}.full_eviction.rocksdb PROPERTIES TIMEOUT ${timeout}) 315 ENDIF (EP_USE_ROCKSDB) 316 317 IF (EP_USE_MAGMA AND NOT arg_SKIP_MAGMA) 318 ADD_TEST(NAME ${name}.value_eviction.magma 319 COMMAND ${_cmdline} -v -e "dbname=./${name}.value_eviction.magma$<SEMICOLON>backend=magma") 320 ADD_TEST(NAME ${name}.full_eviction.magma 321 COMMAND ${_cmdline} -v -e "item_eviction_policy=full_eviction$<SEMICOLON>dbname=./${name}.full_eviction.magma$<SEMICOLON>backend=magma") 322 SET_TESTS_PROPERTIES(${name}.value_eviction.magma PROPERTIES TIMEOUT ${timeout}) 323 SET_TESTS_PROPERTIES(${name}.full_eviction.magma PROPERTIES TIMEOUT ${timeout}) 324 ENDIF () 325ENDFUNCTION() 326 327# MB-36252: Skipping ep_testsuite under Magma as intermittently times out on 328# Windows 329# MB-36322: Skipping ep_testsuite under TSan + Magma as 330# intermittently timing out. 331IF(WIN32 OR CB_THREADSANITIZER) 332 # Increased timeout on Windows as suite is slower on CV there (IO subsystem 333 # on CV machines slower?) 334 ADD_TESTSUITE(ep_testsuite 600 SKIP_MAGMA) 335ELSE() 336 ADD_TESTSUITE(ep_testsuite 300) 337ENDIF() 338 339ADD_TESTSUITE(ep_testsuite_basic 600) 340 341ADD_TESTSUITE(ep_testsuite_dcp 1200) 342 343# MB-36228: Skipping ep_testsuite_checkpoint under Magma as intermittently hangs on 344# Windows 345ADD_TESTSUITE(ep_testsuite_checkpoint 120 SKIP_MAGMA) 346 347# MB-36226: Skipping ep_testsuite_xdcr under Magma as intermittently hangs on 348# Windows 349IF(WIN32) 350 ADD_TESTSUITE(ep_testsuite_xdcr 120 SKIP_MAGMA) 351ELSE() 352 ADD_TESTSUITE(ep_testsuite_xdcr 120) 353ENDIF() 354 355# ================================ PERF_TESTS ================================ # 356SET(_ep_perfsuite_cmdline $<TARGET_FILE:engine_testapp> -E $<TARGET_FILE:ep> -T $<TARGET_FILE:ep_perfsuite> -v) 357 358# Micro perf tests: value-only eviction mode. Note that it makes no sense to run 359# these tests in full-eviction mode as we disable persistence - see MB-19504. 360ADD_CUSTOM_TARGET(test-perfsuite 361 COMMAND ${_ep_perfsuite_cmdline} 362 DEPENDS engine_testapp 363 ep 364 ep_perfsuite 365 VERBATIM) 366ADD_TEST(NAME ep_perfsuite.value_eviction 367 COMMAND ${_ep_perfsuite_cmdline} -e "dbname=./ep_perfsuite.value_eviction.db") 368 369ADD_TEST(NAME ep_perfsuite.ephemeral 370 COMMAND ${_ep_perfsuite_cmdline} -e "bucket_type=ephemeral$<SEMICOLON>dbname=./ep_perfsuite.ephemeral.db") 371 372# ============================================================================ # 373 374configure_file( 375 ${CMAKE_CURRENT_SOURCE_DIR}/module_tests/test_file_helper.h.in 376 ${CMAKE_CURRENT_BINARY_DIR}/test_file_helper.h) 377