CMakeLists.txt 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. # Tests for smartbotic-database
  2. # yyjson (v1.10+) — Phase A swaps nlohmann::json::parse for parse_to_nlohmann
  3. # at hot paths in wal.cpp, snapshot.cpp, history_store.cpp, etc. Any test
  4. # target that compiles those files now also needs json_parse.cpp linked and
  5. # yyjson linked. Resolve once at file scope so every test target below can
  6. # use ${yyjson_LIBRARIES} / ${yyjson_INCLUDE_DIRS}.
  7. if(NOT yyjson_FOUND)
  8. find_package(PkgConfig REQUIRED)
  9. pkg_check_modules(yyjson REQUIRED yyjson)
  10. endif()
  11. # LMDB (v2.0 storage substrate) — resolve once at file scope, mirroring the
  12. # yyjson pattern. liblmdb does not ship pkg-config on Debian 13, so use
  13. # find_path/find_library. Each test target that pulls in storage/ sources
  14. # adds ${LMDB_INCLUDE_DIR} / ${LMDB_LIBRARY} to its link/include flags.
  15. if(NOT LMDB_INCLUDE_DIR OR NOT LMDB_LIBRARY)
  16. find_path(LMDB_INCLUDE_DIR lmdb.h)
  17. find_library(LMDB_LIBRARY NAMES lmdb)
  18. if(NOT LMDB_INCLUDE_DIR OR NOT LMDB_LIBRARY)
  19. message(FATAL_ERROR "LMDB not found. Install liblmdb-dev.")
  20. endif()
  21. endif()
  22. # Vector storage integration test
  23. # Compiles memory_store.cpp directly — no dependency on the full service executable.
  24. set(TEST_VECTOR_SOURCES
  25. test_vector_storage.cpp
  26. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  27. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  28. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  29. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  30. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  31. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  32. )
  33. add_executable(test_vector_storage ${TEST_VECTOR_SOURCES})
  34. target_include_directories(test_vector_storage PRIVATE
  35. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  36. )
  37. # nlohmann/json
  38. if(TARGET nlohmann_json::nlohmann_json)
  39. target_link_libraries(test_vector_storage PRIVATE nlohmann_json::nlohmann_json)
  40. else()
  41. target_include_directories(test_vector_storage PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  42. endif()
  43. # spdlog
  44. if(TARGET spdlog::spdlog)
  45. target_link_libraries(test_vector_storage PRIVATE spdlog::spdlog)
  46. else()
  47. target_link_libraries(test_vector_storage PRIVATE ${SPDLOG_LIBRARIES})
  48. target_include_directories(test_vector_storage PRIVATE ${SPDLOG_INCLUDE_DIRS})
  49. endif()
  50. # Threads (required by MemoryStore background threads)
  51. find_package(Threads REQUIRED)
  52. target_link_libraries(test_vector_storage PRIVATE Threads::Threads)
  53. # yyjson (wal.cpp uses parse_to_nlohmann from v1.10+)
  54. target_link_libraries(test_vector_storage PRIVATE ${yyjson_LIBRARIES})
  55. target_include_directories(test_vector_storage PRIVATE ${yyjson_INCLUDE_DIRS})
  56. # View projection unit test
  57. set(TEST_VIEWS_SOURCES
  58. test_views.cpp
  59. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/views/projection.cpp
  60. )
  61. add_executable(test_views ${TEST_VIEWS_SOURCES})
  62. target_include_directories(test_views PRIVATE
  63. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  64. )
  65. # nlohmann/json
  66. if(TARGET nlohmann_json::nlohmann_json)
  67. target_link_libraries(test_views PRIVATE nlohmann_json::nlohmann_json)
  68. else()
  69. target_include_directories(test_views PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  70. endif()
  71. # Per-collection timestamp precision test
  72. set(TEST_TIMESTAMP_PRECISION_SOURCES
  73. test_timestamp_precision.cpp
  74. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  75. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  76. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  77. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  78. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  79. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  80. )
  81. add_executable(test_timestamp_precision ${TEST_TIMESTAMP_PRECISION_SOURCES})
  82. target_include_directories(test_timestamp_precision PRIVATE
  83. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  84. )
  85. if(TARGET nlohmann_json::nlohmann_json)
  86. target_link_libraries(test_timestamp_precision PRIVATE nlohmann_json::nlohmann_json)
  87. else()
  88. target_include_directories(test_timestamp_precision PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  89. endif()
  90. if(TARGET spdlog::spdlog)
  91. target_link_libraries(test_timestamp_precision PRIVATE spdlog::spdlog)
  92. else()
  93. target_link_libraries(test_timestamp_precision PRIVATE ${SPDLOG_LIBRARIES})
  94. target_include_directories(test_timestamp_precision PRIVATE ${SPDLOG_INCLUDE_DIRS})
  95. endif()
  96. find_package(Threads REQUIRED)
  97. target_link_libraries(test_timestamp_precision PRIVATE Threads::Threads)
  98. # yyjson (wal.cpp uses parse_to_nlohmann from v1.10+)
  99. target_link_libraries(test_timestamp_precision PRIVATE ${yyjson_LIBRARIES})
  100. target_include_directories(test_timestamp_precision PRIVATE ${yyjson_INCLUDE_DIRS})
  101. # Snapshot durability + fallback integration test
  102. # Exercises SnapshotManager directly; pulls in memory_store.cpp, snapshot.cpp,
  103. # and wal.cpp (for the crc32 helpers used by snapshot.cpp).
  104. set(TEST_SNAPSHOT_DURABILITY_SOURCES
  105. test_snapshot_durability.cpp
  106. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  107. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  108. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/snapshot.cpp
  109. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  110. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  111. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  112. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  113. )
  114. add_executable(test_snapshot_durability ${TEST_SNAPSHOT_DURABILITY_SOURCES})
  115. target_include_directories(test_snapshot_durability PRIVATE
  116. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  117. )
  118. if(TARGET nlohmann_json::nlohmann_json)
  119. target_link_libraries(test_snapshot_durability PRIVATE nlohmann_json::nlohmann_json)
  120. else()
  121. target_include_directories(test_snapshot_durability PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  122. endif()
  123. if(TARGET spdlog::spdlog)
  124. target_link_libraries(test_snapshot_durability PRIVATE spdlog::spdlog)
  125. else()
  126. target_link_libraries(test_snapshot_durability PRIVATE ${SPDLOG_LIBRARIES})
  127. target_include_directories(test_snapshot_durability PRIVATE ${SPDLOG_INCLUDE_DIRS})
  128. endif()
  129. find_package(Threads REQUIRED)
  130. target_link_libraries(test_snapshot_durability PRIVATE Threads::Threads)
  131. # yyjson (wal.cpp/snapshot.cpp use parse_to_nlohmann from v1.10+)
  132. target_link_libraries(test_snapshot_durability PRIVATE ${yyjson_LIBRARIES})
  133. target_include_directories(test_snapshot_durability PRIVATE ${yyjson_INCLUDE_DIRS})
  134. # LZ4 — snapshot.cpp #includes <lz4.h> unless DISABLE_LZ4 is defined, so link it.
  135. find_package(PkgConfig QUIET)
  136. if(PKG_CONFIG_FOUND)
  137. pkg_check_modules(TEST_LZ4 QUIET liblz4)
  138. endif()
  139. if(TEST_LZ4_FOUND)
  140. target_link_libraries(test_snapshot_durability PRIVATE ${TEST_LZ4_LIBRARIES})
  141. target_include_directories(test_snapshot_durability PRIVATE ${TEST_LZ4_INCLUDE_DIRS})
  142. else()
  143. # Fallback: assume liblz4 is installed at a standard location
  144. target_link_libraries(test_snapshot_durability PRIVATE lz4)
  145. endif()
  146. # Config drop-in loader test (v1.7.0 T1 → T12)
  147. # Exercises loadLayeredConfig() in isolation.
  148. set(TEST_CONFIG_DROPINS_SOURCES
  149. test_config_dropins.cpp
  150. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/config_loader.cpp
  151. )
  152. add_executable(test_config_dropins ${TEST_CONFIG_DROPINS_SOURCES})
  153. target_include_directories(test_config_dropins PRIVATE
  154. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  155. )
  156. if(TARGET nlohmann_json::nlohmann_json)
  157. target_link_libraries(test_config_dropins PRIVATE nlohmann_json::nlohmann_json)
  158. else()
  159. target_include_directories(test_config_dropins PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  160. endif()
  161. if(TARGET spdlog::spdlog)
  162. target_link_libraries(test_config_dropins PRIVATE spdlog::spdlog)
  163. else()
  164. target_link_libraries(test_config_dropins PRIVATE ${SPDLOG_LIBRARIES})
  165. target_include_directories(test_config_dropins PRIVATE ${SPDLOG_INCLUDE_DIRS})
  166. endif()
  167. # Eviction test (v1.7.0 T4+T5+T6 → T12)
  168. # Exercises chunked eviction, per-collection priorities, and the hot-write
  169. # floor directly through MemoryStore. Mirrors the link deps of test_timestamp_precision.
  170. set(TEST_EVICTION_SOURCES
  171. test_eviction.cpp
  172. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  173. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  174. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  175. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  176. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  177. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  178. )
  179. add_executable(test_eviction ${TEST_EVICTION_SOURCES})
  180. target_include_directories(test_eviction PRIVATE
  181. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  182. )
  183. if(TARGET nlohmann_json::nlohmann_json)
  184. target_link_libraries(test_eviction PRIVATE nlohmann_json::nlohmann_json)
  185. else()
  186. target_include_directories(test_eviction PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  187. endif()
  188. if(TARGET spdlog::spdlog)
  189. target_link_libraries(test_eviction PRIVATE spdlog::spdlog)
  190. else()
  191. target_link_libraries(test_eviction PRIVATE ${SPDLOG_LIBRARIES})
  192. target_include_directories(test_eviction PRIVATE ${SPDLOG_INCLUDE_DIRS})
  193. endif()
  194. find_package(Threads REQUIRED)
  195. target_link_libraries(test_eviction PRIVATE Threads::Threads)
  196. # yyjson (wal.cpp uses parse_to_nlohmann from v1.10+)
  197. target_link_libraries(test_eviction PRIVATE ${yyjson_LIBRARIES})
  198. target_include_directories(test_eviction PRIVATE ${yyjson_INCLUDE_DIRS})
  199. # yyjson → nlohmann bridge helper test (v1.10 Phase A T2)
  200. # Exercises parse_to_nlohmann() in isolation against nlohmann::json::parse
  201. # for a corpus of production-shaped docs. yyjson is configured at the
  202. # service/ scope; re-resolve it here so the test target can find it
  203. # independently of the service build.
  204. if(NOT yyjson_FOUND)
  205. find_package(PkgConfig REQUIRED)
  206. pkg_check_modules(yyjson REQUIRED yyjson)
  207. endif()
  208. add_executable(test_json_parse
  209. test_json_parse.cpp
  210. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  211. )
  212. target_include_directories(test_json_parse PRIVATE
  213. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  214. ${yyjson_INCLUDE_DIRS}
  215. )
  216. if(TARGET nlohmann_json::nlohmann_json)
  217. target_link_libraries(test_json_parse PRIVATE nlohmann_json::nlohmann_json)
  218. else()
  219. target_include_directories(test_json_parse PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  220. endif()
  221. target_link_libraries(test_json_parse PRIVATE ${yyjson_LIBRARIES})
  222. # Binary doc encoder/decoder test (v1.11 Phase B T2)
  223. # Exercises doc_binary::Doc, encode, decode, get_field, to_json_text against
  224. # nlohmann::json round-trips. yyjson resolution is shared at file scope above.
  225. add_executable(test_doc_binary
  226. test_doc_binary.cpp
  227. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  228. )
  229. target_include_directories(test_doc_binary PRIVATE
  230. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  231. ${yyjson_INCLUDE_DIRS}
  232. )
  233. if(TARGET nlohmann_json::nlohmann_json)
  234. target_link_libraries(test_doc_binary PRIVATE nlohmann_json::nlohmann_json)
  235. else()
  236. target_include_directories(test_doc_binary PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  237. endif()
  238. target_link_libraries(test_doc_binary PRIVATE ${yyjson_LIBRARIES})
  239. # Parse-time micro-benchmark (v1.10 Phase A T8) — manual bench, NOT
  240. # registered with CTest. Run as ./build/tests/bench_json_parse <corpus>.
  241. add_executable(bench_json_parse
  242. bench_json_parse.cpp
  243. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  244. )
  245. target_include_directories(bench_json_parse PRIVATE
  246. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  247. ${yyjson_INCLUDE_DIRS}
  248. )
  249. if(TARGET nlohmann_json::nlohmann_json)
  250. target_link_libraries(bench_json_parse PRIVATE nlohmann_json::nlohmann_json)
  251. else()
  252. target_include_directories(bench_json_parse PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  253. endif()
  254. target_link_libraries(bench_json_parse PRIVATE ${yyjson_LIBRARIES})
  255. # RSS bench (v1.11 Phase B T8) — manual bench, NOT registered with CTest.
  256. # Run as ./build/tests/bench_doc_memory [N].
  257. add_executable(bench_doc_memory
  258. bench_doc_memory.cpp
  259. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  260. )
  261. target_include_directories(bench_doc_memory PRIVATE
  262. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  263. ${yyjson_INCLUDE_DIRS}
  264. )
  265. if(TARGET nlohmann_json::nlohmann_json)
  266. target_link_libraries(bench_doc_memory PRIVATE nlohmann_json::nlohmann_json)
  267. else()
  268. target_include_directories(bench_doc_memory PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  269. endif()
  270. target_link_libraries(bench_doc_memory PRIVATE ${yyjson_LIBRARIES})
  271. # LMDB environment unit test (v2.0 storage Phase C Stage 1, Tasks 1.2 / 1.3).
  272. # Compiles the storage/ sources directly — no dependency on the service
  273. # executable.
  274. add_executable(test_lmdb_env
  275. test_lmdb_env.cpp
  276. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_env.cpp
  277. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_txn.cpp
  278. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_dbi.cpp
  279. )
  280. target_include_directories(test_lmdb_env PRIVATE
  281. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  282. ${LMDB_INCLUDE_DIR}
  283. )
  284. target_link_libraries(test_lmdb_env PRIVATE ${LMDB_LIBRARY})
  285. # DocumentStore + LmdbDocumentStore unit test (v2.0 storage Phase C Stage 2).
  286. # Same shape as test_lmdb_env: links the storage/ sources and a couple of
  287. # helpers (doc_binary, json_parse) directly. No dependency on the full
  288. # service executable.
  289. add_executable(test_document_store
  290. test_document_store.cpp
  291. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_env.cpp
  292. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_txn.cpp
  293. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_dbi.cpp
  294. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/document_store_lmdb.cpp
  295. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  296. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  297. )
  298. target_include_directories(test_document_store PRIVATE
  299. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  300. ${LMDB_INCLUDE_DIR}
  301. ${yyjson_INCLUDE_DIRS}
  302. )
  303. target_link_libraries(test_document_store PRIVATE ${LMDB_LIBRARY})
  304. target_link_libraries(test_document_store PRIVATE ${yyjson_LIBRARIES})
  305. if(TARGET nlohmann_json::nlohmann_json)
  306. target_link_libraries(test_document_store PRIVATE nlohmann_json::nlohmann_json)
  307. else()
  308. target_include_directories(test_document_store PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  309. endif()
  310. # v1.x → v2.0 migration tool unit test (v2.0 storage Phase C Stage 3).
  311. # Pulls in both the v1.x persistence stack (snapshot.cpp, wal.cpp, history_store.cpp,
  312. # memory_store.cpp) and the v2.0 storage stack (LMDB primitives + DocumentStore +
  313. # migrate_v1_to_v2). Each side is independent of the other at link time except
  314. # for the migration .cpp itself, which is the bridge.
  315. add_executable(test_migrate_v1_to_v2
  316. test_migrate_v1_to_v2.cpp
  317. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  318. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  319. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/snapshot.cpp
  320. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  321. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  322. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  323. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  324. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_env.cpp
  325. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_txn.cpp
  326. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_dbi.cpp
  327. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/document_store_lmdb.cpp
  328. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/migrate_v1_to_v2.cpp
  329. )
  330. target_include_directories(test_migrate_v1_to_v2 PRIVATE
  331. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  332. ${LMDB_INCLUDE_DIR}
  333. ${yyjson_INCLUDE_DIRS}
  334. )
  335. target_link_libraries(test_migrate_v1_to_v2 PRIVATE ${LMDB_LIBRARY})
  336. target_link_libraries(test_migrate_v1_to_v2 PRIVATE ${yyjson_LIBRARIES})
  337. if(TARGET nlohmann_json::nlohmann_json)
  338. target_link_libraries(test_migrate_v1_to_v2 PRIVATE nlohmann_json::nlohmann_json)
  339. else()
  340. target_include_directories(test_migrate_v1_to_v2 PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  341. endif()
  342. if(TARGET spdlog::spdlog)
  343. target_link_libraries(test_migrate_v1_to_v2 PRIVATE spdlog::spdlog)
  344. else()
  345. target_link_libraries(test_migrate_v1_to_v2 PRIVATE ${SPDLOG_LIBRARIES})
  346. target_include_directories(test_migrate_v1_to_v2 PRIVATE ${SPDLOG_INCLUDE_DIRS})
  347. endif()
  348. find_package(Threads REQUIRED)
  349. target_link_libraries(test_migrate_v1_to_v2 PRIVATE Threads::Threads)
  350. # LZ4 — snapshot.cpp uses LZ4 compression
  351. if(PKG_CONFIG_FOUND)
  352. pkg_check_modules(MIGRATE_LZ4 QUIET liblz4)
  353. endif()
  354. if(MIGRATE_LZ4_FOUND)
  355. target_link_libraries(test_migrate_v1_to_v2 PRIVATE ${MIGRATE_LZ4_LIBRARIES})
  356. target_include_directories(test_migrate_v1_to_v2 PRIVATE ${MIGRATE_LZ4_INCLUDE_DIRS})
  357. else()
  358. target_link_libraries(test_migrate_v1_to_v2 PRIVATE lz4)
  359. endif()
  360. # Register with CTest
  361. enable_testing()
  362. add_test(NAME vector_storage COMMAND test_vector_storage)
  363. add_test(NAME views COMMAND test_views)
  364. add_test(NAME timestamp_precision COMMAND test_timestamp_precision)
  365. add_test(NAME snapshot_durability COMMAND test_snapshot_durability)
  366. add_test(NAME config_dropins COMMAND test_config_dropins)
  367. add_test(NAME eviction COMMAND test_eviction)
  368. add_test(NAME json_parse COMMAND test_json_parse)
  369. add_test(NAME doc_binary COMMAND test_doc_binary)
  370. add_test(NAME lmdb_env COMMAND test_lmdb_env)
  371. add_test(NAME document_store COMMAND test_document_store)
  372. add_test(NAME migrate_v1_to_v2 COMMAND test_migrate_v1_to_v2)