ctest_start() invoked by script launched with ctest_run_script() sets ShouldRunCurrentScript on wrong cmCTestScriptHandler instance
Running ctest -S script.cmake
on an empty file, leads to an error that CTEST_SOURCE_DIRECTORY
, CTEST_BINARY_DIRECTORY
, and CTEST_COMMAND
are not set. This is the declarative
dashboard script mode.
When ctest_start(Experimental "." ".")
is added to the file, the error disappears, because ctest_start()
activates the command-driven
dashboard script mode.
When launching the script with the ctest_run_script()
command from another script, the error message is back.
Looking at the source code, we see that inside the functon cmCTestScriptHandler::RunScript
an instance of cmCTestScriptHandler
is created for the nested script. However, in cmCTestStartCommand::InitialPass
, SetRunCurrentScript(false)
is called on the instance of the outer script.
Expected behavior:
ctest_start()
(and maybe also ctest_run_script()
?) should call SetRunCurrentScript(false)
on the cmCTestScriptHandler
of the script where it is actually invoked.