diff options
author | Brad King <brad.king@kitware.com> | 2019-11-04 21:11:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-11-05 17:08:01 (GMT) |
commit | af9ed543b0f9d032158f91cdce7ad6908ff9365b (patch) | |
tree | 35440e92b200965f0be878b37226ca0663bdf0a2 /Source/CTest | |
parent | c1d5d5eb11e0260ffadda0851ac844ab46b6b179 (diff) | |
download | CMake-af9ed543b0f9d032158f91cdce7ad6908ff9365b.zip CMake-af9ed543b0f9d032158f91cdce7ad6908ff9365b.tar.gz CMake-af9ed543b0f9d032158f91cdce7ad6908ff9365b.tar.bz2 |
CTest: Rename PROCESSES test property to RESOURCE_GROUPS
The `PROCESSES` test property name added for CMake 3.16 is too close to
the existing `PROCESSORS` test property. Furthermore, the property in
principle specifies groups of resources organized in a way that is
meaningful to a particular test. The groups may often correspond to
processes but they could have other meanings. Since the property name
`PROCESSES` has not been in a final 3.16 release yet, simply rename it
to `RESOURCE_GROUPS`.
Fixes: #19914
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 25 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 10 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 6 |
4 files changed, 24 insertions, 23 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 7e8d548..c71ae7b 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -230,7 +230,7 @@ bool cmCTestMultiProcessHandler::AllocateHardware(int index) } auto& allocatedHardware = this->AllocatedHardware[index]; - allocatedHardware.resize(this->Properties[index]->Processes.size()); + allocatedHardware.resize(this->Properties[index]->ResourceGroups.size()); for (auto const& it : allocations) { for (auto const& alloc : it.second) { bool result = this->HardwareAllocator.AllocateResource( @@ -252,7 +252,7 @@ bool cmCTestMultiProcessHandler::TryAllocateHardware( allocations.clear(); std::size_t processIndex = 0; - for (auto const& process : this->Properties[index]->Processes) { + for (auto const& process : this->Properties[index]->ResourceGroups) { for (auto const& requirement : process) { for (int i = 0; i < requirement.UnitsNeeded; ++i) { allocations[requirement.ResourceType].push_back( @@ -912,14 +912,14 @@ static Json::Value DumpTimeoutAfterMatch( return timeoutAfterMatch; } -static Json::Value DumpProcessesToJsonArray( +static Json::Value DumpResourceGroupsToJsonArray( const std::vector< std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>& - processes) + resourceGroups) { - Json::Value jsonProcesses = Json::arrayValue; - for (auto const& it : processes) { - Json::Value jsonProcess = Json::objectValue; + Json::Value jsonResourceGroups = Json::arrayValue; + for (auto const& it : resourceGroups) { + Json::Value jsonResourceGroup = Json::objectValue; Json::Value requirements = Json::arrayValue; for (auto const& it2 : it) { Json::Value res = Json::objectValue; @@ -928,10 +928,10 @@ static Json::Value DumpProcessesToJsonArray( res["slots"] = it2.SlotsNeeded; requirements.append(res); } - jsonProcess["requirements"] = requirements; - jsonProcesses.append(jsonProcess); + jsonResourceGroup["requirements"] = requirements; + jsonResourceGroups.append(jsonResourceGroup); } - return jsonProcesses; + return jsonResourceGroups; } static Json::Value DumpCTestProperty(std::string const& name, @@ -1005,9 +1005,10 @@ static Json::Value DumpCTestProperties( "PASS_REGULAR_EXPRESSION", DumpRegExToJsonArray(testProperties.RequiredRegularExpressions))); } - if (!testProperties.Processes.empty()) { + if (!testProperties.ResourceGroups.empty()) { properties.append(DumpCTestProperty( - "PROCESSES", DumpProcessesToJsonArray(testProperties.Processes))); + "RESOURCE_GROUPS", + DumpResourceGroupsToJsonArray(testProperties.ResourceGroups))); } if (testProperties.WantAffinity) { properties.append( diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 7f7f736..91eeb71 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -693,7 +693,7 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout, if (this->UseAllocatedHardware) { this->SetupHardwareEnvironment(); } else { - cmSystemTools::UnsetEnv("CTEST_PROCESS_COUNT"); + cmSystemTools::UnsetEnv("CTEST_RESOURCE_GROUP_COUNT"); } return this->TestProcess->StartProcess(this->MultiTestHandler.Loop, @@ -702,13 +702,13 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout, void cmCTestRunTest::SetupHardwareEnvironment() { - std::string processCount = "CTEST_PROCESS_COUNT="; + std::string processCount = "CTEST_RESOURCE_GROUP_COUNT="; processCount += std::to_string(this->AllocatedHardware.size()); cmSystemTools::PutEnv(processCount); std::size_t i = 0; for (auto const& process : this->AllocatedHardware) { - std::string prefix = "CTEST_PROCESS_"; + std::string prefix = "CTEST_RESOURCE_GROUP_"; prefix += std::to_string(i); std::string resourceList = prefix + '='; prefix += '_'; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 2be62ae..0f21f91 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1626,11 +1626,11 @@ std::string cmCTestTestHandler::FindExecutable( return fullPath; } -bool cmCTestTestHandler::ParseProcessesProperty( +bool cmCTestTestHandler::ParseResourceGroupsProperty( const std::string& val, - std::vector<std::vector<cmCTestTestResourceRequirement>>& processes) + std::vector<std::vector<cmCTestTestResourceRequirement>>& resourceGroups) { - cmCTestProcessesLexerHelper lexer(processes); + cmCTestProcessesLexerHelper lexer(resourceGroups); return lexer.ParseString(val); } @@ -2203,8 +2203,8 @@ bool cmCTestTestHandler::SetTestsProperties( if (key == "PROCESSOR_AFFINITY") { rt.WantAffinity = cmIsOn(val); } - if (key == "PROCESSES") { - if (!ParseProcessesProperty(val, rt.Processes)) { + if (key == "RESOURCE_GROUPS") { + if (!ParseResourceGroupsProperty(val, rt.ResourceGroups)) { return false; } } diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 525215c..e2fde42 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -158,7 +158,7 @@ public: std::set<std::string> FixturesCleanup; std::set<std::string> FixturesRequired; std::set<std::string> RequireSuccessDepends; - std::vector<std::vector<cmCTestTestResourceRequirement>> Processes; + std::vector<std::vector<cmCTestTestResourceRequirement>> ResourceGroups; // Private test generator properties used to track backtraces cmListFileBacktrace Backtrace; }; @@ -202,9 +202,9 @@ public: std::vector<std::string>& extraPaths, std::vector<std::string>& failed); - static bool ParseProcessesProperty( + static bool ParseResourceGroupsProperty( const std::string& val, - std::vector<std::vector<cmCTestTestResourceRequirement>>& processes); + std::vector<std::vector<cmCTestTestResourceRequirement>>& resourceGroups); using ListOfTests = std::vector<cmCTestTestProperties>; |