CMakeLists.txt 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845
  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/relations/relation_index.cpp
  296. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/secondary_index.cpp
  297. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/subdb_identity.cpp
  298. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  299. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  300. )
  301. target_include_directories(test_document_store PRIVATE
  302. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  303. ${LMDB_INCLUDE_DIR}
  304. ${yyjson_INCLUDE_DIRS}
  305. )
  306. target_link_libraries(test_document_store PRIVATE ${LMDB_LIBRARY})
  307. target_link_libraries(test_document_store PRIVATE ${yyjson_LIBRARIES})
  308. if(TARGET nlohmann_json::nlohmann_json)
  309. target_link_libraries(test_document_store PRIVATE nlohmann_json::nlohmann_json)
  310. else()
  311. target_include_directories(test_document_store PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  312. endif()
  313. # v1.x → v2.0 migration tool unit test (v2.0 storage Phase C Stage 3).
  314. # Pulls in both the v1.x persistence stack (snapshot.cpp, wal.cpp, history_store.cpp,
  315. # memory_store.cpp) and the v2.0 storage stack (LMDB primitives + DocumentStore +
  316. # migrate_v1_to_v2). Each side is independent of the other at link time except
  317. # for the migration .cpp itself, which is the bridge.
  318. add_executable(test_migrate_v1_to_v2
  319. test_migrate_v1_to_v2.cpp
  320. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  321. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  322. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/snapshot.cpp
  323. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  324. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  325. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  326. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  327. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_env.cpp
  328. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_txn.cpp
  329. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_dbi.cpp
  330. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/document_store_lmdb.cpp
  331. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/relations/relation_index.cpp
  332. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/secondary_index.cpp
  333. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/subdb_identity.cpp
  334. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/migrate_v1_to_v2.cpp
  335. )
  336. target_include_directories(test_migrate_v1_to_v2 PRIVATE
  337. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  338. ${LMDB_INCLUDE_DIR}
  339. ${yyjson_INCLUDE_DIRS}
  340. )
  341. target_link_libraries(test_migrate_v1_to_v2 PRIVATE ${LMDB_LIBRARY})
  342. target_link_libraries(test_migrate_v1_to_v2 PRIVATE ${yyjson_LIBRARIES})
  343. if(TARGET nlohmann_json::nlohmann_json)
  344. target_link_libraries(test_migrate_v1_to_v2 PRIVATE nlohmann_json::nlohmann_json)
  345. else()
  346. target_include_directories(test_migrate_v1_to_v2 PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  347. endif()
  348. if(TARGET spdlog::spdlog)
  349. target_link_libraries(test_migrate_v1_to_v2 PRIVATE spdlog::spdlog)
  350. else()
  351. target_link_libraries(test_migrate_v1_to_v2 PRIVATE ${SPDLOG_LIBRARIES})
  352. target_include_directories(test_migrate_v1_to_v2 PRIVATE ${SPDLOG_INCLUDE_DIRS})
  353. endif()
  354. find_package(Threads REQUIRED)
  355. target_link_libraries(test_migrate_v1_to_v2 PRIVATE Threads::Threads)
  356. # LZ4 — snapshot.cpp uses LZ4 compression
  357. if(PKG_CONFIG_FOUND)
  358. pkg_check_modules(MIGRATE_LZ4 QUIET liblz4)
  359. endif()
  360. if(MIGRATE_LZ4_FOUND)
  361. target_link_libraries(test_migrate_v1_to_v2 PRIVATE ${MIGRATE_LZ4_LIBRARIES})
  362. target_include_directories(test_migrate_v1_to_v2 PRIVATE ${MIGRATE_LZ4_INCLUDE_DIRS})
  363. else()
  364. target_link_libraries(test_migrate_v1_to_v2 PRIVATE lz4)
  365. endif()
  366. # v2.0 Stage 4 — dual-write mirror unit + integration test.
  367. # Links the MemoryStore + LMDB substrate the same way test_migrate_v1_to_v2 does,
  368. # but skips persistence/snapshot/wal since the mirror helper does not touch them.
  369. add_executable(test_dual_write_mirror
  370. test_dual_write_mirror.cpp
  371. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  372. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  373. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  374. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  375. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  376. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  377. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_env.cpp
  378. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_txn.cpp
  379. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_dbi.cpp
  380. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/document_store_lmdb.cpp
  381. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/relations/relation_index.cpp
  382. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/secondary_index.cpp
  383. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/subdb_identity.cpp
  384. )
  385. target_include_directories(test_dual_write_mirror PRIVATE
  386. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  387. ${LMDB_INCLUDE_DIR}
  388. ${yyjson_INCLUDE_DIRS}
  389. )
  390. target_link_libraries(test_dual_write_mirror PRIVATE ${LMDB_LIBRARY})
  391. target_link_libraries(test_dual_write_mirror PRIVATE ${yyjson_LIBRARIES})
  392. if(TARGET nlohmann_json::nlohmann_json)
  393. target_link_libraries(test_dual_write_mirror PRIVATE nlohmann_json::nlohmann_json)
  394. else()
  395. target_include_directories(test_dual_write_mirror PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  396. endif()
  397. if(TARGET spdlog::spdlog)
  398. target_link_libraries(test_dual_write_mirror PRIVATE spdlog::spdlog)
  399. else()
  400. target_link_libraries(test_dual_write_mirror PRIVATE ${SPDLOG_LIBRARIES})
  401. target_include_directories(test_dual_write_mirror PRIVATE ${SPDLOG_INCLUDE_DIRS})
  402. endif()
  403. find_package(Threads REQUIRED)
  404. target_link_libraries(test_dual_write_mirror PRIVATE Threads::Threads)
  405. # Five test files assert via assert(), which CMAKE_BUILD_TYPE=Release compiles
  406. # out via -DNDEBUG. That silently reduced 104 assertions across test_views,
  407. # test_eviction, test_snapshot_durability, test_timestamp_precision and
  408. # test_config_dropins to no-ops: the suites ran, printed PASS, and checked
  409. # nothing. Strip NDEBUG from test targets so assertions are live in every
  410. # build type. Production targets are unaffected.
  411. foreach(_t
  412. test_vector_storage test_views test_timestamp_precision
  413. test_snapshot_durability test_config_dropins test_eviction
  414. test_json_parse test_doc_binary test_lmdb_env test_document_store
  415. test_migrate_v1_to_v2 test_dual_write_mirror)
  416. target_compile_options(${_t} PRIVATE -UNDEBUG)
  417. endforeach()
  418. # Register with CTest
  419. enable_testing()
  420. add_test(NAME vector_storage COMMAND test_vector_storage)
  421. add_test(NAME views COMMAND test_views)
  422. add_test(NAME timestamp_precision COMMAND test_timestamp_precision)
  423. add_test(NAME snapshot_durability COMMAND test_snapshot_durability)
  424. add_test(NAME config_dropins COMMAND test_config_dropins)
  425. add_test(NAME eviction COMMAND test_eviction)
  426. add_test(NAME json_parse COMMAND test_json_parse)
  427. add_test(NAME doc_binary COMMAND test_doc_binary)
  428. add_test(NAME lmdb_env COMMAND test_lmdb_env)
  429. add_test(NAME document_store COMMAND test_document_store)
  430. add_test(NAME migrate_v1_to_v2 COMMAND test_migrate_v1_to_v2)
  431. add_test(NAME dual_write_mirror COMMAND test_dual_write_mirror)
  432. # v2.3 — project addressing (header-only parser; no link deps).
  433. add_executable(test_project_addressing test_project_addressing.cpp)
  434. target_include_directories(test_project_addressing PRIVATE
  435. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  436. )
  437. add_test(NAME project_addressing COMMAND test_project_addressing)
  438. # v2.3 Stage F — project CRUD placeholders (header-only filesystem helpers;
  439. # no link deps beyond std::filesystem). Exercises listProjects /
  440. # createProject / dropProject against a tmp data dir. Stage B replaces the
  441. # placeholder with a project-registry-backed implementation; this test
  442. # will be retargeted then.
  443. add_executable(test_project_crud test_project_crud.cpp)
  444. target_include_directories(test_project_crud PRIVATE
  445. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  446. )
  447. add_test(NAME project_crud COMMAND test_project_crud)
  448. # v2.4.4 — sub-db identity sentinel. Regression cover for the misbound-MDB_dbi
  449. # incident in which writes for one collection landed in another's sub-db.
  450. add_executable(test_subdb_identity
  451. test_subdb_identity.cpp
  452. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_env.cpp
  453. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_txn.cpp
  454. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_dbi.cpp
  455. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/subdb_identity.cpp
  456. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/document_store_lmdb.cpp
  457. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/relations/relation_index.cpp
  458. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/secondary_index.cpp
  459. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  460. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  461. )
  462. target_include_directories(test_subdb_identity PRIVATE
  463. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  464. ${LMDB_INCLUDE_DIR}
  465. ${yyjson_INCLUDE_DIRS}
  466. )
  467. target_link_libraries(test_subdb_identity PRIVATE ${LMDB_LIBRARY})
  468. target_link_libraries(test_subdb_identity PRIVATE ${yyjson_LIBRARIES})
  469. if(TARGET nlohmann_json::nlohmann_json)
  470. target_link_libraries(test_subdb_identity PRIVATE nlohmann_json::nlohmann_json)
  471. else()
  472. target_include_directories(test_subdb_identity PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  473. endif()
  474. add_test(NAME test_subdb_identity COMMAND test_subdb_identity)
  475. # v2.11.0 T2 — relation reverse index (parent id -> child ids, DUPSORT).
  476. # Only the sources relation_index_{add,remove,child_count,children} actually
  477. # need: the LMDB store itself plus its direct dependencies. No relations/
  478. # relation_manager.cpp here - the storage layer is deliberately free of that
  479. # dependency (see relations/relation_index.hpp).
  480. add_executable(test_relation_index
  481. test_relation_index.cpp
  482. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_env.cpp
  483. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_txn.cpp
  484. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_dbi.cpp
  485. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/subdb_identity.cpp
  486. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/document_store_lmdb.cpp
  487. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/secondary_index.cpp
  488. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/relations/relation_index.cpp
  489. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  490. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  491. )
  492. target_include_directories(test_relation_index PRIVATE
  493. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  494. ${LMDB_INCLUDE_DIR}
  495. ${yyjson_INCLUDE_DIRS}
  496. )
  497. target_link_libraries(test_relation_index PRIVATE ${LMDB_LIBRARY})
  498. target_link_libraries(test_relation_index PRIVATE ${yyjson_LIBRARIES})
  499. if(TARGET nlohmann_json::nlohmann_json)
  500. target_link_libraries(test_relation_index PRIVATE nlohmann_json::nlohmann_json)
  501. else()
  502. target_include_directories(test_relation_index PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  503. endif()
  504. add_test(NAME test_relation_index COMMAND test_relation_index)
  505. # v2.11.0 T3/T4 — relation reverse-index maintenance on child writes (T3),
  506. # plus restrict/no_action delete enforcement (T4). T4 needs the declaration
  507. # registry (RelationManager, backed by a MemoryStore) alongside the LMDB
  508. # reverse index, so unlike test_relation_index this target does pull in
  509. # relations/relation_manager.cpp and memory_store.cpp and their dependencies.
  510. add_executable(test_relation_enforcement
  511. test_relation_enforcement.cpp
  512. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_env.cpp
  513. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_txn.cpp
  514. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/lmdb_dbi.cpp
  515. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/subdb_identity.cpp
  516. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/document_store_lmdb.cpp
  517. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/secondary_index.cpp
  518. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/relations/relation_index.cpp
  519. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/relations/relation_manager.cpp
  520. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/relations/relation_enforcement.cpp
  521. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  522. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/views/view_manager.cpp
  523. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/views/projection.cpp
  524. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  525. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  526. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  527. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  528. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  529. )
  530. target_include_directories(test_relation_enforcement PRIVATE
  531. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  532. ${LMDB_INCLUDE_DIR}
  533. ${yyjson_INCLUDE_DIRS}
  534. )
  535. target_link_libraries(test_relation_enforcement PRIVATE ${LMDB_LIBRARY})
  536. target_link_libraries(test_relation_enforcement PRIVATE ${yyjson_LIBRARIES})
  537. if(TARGET nlohmann_json::nlohmann_json)
  538. target_link_libraries(test_relation_enforcement PRIVATE nlohmann_json::nlohmann_json)
  539. else()
  540. target_include_directories(test_relation_enforcement PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  541. endif()
  542. if(TARGET spdlog::spdlog)
  543. target_link_libraries(test_relation_enforcement PRIVATE spdlog::spdlog)
  544. else()
  545. target_link_libraries(test_relation_enforcement PRIVATE ${SPDLOG_LIBRARIES})
  546. target_include_directories(test_relation_enforcement PRIVATE ${SPDLOG_INCLUDE_DIRS})
  547. endif()
  548. find_package(Threads REQUIRED)
  549. target_link_libraries(test_relation_enforcement PRIVATE Threads::Threads)
  550. add_test(NAME test_relation_enforcement COMMAND test_relation_enforcement)
  551. # v2.9.0 — secondary index key encoding. Pins the one property that matters:
  552. # an index key comparison must mean the same thing as the scan's comparison,
  553. # because two paths answering one question that disagree return wrong data
  554. # rather than an error.
  555. add_executable(test_secondary_index_keys
  556. test_secondary_index_keys.cpp
  557. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/secondary_index.cpp
  558. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  559. )
  560. target_include_directories(test_secondary_index_keys PRIVATE
  561. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  562. ${yyjson_INCLUDE_DIRS}
  563. )
  564. target_link_libraries(test_secondary_index_keys PRIVATE ${yyjson_LIBRARIES})
  565. if(TARGET nlohmann_json::nlohmann_json)
  566. target_link_libraries(test_secondary_index_keys PRIVATE nlohmann_json::nlohmann_json)
  567. else()
  568. target_include_directories(test_secondary_index_keys PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  569. endif()
  570. add_test(NAME test_secondary_index_keys COMMAND test_secondary_index_keys)
  571. # v2.6.0 — project-scoped file storage. Covers cross-project id isolation and
  572. # the per-project deduplicated flag (global dedup would otherwise be a
  573. # cross-project existence oracle).
  574. add_executable(test_file_project_scope
  575. test_file_project_scope.cpp
  576. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/files/file_manager.cpp
  577. )
  578. target_include_directories(test_file_project_scope PRIVATE
  579. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  580. )
  581. find_package(OpenSSL REQUIRED)
  582. target_link_libraries(test_file_project_scope PRIVATE OpenSSL::SSL OpenSSL::Crypto)
  583. if(TARGET nlohmann_json::nlohmann_json)
  584. target_link_libraries(test_file_project_scope PRIVATE nlohmann_json::nlohmann_json)
  585. else()
  586. target_include_directories(test_file_project_scope PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  587. endif()
  588. if(TARGET spdlog::spdlog)
  589. target_link_libraries(test_file_project_scope PRIVATE spdlog::spdlog)
  590. else()
  591. target_link_libraries(test_file_project_scope PRIVATE ${SPDLOG_LIBRARIES})
  592. target_include_directories(test_file_project_scope PRIVATE ${SPDLOG_INCLUDE_DIRS})
  593. endif()
  594. find_package(Threads REQUIRED)
  595. target_link_libraries(test_file_project_scope PRIVATE Threads::Threads)
  596. add_test(NAME test_file_project_scope COMMAND test_file_project_scope)
  597. # v2.8.0 — access policy engine. The critical assertions are the safety ones:
  598. # security off allows everything (so upgrades are inert), enabling is refused
  599. # without an admin policy, the last admin cannot be removed, and audit mode
  600. # evaluates honestly but allows.
  601. add_executable(test_policy_manager
  602. test_policy_manager.cpp
  603. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/security/policy_manager.cpp
  604. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  605. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  606. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  607. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  608. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  609. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  610. )
  611. target_include_directories(test_policy_manager PRIVATE
  612. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  613. ${yyjson_INCLUDE_DIRS}
  614. )
  615. target_link_libraries(test_policy_manager PRIVATE ${yyjson_LIBRARIES})
  616. if(TARGET nlohmann_json::nlohmann_json)
  617. target_link_libraries(test_policy_manager PRIVATE nlohmann_json::nlohmann_json)
  618. else()
  619. target_include_directories(test_policy_manager PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  620. endif()
  621. if(TARGET spdlog::spdlog)
  622. target_link_libraries(test_policy_manager PRIVATE spdlog::spdlog)
  623. else()
  624. target_link_libraries(test_policy_manager PRIVATE ${SPDLOG_LIBRARIES})
  625. target_include_directories(test_policy_manager PRIVATE ${SPDLOG_INCLUDE_DIRS})
  626. endif()
  627. find_package(Threads REQUIRED)
  628. target_link_libraries(test_policy_manager PRIVATE Threads::Threads)
  629. add_test(NAME test_policy_manager COMMAND test_policy_manager)
  630. # v2.8.0 — document TTL across write paths. Pins that update() preserves an
  631. # existing expiry: it used to wipe it, so any TTL'd document that was ever
  632. # updated became permanent.
  633. add_executable(test_document_ttl
  634. test_document_ttl.cpp
  635. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  636. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  637. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  638. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  639. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  640. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  641. )
  642. target_include_directories(test_document_ttl PRIVATE
  643. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  644. ${yyjson_INCLUDE_DIRS}
  645. )
  646. target_link_libraries(test_document_ttl PRIVATE ${yyjson_LIBRARIES})
  647. if(TARGET nlohmann_json::nlohmann_json)
  648. target_link_libraries(test_document_ttl PRIVATE nlohmann_json::nlohmann_json)
  649. else()
  650. target_include_directories(test_document_ttl PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  651. endif()
  652. if(TARGET spdlog::spdlog)
  653. target_link_libraries(test_document_ttl PRIVATE spdlog::spdlog)
  654. else()
  655. target_link_libraries(test_document_ttl PRIVATE ${SPDLOG_LIBRARIES})
  656. target_include_directories(test_document_ttl PRIVATE ${SPDLOG_INCLUDE_DIRS})
  657. endif()
  658. find_package(Threads REQUIRED)
  659. target_link_libraries(test_document_ttl PRIVATE Threads::Threads)
  660. add_test(NAME test_document_ttl COMMAND test_document_ttl)
  661. # v2.8.0 — ViewManager persistence. test_views only exercises applyProjection()
  662. # in-process, so nothing covered loadFromStore's paging: a bare Query stops at
  663. # 100 views and silently loses the rest.
  664. add_executable(test_view_manager_paging
  665. test_view_manager_paging.cpp
  666. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/views/view_manager.cpp
  667. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/views/projection.cpp
  668. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  669. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  670. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  671. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  672. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  673. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  674. )
  675. target_include_directories(test_view_manager_paging PRIVATE
  676. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  677. ${yyjson_INCLUDE_DIRS}
  678. )
  679. target_link_libraries(test_view_manager_paging PRIVATE ${yyjson_LIBRARIES})
  680. if(TARGET nlohmann_json::nlohmann_json)
  681. target_link_libraries(test_view_manager_paging PRIVATE nlohmann_json::nlohmann_json)
  682. else()
  683. target_include_directories(test_view_manager_paging PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  684. endif()
  685. if(TARGET spdlog::spdlog)
  686. target_link_libraries(test_view_manager_paging PRIVATE spdlog::spdlog)
  687. else()
  688. target_link_libraries(test_view_manager_paging PRIVATE ${SPDLOG_LIBRARIES})
  689. target_include_directories(test_view_manager_paging PRIVATE ${SPDLOG_INCLUDE_DIRS})
  690. endif()
  691. find_package(Threads REQUIRED)
  692. target_link_libraries(test_view_manager_paging PRIVATE Threads::Threads)
  693. add_test(NAME test_view_manager_paging COMMAND test_view_manager_paging)
  694. # v2.11.0 T1 — RelationManager: the declaration registry for referential
  695. # integrity relations. Same paging trap as ViewManager/PolicyManager/
  696. # CollectionConfigManager — loadFromStore() must page explicitly.
  697. add_executable(test_relation_manager
  698. test_relation_manager.cpp
  699. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/relations/relation_manager.cpp
  700. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/views/view_manager.cpp
  701. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/views/projection.cpp
  702. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/memory_store.cpp
  703. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
  704. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
  705. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
  706. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
  707. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/doc_binary.cpp
  708. )
  709. target_include_directories(test_relation_manager PRIVATE
  710. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  711. ${yyjson_INCLUDE_DIRS}
  712. )
  713. target_link_libraries(test_relation_manager PRIVATE ${yyjson_LIBRARIES})
  714. if(TARGET nlohmann_json::nlohmann_json)
  715. target_link_libraries(test_relation_manager PRIVATE nlohmann_json::nlohmann_json)
  716. else()
  717. target_include_directories(test_relation_manager PRIVATE ${NLOHMANN_JSON_INCLUDE_DIRS})
  718. endif()
  719. if(TARGET spdlog::spdlog)
  720. target_link_libraries(test_relation_manager PRIVATE spdlog::spdlog)
  721. else()
  722. target_link_libraries(test_relation_manager PRIVATE ${SPDLOG_LIBRARIES})
  723. target_include_directories(test_relation_manager PRIVATE ${SPDLOG_INCLUDE_DIRS})
  724. endif()
  725. target_link_libraries(test_relation_manager PRIVATE Threads::Threads)
  726. add_test(NAME test_relation_manager COMMAND test_relation_manager)