Skip to content

Commit f58d7f2

Browse files
DannyWall92claude
andcommitted
Fix test discovery failure: defer gtest_discover_tests to test time
gtest_discover_tests() runs the test binary at build time to enumerate tests, but the CI container has no NVIDIA driver so libnvidia-ml.so.1 is missing at runtime. The binary links fine against the CUDA toolkit stub but cannot execute. - Use DISCOVERY_MODE PRE_TEST to defer discovery to ctest runtime - Add LD_LIBRARY_PATH for CUDA stubs in the unit-tests CI job so the tests can load when ctest actually runs them Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2db0f39 commit f58d7f2

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

.github/workflows/ci-probe-agent.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ jobs:
7878
7979
- name: Build and test
8080
working-directory: probe-agent
81+
env:
82+
LD_LIBRARY_PATH: /usr/local/cuda/lib64/stubs
8183
run: |
8284
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON
8385
cmake --build build --parallel $(nproc)

probe-agent/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ if(SENTINEL_BUILD_TESTS OR BUILD_TESTING)
245245
list(APPEND _UNIT_TEST_LIBS GTest::gmock)
246246
endif()
247247
target_link_libraries(sentinel_unit_tests PRIVATE ${_UNIT_TEST_LIBS})
248-
gtest_discover_tests(sentinel_unit_tests)
248+
gtest_discover_tests(sentinel_unit_tests DISCOVERY_MODE PRE_TEST)
249249

250250
# CUDA unit tests
251251
set(CUDA_UNIT_TESTS
@@ -262,7 +262,7 @@ if(SENTINEL_BUILD_TESTS OR BUILD_TESTING)
262262
GTest::gtest
263263
GTest::gtest_main
264264
)
265-
gtest_discover_tests(sentinel_cuda_unit_tests)
265+
gtest_discover_tests(sentinel_cuda_unit_tests DISCOVERY_MODE PRE_TEST)
266266

267267
# Integration tests (gRPC tests only when protobuf/gRPC are available)
268268
set(INTEGRATION_TESTS
@@ -281,7 +281,7 @@ if(SENTINEL_BUILD_TESTS OR BUILD_TESTING)
281281
GTest::gtest
282282
GTest::gtest_main
283283
)
284-
gtest_discover_tests(sentinel_integration_tests)
284+
gtest_discover_tests(sentinel_integration_tests DISCOVERY_MODE PRE_TEST)
285285
else()
286286
message(STATUS "GTest not found — skipping test targets")
287287
endif()

0 commit comments

Comments
 (0)