Add VECSIM_BUILD_TEST_HELPERS option to CMAKE#913
Conversation
…ional building of test executables
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
There was a problem hiding this comment.
Pull request overview
This pull request adds a new CMake option VECSIM_BUILD_TEST_HELPERS to provide finer control over the build process. The change separates the concerns of enabling test helper methods (like fitMemory and serialization) from building test executables.
Changes:
- Added
VECSIM_BUILD_TEST_HELPERSoption to enable test helper methods without building test executables or fetching test frameworks - Modified
BUILD_TESTSmacro definition logic to activate when eitherVECSIM_BUILD_TEST_HELPERSorVECSIM_BUILD_TESTSis enabled - Updated VectorSimilaritySerializer library build condition to match the new logic
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| CMakeLists.txt | Adds VECSIM_BUILD_TEST_HELPERS option and updates BUILD_TESTS macro definition logic to support both test helpers and test executables separately |
| src/VecSim/CMakeLists.txt | Updates VectorSimilaritySerializer library build condition to include VECSIM_BUILD_TEST_HELPERS |
Comments suppressed due to low confidence (1)
CMakeLists.txt:14
- The comment states "Implies VECSIM_BUILD_TEST_HELPERS", but this implication is not explicitly enforced in the code. While the current logic works due to the OR condition in line 51, it would be more robust to explicitly set VECSIM_BUILD_TEST_HELPERS when VECSIM_BUILD_TESTS is ON. Consider adding:
if(VECSIM_BUILD_TESTS)followed byset(VECSIM_BUILD_TEST_HELPERS ON)after the option declarations to make the dependency explicit and prevent potential confusion.
# VECSIM_BUILD_TESTS: Builds VectorSimilarity test executables (unit tests, benchmarks).
# Implies VECSIM_BUILD_TEST_HELPERS. Fetches googletest and google_benchmark.
option(VECSIM_BUILD_TESTS "Build VectorSimilarity test executables" ON)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #913 +/- ##
=======================================
Coverage 97.11% 97.11%
=======================================
Files 129 129
Lines 7551 7551
=======================================
Hits 7333 7333
Misses 218 218 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Describe the changes in the pull request
Added
VECSIM_BUILD_TEST_HELPERSflag to the CMAKE to allow vecsim_disk to compile the test helper function without compiling the tests themselves.VECSIM_BUILD_TEST_HELPERSis defaulted to OFF, so we don't have to change RediSearch's behaviour.Commented that setting
VECSIM_BUILD_TESTSto ON includes the buiding the test helper functions.Which issues this PR fixes
Main objects this PR modified
Mark if applicable
Note
Low Risk
Low risk build-system change that mainly affects compilation flags and target inclusion when enabling test helpers; main risk is accidental
BUILD_TESTSdefine/link changes for downstream consumers.Overview
Adds a new CMake option
VECSIM_BUILD_TEST_HELPERS(default OFF) to compile test helper methods behindBUILD_TESTSwithout fetching/building test executables.Updates build logic so
BUILD_TESTSand theVectorSimilaritySerializerlibrary are enabled when either helpers or full tests are requested, while googletest/benchmark and test targets are built only whenVECSIM_BUILD_TESTSis ON. Also switches SVS factory test-only overload guards from#if BUILD_TESTSto#ifdef BUILD_TESTS, and prints final compile/link flags at configure time.Written by Cursor Bugbot for commit dc45bbc. This will update automatically on new commits. Configure here.