ctest: Introduce CTestDirectory

Introduce a new internal testProperty object called CTestDirectory.
This directory is originally set to the directory were the test was created,
but will not be overwritten when the WORKING_DIRECTORY property is
updated on the test.
This commit is contained in:
Joseph Snyder
2026-04-30 13:24:55 -04:00
parent a979d8eb3d
commit 870d7d7cbe
2 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -2493,7 +2493,8 @@ bool cmCTestTestHandler::AddTest(std::vector<std::string> const& args)
cmCTestTestProperties test;
test.Name = testname;
test.Args = args;
test.Directory = cmSystemTools::GetLogicalWorkingDirectory();
test.CTestDirectory = cmSystemTools::GetLogicalWorkingDirectory();
test.Directory = test.CTestDirectory;
cmCTestOptionalLog(this->CTest, DEBUG,
"Set test directory: " << test.Directory << std::endl,
this->Quiet);
+3
View File
@@ -131,7 +131,10 @@ public:
void AppendError(cm::string_view err);
cm::optional<std::string> Error;
std::string Name;
// working directory for test, overridden by WORKING_DIRECTORY property
std::string Directory;
// Original directory of test creation
std::string CTestDirectory;
std::vector<std::string> Args;
std::vector<std::string> RequiredFiles;
std::vector<std::string> Depends;