diff options
author | Brad King <brad.king@kitware.com> | 2019-11-04 22:29:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-11-05 17:08:35 (GMT) |
commit | 73a40b19ffa49bfc92fbe10bd0fd3821b7facae6 (patch) | |
tree | aec4dbf42b7c07b0303b88fdfecfdfed882fd7c2 /Source/CTest/cmCTestResourceGroupsLexerHelper.cxx | |
parent | af9ed543b0f9d032158f91cdce7ad6908ff9365b (diff) | |
download | CMake-73a40b19ffa49bfc92fbe10bd0fd3821b7facae6.zip CMake-73a40b19ffa49bfc92fbe10bd0fd3821b7facae6.tar.gz CMake-73a40b19ffa49bfc92fbe10bd0fd3821b7facae6.tar.bz2 |
CTest: Rename "Processes" lexer to "ResourceGroups"
The corresponding test property `PROCESSES` has been renamed to
`RESOURCE_GROUPS`.
Diffstat (limited to 'Source/CTest/cmCTestResourceGroupsLexerHelper.cxx')
-rw-r--r-- | Source/CTest/cmCTestResourceGroupsLexerHelper.cxx | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx b/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx new file mode 100644 index 0000000..072af42 --- /dev/null +++ b/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx @@ -0,0 +1,55 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmCTestResourceGroupsLexerHelper.h" + +#include "cmCTestResourceGroupsLexer.h" +#include "cmCTestTestHandler.h" + +cmCTestResourceGroupsLexerHelper::cmCTestResourceGroupsLexerHelper( + std::vector<std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>& + output) + : Output(output) +{ +} + +bool cmCTestResourceGroupsLexerHelper::ParseString(const std::string& value) +{ + yyscan_t lexer; + cmCTestResourceGroups_yylex_init_extra(this, &lexer); + + auto state = cmCTestResourceGroups_yy_scan_string(value.c_str(), lexer); + int retval = cmCTestResourceGroups_yylex(lexer); + cmCTestResourceGroups_yy_delete_buffer(state, lexer); + + cmCTestResourceGroups_yylex_destroy(lexer); + return retval == 0; +} + +void cmCTestResourceGroupsLexerHelper::SetProcessCount(unsigned int count) +{ + this->ProcessCount = count; +} + +void cmCTestResourceGroupsLexerHelper::SetResourceType(const std::string& type) +{ + this->ResourceType = type; +} + +void cmCTestResourceGroupsLexerHelper::SetNeededSlots(int count) +{ + this->NeededSlots = count; +} + +void cmCTestResourceGroupsLexerHelper::WriteRequirement() +{ + this->Process.push_back({ this->ResourceType, this->NeededSlots, 1 }); +} + +void cmCTestResourceGroupsLexerHelper::WriteProcess() +{ + for (unsigned int i = 0; i < this->ProcessCount; ++i) { + this->Output.push_back(this->Process); + } + this->Process.clear(); + this->ProcessCount = 1; +} |