From b13139ad19753cdfb80413ef7a2dfb9e5b104070 Mon Sep 17 00:00:00 2001 From: Krystie Date: Wed, 5 Aug 2026 17:58:38 -0700 Subject: [PATCH] [grade=B urn:ump:7xuqv7qt7yyvchfbwdciklpoeh2cptk4czo7637allvx45zx6rlq] fix(test): pin WORKING_DIRECTORY to CMAKE_SOURCE_DIR for triangles_unit_tests The consensus_safety_tests reindex_reconstruction_is_explicit_and_fail_closed test reads src/init.cpp + src/main.cpp via __FILE__-relative 3x parent_path() traversal. CI runs 'cd build/src && ctest', so the default CMAKE_CURRENT_BINARY_DIR resolves __FILE__ relative paths to build/src/src/init.cpp which doesn't exist. Pinning WORKING_DIRECTORY to ${CMAKE_SOURCE_DIR} makes the test source paths resolve correctly from any environment. Verified locally: ctest -R triangles_unit_tests passes 1.32s from build/ after fix. Cycle 21 fix for CI run 31058657378 failure. --- src/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index be8b9aa..8345fc9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -670,7 +670,16 @@ if(BUILD_TESTS) Boost::unit_test_framework ) + # WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}: the consensus_safety_tests + # `reindex_reconstruction_is_explicit_and_fail_closed` test reads + # src/init.cpp + src/main.cpp via __FILE__-relative path traversal + # (3x parent_path() calls). When ctest runs from build/src/ (the + # default CMAKE_CURRENT_BINARY_DIR for src/CMakeLists.txt), the + # resolved path is build/src/src/init.cpp which doesn't exist. + # Pinning WORKING_DIRECTORY to "${CMAKE_SOURCE_DIR}" makes the test + # source paths resolve correctly from any environment. add_test(NAME triangles_unit_tests COMMAND test_triangles --log_level=test_suite) + set_tests_properties(triangles_unit_tests PROPERTIES WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") # ── Standalone chaindb equivalence tests ───────────────────────────────── # Runs without the TestingSetup global fixture (which would otherwise