Skip to content

Commit 85e58f2

Browse files
committed
ci(test): hoist include(GoogleTest) before first gtest_discover_tests (PRE_TEST exit-8 fix)
The plain Linux x86_64 and AsAN+UBSan lanes failed at ctest with exit 8: CMake Error at build_*/test/test_dgb_subsidy[1]_include.cmake:6 Unknown CMake command "gtest_discover_tests_impl". preceded by "include() given empty file name (ignored)". include(GoogleTest) sets _GOOGLETEST_DISCOVER_TESTS_SCRIPT (the path to GoogleTestAddTests.cmake). It was at line ~176, AFTER the first three gtest_discover_tests() calls (test_dgb_subsidy/coinbase_value/utxo, all DISCOVERY_MODE PRE_TEST). In PRE_TEST the generated <tgt>[1]_include.cmake includes that script at ctest time to define gtest_discover_tests_impl; with the var unset the include path was empty and ctest aborted. The clean-build-dir step (8d05ef2) removed the cached _tests.cmake that had masked the broken else-branch, surfacing it on the first PRE_TEST target. Fix: hoist include(GoogleTest) to the top of the BUILD_TESTING block.
1 parent 7705a58 commit 85e58f2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
if (BUILD_TESTING AND GTest_FOUND)
2+
# include(GoogleTest) MUST precede any gtest_discover_tests() call below:
3+
# it sets _GOOGLETEST_DISCOVER_TESTS_SCRIPT (path to GoogleTestAddTests.cmake).
4+
# In PRE_TEST mode the generated <tgt>[1]_include.cmake includes that script
5+
# to define gtest_discover_tests_impl; if the var is unset the include path is
6+
# empty and ctest dies "Unknown CMake command gtest_discover_tests_impl" (exit
7+
# 8). The clean-build-dir step (8d05ef2b) removed the cached _tests.cmake that
8+
# had masked this, surfacing it on test_dgb_subsidy (the first PRE_TEST call).
9+
include(GoogleTest)
10+
211
# DGB block subsidy oracle-conformance (card #156). config_coin.hpp
312
# subsidy() is header-only/static; no dgb runtime link required.
413
add_executable(test_dgb_subsidy test_dgb_subsidy.cpp)

0 commit comments

Comments
 (0)