MB-24151: Implement general range read iterator in seqlist
[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 OPTION(EP_USE_FORESTDB "Enable support for ForestDB" OFF)
17
18 INCLUDE_DIRECTORIES(BEFORE ${CMAKE_INSTALL_PREFIX}/include
19                            ${CMAKE_CURRENT_SOURCE_DIR}
20                            ${CMAKE_CURRENT_SOURCE_DIR}/src
21                            ${CMAKE_CURRENT_BINARY_DIR}/src
22                            ${BOOST_INCLUDE_DIR}
23                            ${SNAPPY_INCLUDE_DIR}
24                            ${BOOST_INCLUDE_DIR}
25                            ${Platform_SOURCE_DIR}/include
26                            ${Platform_SOURCE_DIR}/external
27                            ${Memcached_SOURCE_DIR}
28                            ${Memcached_SOURCE_DIR}/utilities
29                            ${Memcached_SOURCE_DIR}/include
30                            ${Couchstore_SOURCE_DIR}/include
31                            ${phosphor_SOURCE_DIR}/include
32                            ${CMAKE_CURRENT_BINARY_DIR})
33
34 INCLUDE_DIRECTORIES(AFTER ${Memcached_BINARY_DIR}/include)
35
36 IF (EP_USE_FORESTDB)
37     INCLUDE_DIRECTORIES(AFTER ${ForestDB_SOURCE_DIR}/include)
38     SET(FOREST_KVSTORE_SOURCE src/forest-kvstore/forest-kvstore.cc)
39     SET(EP_FORESTDB_LIB forestdb)
40     ADD_DEFINITIONS(-DEP_USE_FORESTDB=1)
41     MESSAGE(STATUS "ep-engine: Using ForestDB")
42 ENDIF (EP_USE_FORESTDB)
43
44 INCLUDE_DIRECTORIES(AFTER
45                     ${gtest_SOURCE_DIR}/include
46                     ${gmock_SOURCE_DIR}/include)
47
48 CHECK_INCLUDE_FILES("alloca.h" HAVE_ALLOCA_H)
49 CHECK_INCLUDE_FILES("arpa/inet.h" HAVE_ARPA_INET_H)
50 CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
51 CHECK_INCLUDE_FILES("netdb.h" HAVE_NETDB_H)
52 CHECK_INCLUDE_FILES("mach/mach_time.h" HAVE_MACH_MACH_TIME_H)
53 CHECK_INCLUDE_FILES("poll.h" HAVE_POLL_H)
54 CHECK_INCLUDE_FILES("sysexits.h" HAVE_SYSEXITS_H)
55 CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
56 CHECK_INCLUDE_FILES("sched.h" HAVE_SCHED_H)
57 CHECK_INCLUDE_FILES("sys/socket.h" HAVE_SYS_SOCKET_H)
58 CHECK_INCLUDE_FILES("sys/time.h" HAVE_SYS_TIME_H)
59 CHECK_INCLUDE_FILES("netinet/in.h" HAVE_NETINET_IN_H)
60 CHECK_INCLUDE_FILES("netinet/tcp.h" HAVE_NETINET_TCP_H)
61 CHECK_INCLUDE_FILE_CXX("unordered_map" HAVE_UNORDERED_MAP)
62 CHECK_INCLUDE_FILE_CXX("atomic" HAVE_ATOMIC)
63 CHECK_INCLUDE_FILE_CXX("thread" HAVE_THREAD)
64
65 CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
66 CHECK_FUNCTION_EXISTS(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME)
67 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
68 CHECK_FUNCTION_EXISTS(getopt_long HAVE_GETOPT_LONG)
69
70 # For debugging without compiler optimizations uncomment line below..
71 #SET (CMAKE_BUILD_TYPE DEBUG)
72
73 IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
74    EXECUTE_PROCESS(COMMAND git rev-parse HEAD
75                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
76                    OUTPUT_VARIABLE EP_ENGINE_VERSION
77                    OUTPUT_STRIP_TRAILING_WHITESPACE)
78    IF (EP_ENGINE_VERSION STREQUAL "" OR EP_ENGINE_VERSION STREQUAL "HEAD")
79      MESSAGE (FATAL_ERROR "Failed to determine commit SHA!")
80    ENDIF (EP_ENGINE_VERSION STREQUAL "" OR EP_ENGINE_VERSION STREQUAL "HEAD")
81 ELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
82    SET(EP_ENGINE_VERSION "unknown")
83 ENDIF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
84
85 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/src/config.cmake.h
86                 ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
87
88 # Generate the python wrappers
89 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper
90                 ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbepctl)
91 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper
92                 ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbstats)
93 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper
94                 ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbcompact)
95 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper
96                 ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbvdiff)
97 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper
98                 ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbvbucketctl)
99
100 SET(Python_ADDITIONAL_VERSIONS 2.6)
101 FIND_PACKAGE(PythonInterp)
102
103 # to avoid cluttering source dir with name + "c" files
104 SET(ENV{PYTHONDONTWRITEBYTECODE} 1)
105
106 # runs cbstats & cbepctl - will fail on basic syntax errors
107 ADD_TEST(cbstats_test ${PYTHON_EXECUTABLE}
108         ${CMAKE_CURRENT_SOURCE_DIR}/management/cbstats --help)
109 ADD_TEST(cbepctl_test ${PYTHON_EXECUTABLE}
110         ${CMAKE_CURRENT_SOURCE_DIR}/management/cbepctl --help)
111
112 IF (WIN32)
113    INCLUDE_DIRECTORIES(AFTER ${CMAKE_SOURCE_DIR}/platform/include/win32)
114 ENDIF (WIN32)
115
116 ADD_EXECUTABLE(gencode tools/gencode.cc)
117 TARGET_LINK_LIBRARIES(gencode cJSON platform)
118
119 ADD_EXECUTABLE(genconfig tools/genconfig.cc)
120 TARGET_LINK_LIBRARIES(genconfig cJSON platform)
121
122 ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/stats-info.c
123                           ${CMAKE_CURRENT_BINARY_DIR}/src/stats-info.h
124                   COMMAND
125                      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
126                   DEPENDS
127                         docs/stats.json
128                         gencode
129                   COMMENT "Generating code for stats info")
130
131 ADD_CUSTOM_COMMAND(OUTPUT
132                      ${CMAKE_CURRENT_BINARY_DIR}/src/generated_configuration.cc
133                      ${CMAKE_CURRENT_BINARY_DIR}/src/generated_configuration.h
134                   COMMAND
135                      genconfig ${CMAKE_CURRENT_SOURCE_DIR}/configuration.json
136                   DEPENDS
137                         configuration.json
138                         genconfig
139                   COMMENT "Generating code for configuration class")
140
141 SET(KVSTORE_SOURCE src/kvstore.cc)
142 SET(COUCH_KVSTORE_SOURCE src/couch-kvstore/couch-kvstore.cc
143             src/couch-kvstore/couch-fs-stats.cc)
144 SET(OBJECTREGISTRY_SOURCE src/objectregistry.cc)
145 SET(CONFIG_SOURCE src/configuration.cc
146   ${CMAKE_CURRENT_BINARY_DIR}/src/generated_configuration.cc)
147
148 SET(COLLECTIONS_SOURCE src/collections/manifest.cc
149                        src/collections/vbucket_manifest.cc
150                        src/collections/vbucket_manifest_entry.cc)
151
152 ADD_LIBRARY(ep_objs OBJECT
153             src/access_scanner.cc
154             src/atomic.cc
155             src/backfill.cc
156             src/bgfetcher.cc
157             src/bloomfilter.cc
158             src/checkpoint.cc
159             src/checkpoint_remover.cc
160             src/conflict_resolution.cc
161             src/connmap.cc
162             src/crc32.c
163             src/dcp/backfill-manager.cc
164             src/dcp/backfill_disk.cc
165             src/dcp/backfill_memory.cc
166             src/dcp/consumer.cc
167             src/dcp/dcpconnmap.cc
168             src/dcp/flow-control.cc
169             src/dcp/flow-control-manager.cc
170             src/dcp/producer.cc
171             src/dcp/response.cc
172             src/dcp/stream.cc
173             src/defragmenter.cc
174             src/defragmenter_visitor.cc
175             src/ep_bucket.cc
176             src/ep_vb.cc
177             src/ep_engine.cc
178             src/ep_time.cc
179             src/ep_types.cc
180             src/ephemeral_bucket.cc
181             src/ephemeral_tombstone_purger.cc
182             src/ephemeral_vb.cc
183             src/ephemeral_vb_count_visitor.cc
184             src/executorpool.cc
185             src/executorthread.cc
186             src/ext_meta_parser.cc
187             src/failover-table.cc
188             src/flusher.cc
189             src/globaltask.cc
190             src/hash_table.cc
191             src/hlc.cc
192             src/htresizer.cc
193             src/item.cc
194             src/item_pager.cc
195             src/logger.cc
196             src/kv_bucket.cc
197             src/kvshard.cc
198             src/memory_tracker.cc
199             src/murmurhash3.cc
200             src/mutation_log.cc
201             src/mutation_log_entry.cc
202             src/pre_link_document_context.cc
203             src/pre_link_document_context.h
204             src/replicationthrottle.cc
205             src/linked_list.cc
206             src/seqlist.cc
207             src/string_utils.cc
208             src/storeddockey.cc
209             src/stored-value.cc
210             src/systemevent.cc
211             src/tapconnection.cc
212             src/tapconnmap.cc
213             src/tasks.cc
214             src/taskqueue.cc
215             src/vb_count_visitor.cc
216             src/vbucket.cc
217             src/vbucketmap.cc
218             src/vbucketdeletiontask.cc
219             src/warmup.cc
220             ${OBJECTREGISTRY_SOURCE}
221             ${CMAKE_CURRENT_BINARY_DIR}/src/stats-info.c
222             ${CONFIG_SOURCE}
223             ${KVSTORE_SOURCE}
224             ${COUCH_KVSTORE_SOURCE}
225             ${FOREST_KVSTORE_SOURCE}
226             ${COLLECTIONS_SOURCE})
227 SET_PROPERTY(TARGET ep_objs PROPERTY POSITION_INDEPENDENT_CODE 1)
228
229 ADD_LIBRARY(ep SHARED $<TARGET_OBJECTS:ep_objs>)
230
231 SET_TARGET_PROPERTIES(ep PROPERTIES PREFIX "")
232 TARGET_LINK_LIBRARIES(ep cJSON JSON_checker couchstore ${EP_FORESTDB_LIB}
233                       engine_utilities dirutils cbcompress
234                       platform phosphor xattr ${LIBEVENT_LIBRARIES})
235
236 # Single executable containing all class-level unit tests involving
237 # EventuallyPersistentEngine driven by GoogleTest.
238 # (We end up compiling most of the src/ files of ep-engine for these unit tests,
239 # so simpler / quicker just to link them into a single executable).
240 ADD_EXECUTABLE(ep-engine_ep_unit_tests
241                tests/mock/mock_dcp.cc
242                tests/mock/mock_synchronous_ep_engine.cc
243                tests/module_tests/atomic_unordered_map_test.cc
244                tests/module_tests/basic_ll_test.cc
245                tests/module_tests/bloomfilter_test.cc
246                tests/module_tests/checkpoint_test.cc
247                tests/module_tests/collections/collection_dockey_test.cc
248                tests/module_tests/collections/evp_store_collections_test.cc
249                tests/module_tests/collections/manifest_test.cc
250                tests/module_tests/collections/vbucket_manifest_test.cc
251                tests/module_tests/collections/vbucket_manifest_entry_test.cc
252                tests/module_tests/configuration_test.cc
253                tests/module_tests/defragmenter_test.cc
254                tests/module_tests/dcp_test.cc
255                tests/module_tests/ep_unit_tests_main.cc
256                tests/module_tests/ephemeral_bucket_test.cc
257                tests/module_tests/ephemeral_vb_test.cc
258                tests/module_tests/evp_engine_test.cc
259                tests/module_tests/evp_store_rollback_test.cc
260                tests/module_tests/evp_store_test.cc
261                tests/module_tests/evp_store_single_threaded_test.cc
262                tests/module_tests/evp_store_with_meta.cc
263                tests/module_tests/executorpool_test.cc
264                tests/module_tests/failover_table_test.cc
265                tests/module_tests/futurequeue_test.cc
266                tests/module_tests/hash_table_test.cc
267                tests/module_tests/item_pager_test.cc
268                tests/module_tests/kvstore_test.cc
269                tests/module_tests/kv_bucket_test.cc
270                tests/module_tests/memory_tracker_test.cc
271                tests/module_tests/mock_hooks_api.cc
272                tests/module_tests/mutation_log_test.cc
273                tests/module_tests/mutex_test.cc
274                tests/module_tests/stats_test.cc
275                tests/module_tests/storeddockey_test.cc
276                tests/module_tests/stored_value_test.cc
277                tests/module_tests/systemevent_test.cc
278                tests/module_tests/test_helpers.cc
279                tests/module_tests/vbucket_test.cc
280                tests/module_tests/warmup_test.cc
281                $<TARGET_OBJECTS:ep_objs>
282                $<TARGET_OBJECTS:memory_tracking>
283                $<TARGET_OBJECTS:couchstore_test_fileops>
284                ${Memcached_SOURCE_DIR}/programs/engine_testapp/mock_server.cc
285                ${Memcached_SOURCE_DIR}/daemon/doc_pre_expiry.cc
286                ${Memcached_SOURCE_DIR}/daemon/protocol/mcbp/engine_errc_2_mcbp.cc
287                ${Memcached_SOURCE_DIR}/utilities/string_utilities.cc)
288
289 TARGET_INCLUDE_DIRECTORIES(ep-engine_ep_unit_tests
290         PUBLIC
291         ${Couchstore_SOURCE_DIR})
292
293 TARGET_LINK_LIBRARIES(ep-engine_ep_unit_tests couchstore cJSON dirutils
294                       engine_utilities ${EP_FORESTDB_LIB}
295                       gtest gmock JSON_checker mcd_util platform
296                       phosphor xattr cbcompress ${MALLOC_LIBRARIES})
297
298 ADD_EXECUTABLE(ep-engine_atomic_ptr_test
299   tests/module_tests/atomic_ptr_test.cc
300   src/atomic.cc
301   src/testlogger.cc)
302 TARGET_LINK_LIBRARIES(ep-engine_atomic_ptr_test platform)
303
304 ADD_EXECUTABLE(ep-engine_couch-fs-stats_test
305         src/couch-kvstore/couch-fs-stats.cc
306         src/generated_configuration.h
307         tests/module_tests/couch-fs-stats_test.cc
308         $<TARGET_OBJECTS:couchstore_wrapped_fileops_test_framework>)
309 TARGET_INCLUDE_DIRECTORIES(ep-engine_couch-fs-stats_test
310         PRIVATE
311         ${Couchstore_SOURCE_DIR}
312         ${Couchstore_SOURCE_DIR}/src)
313 TARGET_LINK_LIBRARIES(ep-engine_couch-fs-stats_test gtest gtest_main gmock platform)
314
315 ADD_EXECUTABLE(ep-engine_hrtime_test tests/module_tests/hrtime_test.cc)
316 TARGET_LINK_LIBRARIES(ep-engine_hrtime_test platform)
317
318 ADD_EXECUTABLE(ep-engine_misc_test tests/module_tests/misc_test.cc)
319 TARGET_LINK_LIBRARIES(ep-engine_misc_test platform)
320
321 ADD_EXECUTABLE(ep-engine_string_utils_test
322                tests/module_tests/string_utils_test.cc
323                src/string_utils.cc)
324 TARGET_LINK_LIBRARIES(ep-engine_string_utils_test gtest gtest_main platform)
325
326 ADD_EXECUTABLE(ep_engine_benchmarks
327                benchmarks/access_scanner_bench.cc
328                tests/mock/mock_synchronous_ep_engine.cc
329                $<TARGET_OBJECTS:ep_objs>
330                $<TARGET_OBJECTS:memory_tracking>
331                $<TARGET_OBJECTS:couchstore_test_fileops>
332                ${Memcached_SOURCE_DIR}/programs/engine_testapp/mock_server.cc
333                ${Memcached_SOURCE_DIR}/daemon/doc_pre_expiry.cc
334                ${Memcached_SOURCE_DIR}/daemon/protocol/mcbp/engine_errc_2_mcbp.cc
335                ${Memcached_SOURCE_DIR}/utilities/string_utilities.cc
336                benchmarks/benchmark_memory_tracker.cc
337                benchmarks/defragmenter_bench.cc
338                tests/module_tests/vbucket_test.cc)
339
340 TARGET_LINK_LIBRARIES(ep_engine_benchmarks benchmark platform xattr couchstore
341         cJSON dirutils engine_utilities gtest gmock JSON_checker mcd_util
342         cbcompress ${MALLOC_LIBRARIES})
343 TARGET_INCLUDE_DIRECTORIES(ep_engine_benchmarks PUBLIC
344                            ${benchmark_SOURCE_DIR}/include
345                            tests
346                            benchmarks
347                            ${Couchstore_SOURCE_DIR})
348
349 ADD_TEST(ep-engine_atomic_ptr_test ep-engine_atomic_ptr_test)
350 ADD_TEST(ep-engine_couch-fs-stats_test ep-engine_couch-fs-stats_test)
351 ADD_TEST(ep-engine_ep_unit_tests ep-engine_ep_unit_tests)
352 ADD_TEST(ep-engine_hrtime_test ep-engine_hrtime_test)
353 ADD_TEST(ep-engine_misc_test ep-engine_misc_test)
354
355 ADD_LIBRARY(timing_tests SHARED tests/module_tests/timing_tests.cc)
356 SET_TARGET_PROPERTIES(timing_tests PROPERTIES PREFIX "")
357 TARGET_LINK_LIBRARIES(timing_tests platform)
358
359 ADD_EXECUTABLE(ep-engine_sizes src/sizes.cc
360                                $<TARGET_OBJECTS:ep_objs>)
361 TARGET_LINK_LIBRARIES(ep-engine_sizes cJSON JSON_checker
362   engine_utilities couchstore
363   ${EP_FORESTDB_LIB} dirutils cbcompress platform phosphor xattr
364   ${LIBEVENT_LIBRARIES})
365
366 ADD_LIBRARY(ep_testsuite SHARED
367    tests/ep_testsuite.cc
368    src/ext_meta_parser.cc
369    tests/ep_testsuite_common.cc
370    tests/ep_test_apis.cc
371    tests/mock/mock_dcp.cc
372    ${Memcached_SOURCE_DIR}/utilities/string_utilities.cc)
373 SET_TARGET_PROPERTIES(ep_testsuite PROPERTIES PREFIX "")
374 TARGET_LINK_LIBRARIES(ep_testsuite couchstore dirutils JSON_checker platform
375                       xattr
376                       ${LIBEVENT_LIBRARIES})
377 ADD_DEPENDENCIES(ep_testsuite engine_testapp)
378
379 ADD_LIBRARY(ep_testsuite_basic SHARED
380    tests/ep_testsuite_basic.cc
381    src/ext_meta_parser.cc
382    tests/ep_testsuite_common.cc
383    tests/ep_test_apis.cc
384    tests/mock/mock_dcp.cc
385 )
386 SET_TARGET_PROPERTIES(ep_testsuite_basic PROPERTIES PREFIX "")
387 TARGET_LINK_LIBRARIES(ep_testsuite_basic engine_utilities JSON_checker dirutils
388                       platform ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES})
389 ADD_DEPENDENCIES(ep_testsuite engine_testapp)
390
391 ADD_LIBRARY(ep_testsuite_dcp SHARED
392 tests/ep_testsuite_dcp.cc
393 src/ext_meta_parser.cc
394 tests/ep_testsuite_common.cc
395 tests/ep_test_apis.cc
396 tests/mock/mock_dcp.cc
397 )
398 SET_TARGET_PROPERTIES(ep_testsuite_dcp PROPERTIES PREFIX "")
399 TARGET_LINK_LIBRARIES(ep_testsuite_dcp cbcompress JSON_checker dirutils platform ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES})
400 ADD_DEPENDENCIES(ep_testsuite_dcp engine_testapp)
401
402 ADD_LIBRARY(ep_testsuite_tap SHARED
403    tests/ep_testsuite_common.cc
404    tests/ep_testsuite_tap.cc
405    tests/ep_test_apis.cc
406    src/ext_meta_parser.cc)
407 SET_TARGET_PROPERTIES(ep_testsuite_tap PROPERTIES PREFIX "")
408 TARGET_LINK_LIBRARIES(ep_testsuite_tap JSON_checker dirutils platform ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES})
409 ADD_DEPENDENCIES(ep_testsuite_tap engine_testapp)
410
411 ADD_LIBRARY(ep_testsuite_checkpoint SHARED
412    tests/ep_testsuite_common.cc
413    tests/ep_testsuite_checkpoint.cc
414    tests/ep_test_apis.cc
415    src/ext_meta_parser.cc)
416 SET_TARGET_PROPERTIES(ep_testsuite_checkpoint PROPERTIES PREFIX "")
417 TARGET_LINK_LIBRARIES(ep_testsuite_checkpoint JSON_checker dirutils platform ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES})
418 ADD_DEPENDENCIES(ep_testsuite_checkpoint engine_testapp)
419
420 ADD_LIBRARY(ep_testsuite_xdcr SHARED
421    tests/ep_testsuite_common.cc
422    tests/ep_testsuite_xdcr.cc
423    tests/ep_test_apis.cc
424    src/ext_meta_parser.cc
425    ${Memcached_SOURCE_DIR}/utilities/string_utilities.cc)
426 SET_TARGET_PROPERTIES(ep_testsuite_xdcr PROPERTIES PREFIX "")
427 TARGET_LINK_LIBRARIES(ep_testsuite_xdcr JSON_checker dirutils platform xattr
428                       ${LIBEVENT_LIBRARIES} ${SNAPPY_LIBRARIES})
429 ADD_DEPENDENCIES(ep_testsuite_xdcr engine_testapp)
430
431 ADD_LIBRARY(ep_perfsuite SHARED
432    tests/ep_perfsuite.cc
433    src/ext_meta_parser.cc
434    tests/ep_testsuite_common.cc
435    tests/ep_test_apis.cc
436    tests/mock/mock_dcp.cc)
437 SET_TARGET_PROPERTIES(ep_perfsuite PROPERTIES PREFIX "")
438 TARGET_LINK_LIBRARIES(ep_perfsuite dirutils platform)
439 ADD_DEPENDENCIES(ep_perfsuite engine_testapp)
440
441 #ADD_CUSTOM_COMMAND(OUTPUT
442 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_0.c
443 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_1.c
444 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_2.c
445 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_3.c
446 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_4.c
447 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_5.c
448 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_6.c
449 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_7.c
450 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_8.c
451 #                     ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_9.c
452 #                  COMMAND
453 #                     ${PYTHON_EXECUTABLE} tests/module_tests/gen_engine_test.py
454 #                  DEPENDS
455 #                        tests/module_tests/gen_engine_test.py
456 #                        tests/module_tests/breakdancer.py
457 #                  COMMENT "Generating testsuite")
458 #
459 #ADD_LIBRARY(generated_testsuite SHARED
460 #            tests/suite_stubs.c
461 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_0.c
462 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_1.c
463 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_2.c
464 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_3.c
465 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_4.c
466 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_5.c
467 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_6.c
468 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_7.c
469 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_8.c
470 #            ${CMAKE_CURRENT_BINARY_DIR}/generated_suite_9.c)
471
472 #SET_TARGET_PROPERTIES(generated_testsuite PROPERTIES PREFIX "")
473
474 INSTALL(PROGRAMS
475         ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbepctl
476         ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbstats
477         ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbcompact
478         ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbvdiff
479         ${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbvbucketctl
480         management/cbanalyze-core
481         DESTINATION bin)
482
483 INSTALL(PROGRAMS
484         management/cbepctl
485         management/cbstats
486         management/cbcompact
487         management/cbvdiff
488         management/cbvbucketctl
489         DESTINATION lib/python)
490
491 INSTALL(FILES
492         management/clitool.py
493         management/cli_auth_utils.py
494         management/mc_bin_client.py
495         management/mc_bin_server.py
496         management/memcacheConstants.py
497         management/tap.py
498         management/tap_example.py
499         DESTINATION lib/python)
500
501 INSTALL(FILES
502         docs/stats.org
503         DESTINATION share/doc/ep-engine)
504
505 INSTALL(TARGETS ep
506         RUNTIME DESTINATION bin
507         LIBRARY DESTINATION lib
508         ARCHIVE DESTINATION lib)
509
510
511 # Defines a testsuite which runs in full and value eviction
512 # (persistent), ephemeral buckets (which has no eviction).
513 FUNCTION(ADD_TESTSUITE name timeout)
514   CMAKE_PARSE_ARGUMENTS("arg" "SKIP_EPHEMERAL" "" "" ${ARGN} )
515
516   SET(_cmdline
517     ${CMAKE_BINARY_DIR}/memcached/engine_testapp
518         -E ${CMAKE_CURRENT_BINARY_DIR}/ep.so
519         -T ${CMAKE_CURRENT_BINARY_DIR}/${name}.so)
520   ADD_TEST(NAME ${name}.value_eviction
521          COMMAND ${_cmdline} -v -e "dbname=./${name}.value_eviction.db")
522   ADD_TEST(NAME ${name}.full_eviction
523          COMMAND ${_cmdline} -v -e "item_eviction_policy=full_eviction$<SEMICOLON>dbname=./${name}.full_eviction.db")
524   SET_TESTS_PROPERTIES(${name}.value_eviction PROPERTIES TIMEOUT ${timeout})
525   SET_TESTS_PROPERTIES(${name}.full_eviction PROPERTIES TIMEOUT ${timeout})
526
527   IF(NOT arg_SKIP_EPHEMERAL)
528     ADD_TEST(NAME ${name}.ephemeral
529              COMMAND ${_cmdline} -v -e "bucket_type=ephemeral$<SEMICOLON>dbname=./${name}.ephemeral.db")
530     SET_TESTS_PROPERTIES(${name}.ephemeral PROPERTIES TIMEOUT ${timeout})
531   ENDIF()
532 ENDFUNCTION()
533
534 ADD_TESTSUITE(ep_testsuite 1800)
535
536 ADD_TESTSUITE(ep_testsuite_basic 600)
537
538 ADD_TESTSUITE(ep_testsuite_dcp 1200)
539
540 # TAP not supported for Ephemeral buckets.
541 ADD_TESTSUITE(ep_testsuite_tap 180 SKIP_EPHEMERAL)
542
543 ADD_TESTSUITE(ep_testsuite_checkpoint 120)
544
545 ADD_TESTSUITE(ep_testsuite_xdcr 120)
546
547 # ================================ PERF_TESTS ================================ #
548 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)
549
550 # Micro perf tests: value-only eviction mode. Note that it makes no sense to run
551 # these tests in full-eviction mode as we disable persistence - see MB-19504.
552 ADD_CUSTOM_TARGET(test-perfsuite
553                   COMMAND ${_ep_perfsuite_cmdline}
554                   DEPENDS ${CMAKE_BINARY_DIR}/memcached/engine_testapp
555                           ep
556                           ep_perfsuite
557                   VERBATIM)
558 ADD_TEST(NAME ep_perfsuite.value_eviction
559          COMMAND ${_ep_perfsuite_cmdline} -e "dbname=./ep_perfsuite.value_eviction.db")
560
561 ADD_TEST(NAME ep_perfsuite.ephemeral
562          COMMAND ${_ep_perfsuite_cmdline} -e "bucket_type=ephemeral$<SEMICOLON>dbname=./ep_perfsuite.ephemeral.db")
563
564 # ============================================================================ #
565
566 ENABLE_CODE_COVERAGE_REPORT()