Skip to content

Commit 8b26fd7

Browse files
committed
test: add fast integration tests for CI and exclude regression tests from CTest
Introduce a fast integration test suite operating on 10,000 base vectors and 100 queries to verify correctness via recall checks. The suite is structured into two dedicated test files under cpp/test/src/integration/: - test_builder_integration.cpp: Graph builder & search recall tests for every SIMD and Scalar variant across L2 Float, InnerProduct Float, and L2 Uint8 metrics. Includes all 3 OptimizationTarget variants (LowLID, HighLID, StreamingData) and dataset/graph determinism tests. - test_distance_integration.cpp: Direct distance calculation recall tests for every SIMD distance implementation compared against scalar groundtruth. Shared helpers (dataset generation, groundtruth, recall runners) are centralized in test_builder_integration.h. The existing 100,000 vector regression tests remain in src/regression/ for manual/local performance benchmarking but are excluded from CTest and CI execution. The test_regression meta target still builds them. CI workflow updated to remove SKIP_PERFORMANCE_TESTS env variable as CI now naturally runs fast integration tests via CTest without heavy regression tests.
1 parent 3047d90 commit 8b26fd7

6 files changed

Lines changed: 1559 additions & 18 deletions

File tree

.github/workflows/cpp-ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ jobs:
1616

1717
runs-on: ${{ matrix.os }}
1818

19-
env:
20-
SKIP_PERFORMANCE_TESTS: "1"
21-
2219
steps:
2320
- uses: actions/checkout@v4
2421
with:

cpp/test/CMakeLists.txt

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,43 @@ macro(add_deglib_test name source)
2020
add_test(NAME ${name} COMMAND ${name})
2121
endmacro()
2222

23+
# Helper macro: creates a test executable with integration test include path
24+
macro(add_deglib_integration_test name source)
25+
add_executable(${name} ${TEST_MAIN} ${source})
26+
target_include_directories(${name} PRIVATE ${DEGLIB_INCLUDE})
27+
target_include_directories(${name} PRIVATE ${GTEST_INCLUDE})
28+
target_include_directories(${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/integration)
29+
target_sources(${name} PRIVATE ${GTEST_SOURCE})
30+
target_link_libraries(${name} PRIVATE compile-options)
31+
set_target_properties(${name} PROPERTIES INTERMEDIATE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/obj/${name}")
32+
add_test(NAME ${name} COMMAND ${name})
33+
endmacro()
34+
35+
# Helper macro: creates a test executable without registering it with CTest
36+
# (used for regression tests that are built manually but excluded from CI)
37+
macro(add_deglib_test_no_ctest name source)
38+
add_executable(${name} ${TEST_MAIN} ${source})
39+
target_include_directories(${name} PRIVATE ${DEGLIB_INCLUDE})
40+
target_include_directories(${name} PRIVATE ${GTEST_INCLUDE})
41+
target_include_directories(${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/regression)
42+
target_sources(${name} PRIVATE ${GTEST_SOURCE})
43+
target_link_libraries(${name} PRIVATE compile-options)
44+
set_target_properties(${name} PROPERTIES INTERMEDIATE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/obj/${name}")
45+
endmacro()
46+
2347
# Phase 1 Test Target: CPU Features & Build Verification
2448
add_deglib_test(test_cpu_features src/test_cpu_features.cpp)
2549

26-
# Dataset Determinism Regression test
27-
add_deglib_test(test_dataset_determinism src/regression/test_dataset_determinism.cpp)
28-
29-
# Metric Regression tests
30-
add_deglib_test(test_l2_regression src/regression/metric/test_l2_regression.cpp)
31-
add_deglib_test(test_innerproduct_regression src/regression/metric/test_innerproduct_regression.cpp)
32-
add_deglib_test(test_l2_uint8_regression src/regression/metric/test_l2_uint8_regression.cpp)
50+
# Integration tests (fast, recall-only, registered with CTest for CI)
51+
add_deglib_integration_test(test_builder_integration src/integration/test_builder_integration.cpp)
52+
add_deglib_integration_test(test_distance_integration src/integration/test_distance_integration.cpp)
3353

34-
# Builder Regression tests
35-
add_deglib_test(test_l2_builder_regression src/regression/builder/test_l2_builder_regression.cpp)
54+
# Regression tests (100k vectors, performance benchmarking — built but NOT registered with CTest)
55+
add_deglib_test_no_ctest(test_dataset_determinism src/regression/test_dataset_determinism.cpp)
56+
add_deglib_test_no_ctest(test_l2_regression src/regression/metric/test_l2_regression.cpp)
57+
add_deglib_test_no_ctest(test_innerproduct_regression src/regression/metric/test_innerproduct_regression.cpp)
58+
add_deglib_test_no_ctest(test_l2_uint8_regression src/regression/metric/test_l2_uint8_regression.cpp)
59+
add_deglib_test_no_ctest(test_l2_builder_regression src/regression/builder/test_l2_builder_regression.cpp)
3660

3761
# Meta target to build all regression tests
3862
add_custom_target(test_regression DEPENDS test_dataset_determinism test_l2_regression test_innerproduct_regression test_l2_uint8_regression test_l2_builder_regression)
39-
40-
41-

0 commit comments

Comments
 (0)