|
|
@@ -1,5 +1,15 @@
|
|
|
# Tests for smartbotic-database
|
|
|
|
|
|
+# yyjson (v1.10+) — Phase A swaps nlohmann::json::parse for parse_to_nlohmann
|
|
|
+# at hot paths in wal.cpp, snapshot.cpp, history_store.cpp, etc. Any test
|
|
|
+# target that compiles those files now also needs json_parse.cpp linked and
|
|
|
+# yyjson linked. Resolve once at file scope so every test target below can
|
|
|
+# use ${yyjson_LIBRARIES} / ${yyjson_INCLUDE_DIRS}.
|
|
|
+if(NOT yyjson_FOUND)
|
|
|
+ find_package(PkgConfig REQUIRED)
|
|
|
+ pkg_check_modules(yyjson REQUIRED yyjson)
|
|
|
+endif()
|
|
|
+
|
|
|
# Vector storage integration test
|
|
|
# Compiles memory_store.cpp directly — no dependency on the full service executable.
|
|
|
set(TEST_VECTOR_SOURCES
|
|
|
@@ -8,6 +18,7 @@ set(TEST_VECTOR_SOURCES
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
|
|
|
+ ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
|
|
|
)
|
|
|
|
|
|
add_executable(test_vector_storage ${TEST_VECTOR_SOURCES})
|
|
|
@@ -35,6 +46,10 @@ endif()
|
|
|
find_package(Threads REQUIRED)
|
|
|
target_link_libraries(test_vector_storage PRIVATE Threads::Threads)
|
|
|
|
|
|
+# yyjson (wal.cpp uses parse_to_nlohmann from v1.10+)
|
|
|
+target_link_libraries(test_vector_storage PRIVATE ${yyjson_LIBRARIES})
|
|
|
+target_include_directories(test_vector_storage PRIVATE ${yyjson_INCLUDE_DIRS})
|
|
|
+
|
|
|
# View projection unit test
|
|
|
set(TEST_VIEWS_SOURCES
|
|
|
test_views.cpp
|
|
|
@@ -61,6 +76,7 @@ set(TEST_TIMESTAMP_PRECISION_SOURCES
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
|
|
|
+ ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
|
|
|
)
|
|
|
|
|
|
add_executable(test_timestamp_precision ${TEST_TIMESTAMP_PRECISION_SOURCES})
|
|
|
@@ -85,6 +101,10 @@ endif()
|
|
|
find_package(Threads REQUIRED)
|
|
|
target_link_libraries(test_timestamp_precision PRIVATE Threads::Threads)
|
|
|
|
|
|
+# yyjson (wal.cpp uses parse_to_nlohmann from v1.10+)
|
|
|
+target_link_libraries(test_timestamp_precision PRIVATE ${yyjson_LIBRARIES})
|
|
|
+target_include_directories(test_timestamp_precision PRIVATE ${yyjson_INCLUDE_DIRS})
|
|
|
+
|
|
|
# Snapshot durability + fallback integration test
|
|
|
# Exercises SnapshotManager directly; pulls in memory_store.cpp, snapshot.cpp,
|
|
|
# and wal.cpp (for the crc32 helpers used by snapshot.cpp).
|
|
|
@@ -95,6 +115,7 @@ set(TEST_SNAPSHOT_DURABILITY_SOURCES
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/snapshot.cpp
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
|
|
|
+ ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
|
|
|
)
|
|
|
|
|
|
add_executable(test_snapshot_durability ${TEST_SNAPSHOT_DURABILITY_SOURCES})
|
|
|
@@ -119,6 +140,10 @@ endif()
|
|
|
find_package(Threads REQUIRED)
|
|
|
target_link_libraries(test_snapshot_durability PRIVATE Threads::Threads)
|
|
|
|
|
|
+# yyjson (wal.cpp/snapshot.cpp use parse_to_nlohmann from v1.10+)
|
|
|
+target_link_libraries(test_snapshot_durability PRIVATE ${yyjson_LIBRARIES})
|
|
|
+target_include_directories(test_snapshot_durability PRIVATE ${yyjson_INCLUDE_DIRS})
|
|
|
+
|
|
|
# LZ4 — snapshot.cpp #includes <lz4.h> unless DISABLE_LZ4 is defined, so link it.
|
|
|
find_package(PkgConfig QUIET)
|
|
|
if(PKG_CONFIG_FOUND)
|
|
|
@@ -167,6 +192,7 @@ set(TEST_EVICTION_SOURCES
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/config/collection_config_manager.cpp
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/history_store.cpp
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../service/src/persistence/wal.cpp
|
|
|
+ ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/json_parse.cpp
|
|
|
)
|
|
|
|
|
|
add_executable(test_eviction ${TEST_EVICTION_SOURCES})
|
|
|
@@ -191,6 +217,10 @@ endif()
|
|
|
find_package(Threads REQUIRED)
|
|
|
target_link_libraries(test_eviction PRIVATE Threads::Threads)
|
|
|
|
|
|
+# yyjson (wal.cpp uses parse_to_nlohmann from v1.10+)
|
|
|
+target_link_libraries(test_eviction PRIVATE ${yyjson_LIBRARIES})
|
|
|
+target_include_directories(test_eviction PRIVATE ${yyjson_INCLUDE_DIRS})
|
|
|
+
|
|
|
# yyjson → nlohmann bridge helper test (v1.10 Phase A T2)
|
|
|
# Exercises parse_to_nlohmann() in isolation against nlohmann::json::parse
|
|
|
# for a corpus of production-shaped docs. yyjson is configured at the
|