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