MB-20798: Update queueDirty options in prep for a new option
[ep-engine.git] / CMakeLists.txt
1 PROJECT(EventuallyPersistentEngine)
2 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3
4 IF (${CMAKE_MAJOR_VERSION} GREATER 2)
5     CMAKE_POLICY(SET CMP0042 NEW)
6 ENDIF (${CMAKE_MAJOR_VERSION} GREATER 2)
7
8 INCLUDE(CheckFunctionExists)
9 INCLUDE(CheckIncludeFileCXX)
10 INCLUDE(CheckIncludeFiles)
11 INCLUDE(CheckLibraryExists)
12 INCLUDE(CheckSymbolExists)
13 INCLUDE(CheckTypeSize)
14 INCLUDE(CTest)
15
16 INCLUDE_DIRECTORIES(BEFORE ${CMAKE_INSTALL_PREFIX}/include
17                            ${CMAKE_CURRENT_SOURCE_DIR}
18                            ${CMAKE_CURRENT_SOURCE_DIR}/src
19                            ${CMAKE_CURRENT_BINARY_DIR}/src
20                            ${SNAPPY_INCLUDE_DIR}
21                            ${Platform_SOURCE_DIR}/include
22                            ${Memcached_SOURCE_DIR}
23                            ${Memcached_SOURCE_DIR}/include
24                            ${Couchstore_SOURCE_DIR}/include
25                            ${ForestDB_SOURCE_DIR}/include
26                            ${CMAKE_CURRENT_BINARY_DIR})
27
28 INCLUDE_DIRECTORIES(AFTER
29                     ${gtest_SOURCE_DIR}/include)
30
31 CHECK_INCLUDE_FILES("alloca.h" HAVE_ALLOCA_H)
32 CHECK_INCLUDE_FILES("arpa/inet.h" HAVE_ARPA_INET_H)
33 CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
34 CHECK_INCLUDE_FILES("netdb.h" HAVE_NETDB_H)
35 CHECK_INCLUDE_FILES("mach/mach_time.h" HAVE_MACH_MACH_TIME_H)
36 CHECK_INCLUDE_FILES("poll.h" HAVE_POLL_H)
37 CHECK_INCLUDE_FILES("sysexits.h" HAVE_SYSEXITS_H)
38 CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
39 CHECK_INCLUDE_FILES("sched.h" HAVE_SCHED_H)
40 CHECK_INCLUDE_FILES("sys/socket.h" HAVE_SYS_SOCKET_H)
41 CHECK_INCLUDE_FILES("sys/time.h" HAVE_SYS_TIME_H)
42 CHECK_INCLUDE_FILES("netinet/in.h" HAVE_NETINET_IN_H)
43 CHECK_INCLUDE_FILES("netinet/tcp.h" HAVE_NETINET_TCP_H)
44 CHECK_INCLUDE_FILE_CXX("unordered_map" HAVE_UNORDERED_MAP)
45 CHECK_INCLUDE_FILE_CXX("atomic" HAVE_ATOMIC)
46 CHECK_INCLUDE_FILE_CXX("thread" HAVE_THREAD)
47
48 CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
49 CHECK_FUNCTION_EXISTS(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME)
50 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
51 CHECK_FUNCTION_EXISTS(getopt_long HAVE_GETOPT_LONG)
52
53 # ---- uncomment the lines below ONLY for dev/debugging ---
54 #if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
55 #    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
56 #elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
57 #    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
58 #endif()
59
60 IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
61    EXECUTE_PROCESS(COMMAND git rev-parse HEAD
62                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
63                    OUTPUT_VARIABLE EP_ENGINE_VERSION
64                    OUTPUT_STRIP_TRAILING_WHITESPACE)
65    IF (EP_ENGINE_VERSION STREQUAL "" OR EP_ENGINE_VERSION STREQUAL "HEAD")
66      MESSAGE (FATAL_ERROR "Failed to determine commit SHA!")
67    ENDIF (EP_ENGINE_VERSION STREQUAL "" OR EP_ENGINE_VERSION STREQUAL "HEAD")
68 ELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
69    SET(EP_ENGINE_VERSION "unknown")
70 ENDIF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
71
72 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/src/config.cmake.h
73                 ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
74
75 # Generate the python wrappers
76 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper
77                 ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbepctl)
78 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper
79                 ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbstats)
80 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper
81                 ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbcompact)
82 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper
83                 ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbvdiff)
84 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper
85                 ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbvbucketctl)
86
87 IF (WIN32)
88    INCLUDE_DIRECTORIES(AFTER ${CMAKE_SOURCE_DIR}/platform/include/win32)
89 ENDIF (WIN32)
90
91 ADD_EXECUTABLE(gencode tools/gencode.cc)
92 TARGET_LINK_LIBRARIES(gencode cJSON platform)
93
94 ADD_EXECUTABLE(genconfig tools/genconfig.cc)
95 TARGET_LINK_LIBRARIES(genconfig cJSON platform)
96
97 ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/stats-info.c
98                           ${CMAKE_CURRENT_BINARY_DIR}/src/stats-info.h
99                   COMMAND
100                      gencode -j ${CMAKE_CURRENT_SOURCE_DIR}/docs/stats.json -h ${CMAKE_CURRENT_BINARY_DIR}/src/stats-info.h -c ${CMAKE_CURRENT_BINARY_DIR}/src/stats-info.c -f get_stats_info
101                   DEPENDS
102                         docs/stats.json
103                         gencode
104                   COMMENT "Generating code for stats info")
105
106 ADD_CUSTOM_COMMAND(OUTPUT
107                      ${CMAKE_CURRENT_BINARY_DIR}/src/generated_configuration.cc
108                      ${CMAKE_CURRENT_BINARY_DIR}/src/generated_configuration.h
109                   COMMAND
110                      genconfig ${CMAKE_CURRENT_SOURCE_DIR}/configuration.json
111                   DEPENDS
112                         configuration.json
113                         genconfig
114                   COMMENT "Generating code for configuration class")
115
116 SET(KVSTORE_SOURCE src/crc32.c src/kvstore.cc)
117 SET(COUCH_KVSTORE_SOURCE src/couch-kvstore/couch-kvstore.cc
118             src/couch-kvstore/couch-fs-stats.cc)
119 SET(FOREST_KVSTORE_SOURCE src/forest-kvstore/forest-kvstore.cc)
120 SET(OBJECTREGISTRY_SOURCE src/objectregistry.cc)
121 SET(CONFIG_SOURCE src/configuration.cc
122   ${CMAKE_CURRENT_BINARY_DIR}/src/generated_configuration.cc)
123
124 ADD_LIBRARY(ep SHARED
125             src/access_scanner.cc
126             src/atomic.cc
127             src/backfill.cc
128             src/bgfetcher.cc
129             src/bloomfilter.cc
130             src/checkpoint.cc
131             src/checkpoint_remover.cc
132             src/compress.cc
133             src/conflict_resolution.cc
134             src/connmap.cc
135             src/dcp/backfill-manager.cc
136             src/dcp/backfill.cc
137             src/dcp/consumer.cc
138             src/dcp/flow-control.cc
139             src/dcp/flow-control-manager.cc
140             src/dcp/producer.cc
141             src/dcp/response.cc
142             src/dcp/stream.cc
143             src/defragmenter.cc
144             src/defragmenter_visitor.cc
145             src/ep.cc
146             src/ep_engine.cc
147             src/ep_time.c
148             src/executorpool.cc
149             src/executorthread.cc
150             src/ext_meta_parser.cc
151             src/failover-table.cc
152             src/flusher.cc
153             src/htresizer.cc
154             src/item.cc
155             src/item_pager.cc
156             src/logger.cc
157             src/kvshard.cc
158             src/memory_tracker.cc
159             src/murmurhash3.cc
160             src/mutation_log.cc
161             src/replicationthrottle.cc
162             src/sizes.cc
163             ${CMAKE_CURRENT_BINARY_DIR}/src/stats-info.c
164             src/string_utils.cc
165             src/stored-value.cc
166             src/tapconnection.cc
167             src/tasks.cc
168             src/taskqueue.cc
169             src/vbucket.cc
170             src/vbucketmap.cc
171             src/warmup.cc
172             ${KVSTORE_SOURCE} ${COUCH_KVSTORE_SOURCE}
173             ${FOREST_KVSTORE_SOURCE} ${OBJECTREGISTRY_SOURCE}
174             ${CONFIG_SOURCE})
175
176 SET_TARGET_PROPERTIES(ep PROPERTIES PREFIX "")
177 TARGET_LINK_LIBRARIES(ep cJSON JSON_checker couchstore forestdb
178   dirutils platform ${LIBEVENT_LIBRARIES})
179
180 # Single executable containing all class-level unit tests involving
181 # EventuallyPersistentEngine driven by GoogleTest.
182 # (We end up compiling most of the src/ files of ep-engine for these unit tests,
183 # so simpler / quicker just to link them into a single executable).
184 ADD_EXECUTABLE(ep-engine_ep_unit_tests
185   tests/mock/mock_dcp.cc
186   tests/module_tests/checkpoint_test.cc
187   tests/module_tests/defragmenter_test.cc
188   tests/module_tests/ep_unit_tests_main.cc
189   tests/module_tests/dcp_test.cc
190   tests/module_tests/evp_engine_test.cc
191   tests/module_tests/evp_store_test.cc
192   tests/module_tests/evp_store_single_threaded_test.cc
193   tests/module_tests/mutation_log_test.cc
194   src/access_scanner.cc
195   src/atomic.cc
196   src/backfill.cc
197   src/bgfetcher.cc
198   src/bloomfilter.cc
199   src/checkpoint.cc
200   src/checkpoint_remover.cc
201   src/conflict_resolution.cc
202   src/compress.cc
203   src/connmap.cc
204   src/dcp/backfill.cc
205   src/dcp/backfill-manager.cc
206   src/dcp/consumer.cc
207   src/dcp/flow-control.cc
208   src/dcp/flow-control-manager.cc
209   src/dcp/producer.cc
210   src/dcp/response.cc
211   src/dcp/stream.cc
212   src/defragmenter.cc
213   src/defragmenter_visitor.cc
214   src/ep.cc
215   src/ep_engine.cc
216   src/ep_time.c
217   src/executorpool.cc
218   src/executorthread.cc
219   src/ext_meta_parser.cc
220   src/failover-table.cc
221   src/flusher.cc
222   src/htresizer.cc
223   src/item.cc
224   src/item_pager.cc
225   src/kvshard.cc
226   src/logger.cc
227   src/memory_tracker.cc
228   src/murmurhash3.cc
229   src/mutation_log.cc
230   src/objectregistry.cc
231   src/tapconnection.cc
232   src/replicationthrottle.cc
233   src/stored-value.cc
234   src/string_utils.cc
235   src/tasks.cc
236   src/taskqueue.cc
237   src/vbucket.cc
238   src/vbucketmap.cc
239   src/warmup.cc
240   ${CMAKE_CURRENT_BINARY_DIR}/src/stats-info.c
241   ${CONFIG_SOURCE}
242   ${KVSTORE_SOURCE}
243   ${COUCH_KVSTORE_SOURCE}
244   ${FOREST_KVSTORE_SOURCE}
245   $<TARGET_OBJECTS:memory_tracking>
246   ${Memcached_SOURCE_DIR}/programs/engine_testapp/mock_server.cc)
247 TARGET_LINK_LIBRARIES(ep-engine_ep_unit_tests couchstore cJSON dirutils forestdb gtest JSON_checker mcd_util platform
248                       ${MALLOC_LIBRARIES})
249
250 ADD_EXECUTABLE(ep-engine_atomic_ptr_test
251   tests/module_tests/atomic_ptr_test.cc
252   src/atomic.cc
253   src/testlogger.cc)
254 TARGET_LINK_LIBRARIES(ep-engine_atomic_ptr_test platform)
255
256 ADD_EXECUTABLE(ep-engine_atomic_test
257   tests/module_tests/atomic_test.cc
258   src/testlogger.cc)
259 TARGET_LINK_LIBRARIES(ep-engine_atomic_test platform)
260
261 ADD_EXECUTABLE(ep-engine_chunk_creation_test
262   tests/module_tests/chunk_creation_test.cc)
263 TARGET_LINK_LIBRARIES(ep-engine_chunk_creation_test platform)
264
265 ADD_EXECUTABLE(ep-engine_compress_test
266   tests/module_tests/compress_test.cc
267   src/compress.cc)
268 TARGET_LINK_LIBRARIES(ep-engine_compress_test ${SNAPPY_LIBRARIES} platform)
269
270 ADD_EXECUTABLE(ep-engine_configuration_test
271         tests/module_tests/configuration_test.cc
272         src/configuration.cc
273         src/generated_configuration.h
274         src/objectregistry.cc
275         src/testlogger.cc)
276 TARGET_LINK_LIBRARIES(ep-engine_configuration_test gtest gtest_main platform)
277
278 ADD_EXECUTABLE(ep-engine_hash_table_test
279   tests/module_tests/hash_table_test.cc
280   src/atomic.cc
281   src/compress.cc
282   src/item.cc
283   src/stored-value.cc
284   src/testlogger.cc
285   ${OBJECTREGISTRY_SOURCE} ${CONFIG_SOURCE})
286 TARGET_LINK_LIBRARIES(ep-engine_hash_table_test gtest ${SNAPPY_LIBRARIES} platform)
287
288 ADD_EXECUTABLE(ep-engine_hrtime_test tests/module_tests/hrtime_test.cc)
289 TARGET_LINK_LIBRARIES(ep-engine_hrtime_test platform)
290
291 ADD_EXECUTABLE(ep-engine_memory_tracker_test
292   tests/module_tests/memory_tracker_test.cc
293   tests/module_tests/mock_hooks_api.cc
294   src/memory_tracker.cc
295   src/testlogger.cc
296   ${OBJECTREGISTRY_SOURCE}
297   ${CMAKE_CURRENT_BINARY_DIR}/src/generated_configuration.h)
298 TARGET_LINK_LIBRARIES(ep-engine_memory_tracker_test gtest gtest_main platform)
299
300 ADD_EXECUTABLE(ep-engine_misc_test tests/module_tests/misc_test.cc)
301 TARGET_LINK_LIBRARIES(ep-engine_misc_test platform)
302 ADD_EXECUTABLE(ep-engine_mutex_test
303                tests/module_tests/mutex_test.cc
304                src/testlogger.cc)
305 TARGET_LINK_LIBRARIES(ep-engine_mutex_test gtest gtest_main platform)
306
307 ADD_EXECUTABLE(ep-engine_ringbuffer_test tests/module_tests/ringbuffer_test.cc)
308 TARGET_LINK_LIBRARIES(ep-engine_ringbuffer_test platform)
309
310 ADD_EXECUTABLE(ep-engine_string_utils_test
311                tests/module_tests/string_utils_test.cc
312                src/string_utils.cc)
313 TARGET_LINK_LIBRARIES(ep-engine_string_utils_test gtest gtest_main platform)
314
315 ADD_EXECUTABLE(ep-engine_failover_table_test tests/module_tests/failover_table_test.cc
316                         src/failover-table.cc src/testlogger.cc
317                         ${OBJECTREGISTRY_SOURCE} ${CONFIG_SOURCE})
318 TARGET_LINK_LIBRARIES(ep-engine_failover_table_test cJSON platform)
319
320 ADD_EXECUTABLE(ep-engine_kvstore_test
321   tests/module_tests/kvstore_test.cc
322   src/compress.cc
323   src/testlogger.cc
324   ${OBJECTREGISTRY_SOURCE} ${KVSTORE_SOURCE} ${COUCH_KVSTORE_SOURCE}
325   ${FOREST_KVSTORE_SOURCE} ${CONFIG_SOURCE})
326 TARGET_LINK_LIBRARIES(ep-engine_kvstore_test
327                       cJSON JSON_checker couchstore dirutils forestdb
328                       gmock gtest platform)
329
330 ADD_TEST(ep-engine_atomic_ptr_test ep-engine_atomic_ptr_test)
331 ADD_TEST(ep-engine_atomic_test ep-engine_atomic_test)
332 ADD_TEST(ep-engine_chunk_creation_test ep-engine_chunk_creation_test)
333 ADD_TEST(ep-engine_compress_test ep-engine_compress_test)
334 ADD_TEST(ep-engine_configuration_test ep-engine_configuration_test)
335 ADD_TEST(ep-engine_ep_unit_tests ep-engine_ep_unit_tests)
336 ADD_TEST(ep-engine_failover_table_test ep-engine_failover_table_test)
337 ADD_TEST(ep-engine_hash_table_test ep-engine_hash_table_test)
338 ADD_TEST(ep-engine_hrtime_test ep-engine_hrtime_test)
339 ADD_TEST(ep-engine_misc_test ep-engine_misc_test)
340 ADD_TEST(ep-engine_mutex_test ep-engine_mutex_test)
341 ADD_TEST(ep-engine_ringbuffer_test ep-engine_ringbuffer_test)
342 ADD_TEST(ep-engine_kvstore_test ep-engine_kvstore_test)
343 ADD_TEST(ep-engine_memory_tracker_test ep-engine_memory_tracker_test)
344
345 ADD_LIBRARY(timing_tests SHARED tests/module_tests/timing_tests.cc)
346 SET_TARGET_PROPERTIES(timing_tests PROPERTIES PREFIX "")
347 TARGET_LINK_LIBRARIES(timing_tests platform)
348
349 ADD_EXECUTABLE(ep-engine_sizes src/sizes.cc src/mutex.h src/testlogger.cc
350               ${OBJECTREGISTRY_SOURCE} ${CONFIG_SOURCE})
351 TARGET_LINK_LIBRARIES(ep-engine_sizes platform)
352
353 ADD_LIBRARY(ep_testsuite SHARED
354    tests/ep_testsuite.cc
355    src/atomic.cc
356    src/compress.cc
357    src/ep_time.c
358    src/ext_meta_parser.cc
359    src/item.cc
360    src/testlogger.cc
361    tests/ep_testsuite_common.cc
362    tests/ep_test_apis.cc
363    tests/mock/mock_dcp.cc
364    ${OBJECTREGISTRY_SOURCE}
365    ${CONFIG_SOURCE})
366 SET_TARGET_PROPERTIES(ep_testsuite PROPERTIES PREFIX "")
367 TARGET_LINK_LIBRARIES(ep_testsuite couchstore dirutils JSON_checker platform
368                       ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES})
369
370 ADD_LIBRARY(ep_testsuite_basic SHARED
371    tests/ep_testsuite_basic.cc
372    src/compress.cc
373    src/ext_meta_parser.cc
374    tests/ep_testsuite_common.cc
375    tests/ep_test_apis.cc
376    tests/mock/mock_dcp.cc
377 )
378 SET_TARGET_PROPERTIES(ep_testsuite_basic PROPERTIES PREFIX "")
379 TARGET_LINK_LIBRARIES(ep_testsuite_basic JSON_checker dirutils platform ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES})
380
381 ADD_LIBRARY(ep_testsuite_dcp SHARED
382 tests/ep_testsuite_dcp.cc
383 src/compress.cc
384 src/ext_meta_parser.cc
385 tests/ep_testsuite_common.cc
386 tests/ep_test_apis.cc
387 tests/mock/mock_dcp.cc
388 )
389 SET_TARGET_PROPERTIES(ep_testsuite_dcp PROPERTIES PREFIX "")
390 TARGET_LINK_LIBRARIES(ep_testsuite_dcp JSON_checker dirutils platform ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES})
391
392 ADD_LIBRARY(ep_testsuite_tap SHARED
393    tests/ep_testsuite_common.cc
394    tests/ep_testsuite_tap.cc
395    tests/ep_test_apis.cc
396    src/ext_meta_parser.cc)
397 SET_TARGET_PROPERTIES(ep_testsuite_tap PROPERTIES PREFIX "")
398 TARGET_LINK_LIBRARIES(ep_testsuite_tap JSON_checker dirutils platform ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES})
399
400 ADD_LIBRARY(ep_testsuite_checkpoint SHARED
401    tests/ep_testsuite_common.cc
402    tests/ep_testsuite_checkpoint.cc
403    tests/ep_test_apis.cc
404    src/ext_meta_parser.cc)
405 SET_TARGET_PROPERTIES(ep_testsuite_checkpoint PROPERTIES PREFIX "")
406 TARGET_LINK_LIBRARIES(ep_testsuite_checkpoint JSON_checker dirutils platform ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES})
407
408 ADD_LIBRARY(ep_testsuite_xdcr SHARED
409    tests/ep_testsuite_common.cc
410    tests/ep_testsuite_xdcr.cc
411    tests/ep_test_apis.cc
412    src/ext_meta_parser.cc)
413 SET_TARGET_PROPERTIES(ep_testsuite_xdcr PROPERTIES PREFIX "")
414 TARGET_LINK_LIBRARIES(ep_testsuite_xdcr JSON_checker dirutils platform ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES})
415
416 ADD_LIBRARY(ep_perfsuite SHARED
417    tests/ep_perfsuite.cc
418    src/ext_meta_parser.cc
419    tests/ep_testsuite_common.cc
420    tests/ep_test_apis.cc
421    tests/mock/mock_dcp.cc)
422 SET_TARGET_PROPERTIES(ep_perfsuite PROPERTIES PREFIX "")
423 TARGET_LINK_LIBRARIES(ep_perfsuite dirutils platform)
424
425 #ADD_CUSTOM_COMMAND(OUTPUT
426 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_0.c
427 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_1.c
428 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_2.c
429 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_3.c
430 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_4.c
431 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_5.c
432 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_6.c
433 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_7.c
434 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_8.c
435 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_9.c
436 #                  COMMAND
437 #                     ${PYTHON_EXECUTABLE} tests/module_tests/gen_engine_test.py
438 #                  DEPENDS
439 #                        tests/module_tests/gen_engine_test.py
440 #                        tests/module_tests/breakdancer.py
441 #                  COMMENT "Generating testsuite")
442 #
443 #ADD_LIBRARY(generated_testsuite SHARED
444 #            tests/suite_stubs.c
445 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_0.c
446 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_1.c
447 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_2.c
448 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_3.c
449 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_4.c
450 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_5.c
451 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_6.c
452 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_7.c
453 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_8.c
454 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_9.c)
455
456 #SET_TARGET_PROPERTIES(generated_testsuite PROPERTIES PREFIX "")
457
458 INSTALL(PROGRAMS
459         ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbepctl
460         ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbstats
461         ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbcompact
462         ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbvdiff
463         ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbvbucketctl
464         management/cbanalyze-core
465         DESTINATION bin)
466
467 INSTALL(PROGRAMS
468         management/cbepctl
469         management/cbstats
470         management/cbcompact
471         management/cbvdiff
472         management/cbvbucketctl
473         DESTINATION lib/python)
474
475 INSTALL(FILES
476         management/clitool.py
477         management/mc_bin_client.py
478         management/mc_bin_server.py
479         management/memcacheConstants.py
480         management/tap.py
481         management/tap_example.py
482         DESTINATION lib/python)
483
484 INSTALL(FILES
485         docs/stats.org
486         DESTINATION share/doc/ep-engine)
487
488 INSTALL(TARGETS ep
489         RUNTIME DESTINATION bin
490         LIBRARY DESTINATION lib
491         ARCHIVE DESTINATION lib)
492
493
494 # Defines a testsuite which runs in full and value eviction variants.
495 FUNCTION(ADD_TESTSUITE value_evict_name full_evict_name testsuite_so timeout)
496   SET(_cmdline
497       ${CMAKE_BINARY_DIR}/memcached/engine_testapp -E ${CMAKE_CURRENT_BINARY_DIR}/ep.so -T ${testsuite_so})
498   ADD_TEST(NAME ${value_evict_name}
499          COMMAND ${_cmdline} -v -e "dbname=./${value_evict_name}")
500   ADD_TEST(NAME ${full_evict_name}
501          COMMAND ${_cmdline} -v -e "item_eviction_policy=full_eviction$<SEMICOLON>dbname=./${full_evict_name}")
502   SET_TESTS_PROPERTIES(${value_evict_name} PROPERTIES TIMEOUT ${timeout})
503   SET_TESTS_PROPERTIES(${full_evict_name} PROPERTIES TIMEOUT ${timeout})
504 ENDFUNCTION()
505
506 ADD_TESTSUITE(ep-engine_engine_tests ep-engine_full_eviction_tests
507               ${CMAKE_CURRENT_BINARY_DIR}/ep_testsuite.so
508               1800)
509
510 ADD_TESTSUITE(ep-engine_basic_tests ep-engine_full_eviction_basic
511               ${CMAKE_CURRENT_BINARY_DIR}/ep_testsuite_basic.so
512               600)
513
514 ADD_TESTSUITE(ep-engine_dcp_tests ep-engine_full_eviction_dcp
515               ${CMAKE_CURRENT_BINARY_DIR}/ep_testsuite_dcp.so
516               1200)
517
518 ADD_TESTSUITE(ep-engine_value_eviction_tap ep-engine_full_eviction_tap
519               ${CMAKE_CURRENT_BINARY_DIR}/ep_testsuite_tap.so
520               180)
521
522 ADD_TESTSUITE(ep-engine_value_eviction_checkpoint ep-engine_full_eviction_checkpoint
523               ${CMAKE_CURRENT_BINARY_DIR}/ep_testsuite_checkpoint.so
524               120)
525
526 ADD_TESTSUITE(ep-engine_value_eviction_xdcr ep-engine_full_eviction_xdcr
527               ${CMAKE_CURRENT_BINARY_DIR}/ep_testsuite_xdcr.so
528               120)
529
530 # ================================ PERF_TESTS ================================ #
531 SET(_ep_perfsuite_cmdline ${CMAKE_BINARY_DIR}/memcached/engine_testapp -E ${CMAKE_CURRENT_BINARY_DIR}/ep.so -T ${CMAKE_CURRENT_BINARY_DIR}/ep_perfsuite.so -v)
532
533 # Micro perf tests: value-only eviction mode. Note that it makes no sense to run
534 # these tests in full-eviction mode as we disable persistence - see MB-19504.
535 ADD_CUSTOM_TARGET(test-perfsuite
536                   COMMAND ${_ep_perfsuite_cmdline}
537                   DEPENDS ${CMAKE_BINARY_DIR}/memcached/engine_testapp
538                           ep
539                           ep_perfsuite
540                   VERBATIM)
541 ADD_TEST(NAME ep-engine_perfsuite
542          COMMAND ${_ep_perfsuite_cmdline} -e "dbname=./value_eviction_perf")
543
544 # ============================================================================ #
545
546 ENABLE_CODE_COVERAGE_REPORT()