From 2cc1c2d14ec3e46bd59ceb7043951af931639a8c Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Fri, 13 Nov 2026 04:41:33 -0400 Subject: [PATCH] add_python_test: run the row in the source tree, which is what these rows are about Review of engine#2344, where the reviewer found the class: add_python_test() emits add_test() with no WORKING_DIRECTORY, so every one of these 37 rows runs in the BUILD directory -- and a tool whose --root defaults to "." then looks for CMakeLists.txt where there is none. The self-test passed beside the failing check and the log said only 'no CMakeLists.txt under .', which is the diagnosis in one line. Measured before and after, all 37 rows, from the build directory: before (cwd = build): 37/37 passed, 19.70 s with WORKING_DIRECTORY=source: 37/37 passed, 21.01 s So no row depends on being in the build tree today, and the five rows that already pass an explicit --root keep working (an absolute path is unaffected). A row that DOES need the build tree now has to say so with its own WORKING_DIRECTORY, which is the right way round: the source tree is where the tools, tests/ and config/ these rows read actually live. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95dbd65d6..94bb33ff6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -382,6 +382,11 @@ find_package(Python3 COMPONENTS Interpreter) function(add_python_test name) if(Python3_Interpreter_FOUND) add_test(NAME ${name} COMMAND ${Python3_EXECUTABLE} ${ARGN}) + # engine#2344 review: ctest runs a test in the BUILD directory unless told otherwise, so a python + # row whose tool defaults to `--root .` looked for CMakeLists.txt where there is none -- the + # self-test passed beside a failing check and the log said only "no CMakeLists.txt under .". + # The source tree is what these rows are about; a row that needs the build tree says so itself. + set_tests_properties(${name} PROPERTIES WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) else() message(STATUS "ctest: not registering ${name} (no Python3 interpreter)") endif()