Commit af9ed543 authored by Brad King's avatar Brad King
Browse files

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
parent c1d5d5eb
...@@ -414,10 +414,10 @@ Properties on Tests ...@@ -414,10 +414,10 @@ Properties on Tests
/prop_test/LABELS /prop_test/LABELS
/prop_test/MEASUREMENT /prop_test/MEASUREMENT
/prop_test/PASS_REGULAR_EXPRESSION /prop_test/PASS_REGULAR_EXPRESSION
/prop_test/PROCESSES
/prop_test/PROCESSOR_AFFINITY /prop_test/PROCESSOR_AFFINITY
/prop_test/PROCESSORS /prop_test/PROCESSORS
/prop_test/REQUIRED_FILES /prop_test/REQUIRED_FILES
/prop_test/RESOURCE_GROUPS
/prop_test/RESOURCE_LOCK /prop_test/RESOURCE_LOCK
/prop_test/RUN_SERIAL /prop_test/RUN_SERIAL
/prop_test/SKIP_REGULAR_EXPRESSION /prop_test/SKIP_REGULAR_EXPRESSION
......
...@@ -1317,8 +1317,8 @@ The CTest hardware allocation feature consists of two inputs: ...@@ -1317,8 +1317,8 @@ The CTest hardware allocation feature consists of two inputs:
* The :ref:`hardware specification file <ctest-hardware-specification-file>`, * The :ref:`hardware specification file <ctest-hardware-specification-file>`,
described below, which describes the hardware resources available on the described below, which describes the hardware resources available on the
system, and system, and
* The :prop_test:`PROCESSES` property of tests, which describes the resources * The :prop_test:`RESOURCE_GROUPS` property of tests, which describes the
required by the test resources required by the test
When CTest runs a test, the hardware allocated to that test is passed in the When CTest runs a test, the hardware allocated to that test is passed in the
form of a set of form of a set of
...@@ -1326,11 +1326,11 @@ form of a set of ...@@ -1326,11 +1326,11 @@ form of a set of
described below. Using this information to decide which resource to connect to described below. Using this information to decide which resource to connect to
is left to the test writer. is left to the test writer.
Please note that these processes are not spawned by CTest. The ``PROCESSES`` The ``RESOURCE_GROUPS`` property tells CTest what resources a test expects
property merely tells CTest what processes the test expects to launch. It is up to use grouped in a way meaningful to the test. The test itself must read
to the test itself to do this process spawning, and read the :ref:`environment the :ref:`environment variables <ctest-hardware-environment-variables>` to
variables <ctest-hardware-environment-variables>` to determine which resources determine which resources have been allocated to each group. For example,
each process has been allocated. each group may correspond to a process the test will spawn when executed.
.. _`ctest-hardware-specification-file`: .. _`ctest-hardware-specification-file`:
...@@ -1423,10 +1423,10 @@ In the example file above, there are four GPUs with ID's 0 through 3. GPU 0 has ...@@ -1423,10 +1423,10 @@ In the example file above, there are four GPUs with ID's 0 through 3. GPU 0 has
2 slots, GPU 1 has 4, GPU 2 has 2, and GPU 3 has a default of 1 slot. There is 2 slots, GPU 1 has 4, GPU 2 has 2, and GPU 3 has a default of 1 slot. There is
also one cryptography chip with 4 slots. also one cryptography chip with 4 slots.
``PROCESSES`` Property ``RESOURCE_GROUPS`` Property
---------------------- ----------------------------
See :prop_test:`PROCESSES` for a description of this property. See :prop_test:`RESOURCE_GROUPS` for a description of this property.
.. _`ctest-hardware-environment-variables`: .. _`ctest-hardware-environment-variables`:
...@@ -1436,65 +1436,67 @@ Environment Variables ...@@ -1436,65 +1436,67 @@ Environment Variables
Once CTest has decided which resources to allocate to a test, it passes this Once CTest has decided which resources to allocate to a test, it passes this
information to the test executable as a series of environment variables. For information to the test executable as a series of environment variables. For
each example below, we will assume that the test in question has a each example below, we will assume that the test in question has a
:prop_test:`PROCESSES` property of ``2,gpus:2;gpus:4,gpus:1,crypto_chips:2``. :prop_test:`RESOURCE_GROUPS` property of
``2,gpus:2;gpus:4,gpus:1,crypto_chips:2``.
The following variables are passed to the test process: The following variables are passed to the test process:
.. envvar:: CTEST_PROCESS_COUNT .. envvar:: CTEST_RESOURCE_GROUP_COUNT
The total number of processes specified by the :prop_test:`PROCESSES` The total number of groups specified by the :prop_test:`RESOURCE_GROUPS`
property. For example: property. For example:
* ``CTEST_PROCESS_COUNT=3`` * ``CTEST_RESOURCE_GROUP_COUNT=3``
This variable will only be defined if :manual:`ctest(1)` has been given a This variable will only be defined if :manual:`ctest(1)` has been given a
``--hardware-spec-file``, or if :command:`ctest_test` has been given a ``--hardware-spec-file``, or if :command:`ctest_test` has been given a
``HARDWARE_SPEC_FILE``. If no hardware specification file has been given, ``HARDWARE_SPEC_FILE``. If no hardware specification file has been given,
this variable will not be defined. this variable will not be defined.
.. envvar:: CTEST_PROCESS_<num> .. envvar:: CTEST_RESOURCE_GROUP_<num>
The list of resource types allocated to each process, with each item The list of resource types allocated to each group, with each item
separated by a comma. ``<num>`` is a number from zero to separated by a comma. ``<num>`` is a number from zero to
``CTEST_PROCESS_COUNT`` minus one. ``CTEST_PROCESS_<num>`` is defined for ``CTEST_RESOURCE_GROUP_COUNT`` minus one. ``CTEST_RESOURCE_GROUP_<num>``
each ``<num>`` in this range. For example: is defined for each ``<num>`` in this range. For example:
* ``CTEST_PROCESS_0=gpus`` * ``CTEST_RESOURCE_GROUP_0=gpus``
* ``CTEST_PROCESS_1=gpus`` * ``CTEST_RESOURCE_GROUP_1=gpus``
* ``CTEST_PROCESS_2=crypto_chips,gpus`` * ``CTEST_RESOURCE_GROUP_2=crypto_chips,gpus``
.. envvar:: CTEST_PROCESS_<num>_<resource-type> .. envvar:: CTEST_RESOURCE_GROUP_<num>_<resource-type>
The list of resource IDs and number of slots from each ID allocated to each The list of resource IDs and number of slots from each ID allocated to each
process for a given resource type. This variable consists of a series of group for a given resource type. This variable consists of a series of
pairs, each pair separated by a semicolon, and with the two items in the pair pairs, each pair separated by a semicolon, and with the two items in the pair
separated by a comma. The first item in each pair is ``id:`` followed by the separated by a comma. The first item in each pair is ``id:`` followed by the
ID of a resource of type ``<resource-type>``, and the second item is ID of a resource of type ``<resource-type>``, and the second item is
``slots:`` followed by the number of slots from that resource allocated to ``slots:`` followed by the number of slots from that resource allocated to
the given process. For example: the given group. For example:
* ``CTEST_PROCESS_0_GPUS=id:0,slots:2`` * ``CTEST_RESOURCE_GROUP_0_GPUS=id:0,slots:2``
* ``CTEST_PROCESS_1_GPUS=id:2,slots:2`` * ``CTEST_RESOURCE_GROUP_1_GPUS=id:2,slots:2``
* ``CTEST_PROCESS_2_GPUS=id:1,slots:4;id:3,slots:1`` * ``CTEST_RESOURCE_GROUP_2_GPUS=id:1,slots:4;id:3,slots:1``
* ``CTEST_PROCESS_2_CRYPTO_CHIPS=id:card0,slots:2`` * ``CTEST_RESOURCE_GROUP_2_CRYPTO_CHIPS=id:card0,slots:2``
In this example, process 0 gets 2 slots from GPU ``0``, process 1 gets 2 slots In this example, group 0 gets 2 slots from GPU ``0``, group 1 gets 2 slots
from GPU ``2``, and process 2 gets 4 slots from GPU ``1`` and 2 slots from from GPU ``2``, and group 2 gets 4 slots from GPU ``1`` and 2 slots from
cryptography chip ``card0``. cryptography chip ``card0``.
``<num>`` is a number from zero to ``CTEST_PROCESS_COUNT`` minus one. ``<num>`` is a number from zero to ``CTEST_RESOURCE_GROUP_COUNT`` minus one.
``<resource-type>`` is the name of a resource type, converted to uppercase. ``<resource-type>`` is the name of a resource type, converted to uppercase.
``CTEST_PROCESS_<num>_<resource-type>`` is defined for the product of each ``CTEST_RESOURCE_GROUP_<num>_<resource-type>`` is defined for the product
``<num>`` in the range listed above and each resource type listed in of each ``<num>`` in the range listed above and each resource type listed in
``CTEST_PROCESS_<num>``. ``CTEST_RESOURCE_GROUP_<num>``.
Because some platforms have case-insensitive names for environment variables, Because some platforms have case-insensitive names for environment variables,
the names of resource types may not clash in a case-insensitive environment. the names of resource types may not clash in a case-insensitive environment.
Because of this, for the sake of simplicity, all resource types must be Because of this, for the sake of simplicity, all resource types must be
listed in all lowercase in the listed in all lowercase in the
:ref:`hardware specification file <ctest-hardware-specification-file>` and in :ref:`hardware specification file <ctest-hardware-specification-file>` and
the :prop_test:`PROCESSES` property, and they are converted to all uppercase in the :prop_test:`RESOURCE_GROUPS` property, and they are converted to all
in the ``CTEST_PROCESS_<num>_<resource-type>`` environment variable. uppercase in the ``CTEST_RESOURCE_GROUP_<num>_<resource-type>`` environment
variable.
See Also See Also
======== ========
......
PROCESSES
----------
Set to specify the number of processes spawned by a test, and the resources
that they require. See :ref:`hardware allocation <ctest-hardware-allocation>`
for more information on how this property integrates into the CTest hardware
allocation feature.
The ``PROCESSES`` property is a :ref:`semicolon-separated list <CMake Language
Lists>` of process descriptions. Each process description consists of an
optional number of processes for the description followed by a series of
resource requirements for those processes. These requirements (and the number
of processes) are separated by commas. The resource requirements consist of the
name of a resource type, followed by a colon, followed by an unsigned integer
specifying the number of slots required on one resource of the given type.
Please note that these processes are not spawned by CTest. The ``PROCESSES``
property merely tells CTest what processes the test expects to launch. It is up
to the test itself to do this process spawning, and read the :ref:`environment
variables <ctest-hardware-environment-variables>` to determine which resources
each process has been allocated.
Consider the following example:
.. code-block:: cmake
add_test(NAME MyTest COMMAND MyExe)
set_property(TEST MyTest PROPERTY PROCESSES
"2,gpus:2"
"gpus:4,crypto_chips:2")
In this example, there are two process descriptions (implicitly separated by a
semicolon.) The content of the first description is ``2,gpus:2``. This
description spawns 2 processes, each of which requires 2 slots from a single
GPU. The content of the second description is ``gpus:4,crypto_chips:2``. This
description does not specify a process count, so a default of 1 is assumed.
This single process requires 4 slots from a single GPU and 2 slots from a
single cryptography chip. In total, 3 processes are spawned from this test,
each with their own unique requirements.
When CTest sets the :ref:`environment variables
<ctest-hardware-environment-variables>` for a test, it assigns a process number
based on the process description, starting at 0 on the left and the number of
processes minus 1 on the right. For example, in the example above, the two
processes in the first description would have IDs of 0 and 1, and the single
process in the second description would have an ID of 2.
Both the ``PROCESSES`` and :prop_test:`RESOURCE_LOCK` properties serve similar
purposes, but they are distinct and orthogonal. Resources specified by
``PROCESSES`` do not affect :prop_test:`RESOURCE_LOCK`, and vice versa. Whereas
:prop_test:`RESOURCE_LOCK` is a simpler property that is used for locking one
global resource, ``PROCESSES`` is a more advanced property that allows multiple
tests to simultaneously use multiple resources of the same type, specifying
their requirements in a fine-grained manner.
RESOURCE_GROUPS
---------------
Specify resources required by a test, grouped in a way that is meaningful to
the test. See :ref:`hardware allocation <ctest-hardware-allocation>`
for more information on how this property integrates into the CTest hardware
allocation feature.
The ``RESOURCE_GROUPS`` property is a :ref:`semicolon-separated list <CMake
Language Lists>` of group descriptions. Each entry consists of an optional
number of groups using the description followed by a series of resource
requirements for those groups. These requirements (and the number of groups)
are separated by commas. The resource requirements consist of the name of a
resource type, followed by a colon, followed by an unsigned integer
specifying the number of slots required on one resource of the given type.
The ``RESOURCE_GROUPS`` property tells CTest what resources a test expects
to use grouped in a way meaningful to the test. The test itself must read
the :ref:`environment variables <ctest-hardware-environment-variables>` to
determine which resources have been allocated to each group. For example,
each group may correspond to a process the test will spawn when executed.
Consider the following example:
.. code-block:: cmake
add_test(NAME MyTest COMMAND MyExe)
set_property(TEST MyTest PROPERTY RESOURCE_GROUPS
"2,gpus:2"
"gpus:4,crypto_chips:2")
In this example, there are two group descriptions (implicitly separated by a
semicolon.) The content of the first description is ``2,gpus:2``. This
description specifies 2 groups, each of which requires 2 slots from a single
GPU. The content of the second description is ``gpus:4,crypto_chips:2``. This
description does not specify a group count, so a default of 1 is assumed.
This single group requires 4 slots from a single GPU and 2 slots from a
single cryptography chip. In total, 3 resource groups are specified for this
test, each with its own unique requirements.
When CTest sets the :ref:`environment variables
<ctest-hardware-environment-variables>` for a test, it assigns a group number
based on the group description, starting at 0 on the left and the number of
groups minus 1 on the right. For example, in the example above, the two
groups in the first description would have IDs of 0 and 1, and the single
group in the second description would have an ID of 2.
Both the ``RESOURCE_GROUPS`` and :prop_test:`RESOURCE_LOCK` properties serve
similar purposes, but they are distinct and orthogonal. Resources specified by
``RESOURCE_GROUPS`` do not affect :prop_test:`RESOURCE_LOCK`, and vice versa.
Whereas :prop_test:`RESOURCE_LOCK` is a simpler property that is used for
locking one global resource, ``RESOURCE_GROUPS`` is a more advanced property
that allows multiple tests to simultaneously use multiple resources of the
same type, specifying their requirements in a fine-grained manner.
...@@ -9,10 +9,10 @@ not to run concurrently. ...@@ -9,10 +9,10 @@ not to run concurrently.
See also :prop_test:`FIXTURES_REQUIRED` if the resource requires any setup or See also :prop_test:`FIXTURES_REQUIRED` if the resource requires any setup or
cleanup steps. cleanup steps.
Both the :prop_test:`PROCESSES` and ``RESOURCE_LOCK`` properties serve similar Both the :prop_test:`RESOURCE_GROUPS` and ``RESOURCE_LOCK`` properties serve
purposes, but they are distinct and orthogonal. Resources specified by similar purposes, but they are distinct and orthogonal. Resources specified by
:prop_test:`PROCESSES` do not affect ``RESOURCE_LOCK``, and vice versa. Whereas :prop_test:`RESOURCE_GROUPS` do not affect ``RESOURCE_LOCK``, and vice versa.
``RESOURCE_LOCK`` is a simpler property that is used for locking one global Whereas ``RESOURCE_LOCK`` is a simpler property that is used for locking one
resource, :prop_test:`PROCESSES` is a more advanced property that allows global resource, :prop_test:`RESOURCE_GROUPS` is a more advanced property
multiple tests to simultaneously use multiple resources of the same type, that allows multiple tests to simultaneously use multiple resources of the
specifying their requirements in a fine-grained manner. same type, specifying their requirements in a fine-grained manner.
...@@ -230,7 +230,7 @@ bool cmCTestMultiProcessHandler::AllocateHardware(int index) ...@@ -230,7 +230,7 @@ bool cmCTestMultiProcessHandler::AllocateHardware(int index)
} }
auto& allocatedHardware = this->AllocatedHardware[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& it : allocations) {
for (auto const& alloc : it.second) { for (auto const& alloc : it.second) {
bool result = this->HardwareAllocator.AllocateResource( bool result = this->HardwareAllocator.AllocateResource(
...@@ -252,7 +252,7 @@ bool cmCTestMultiProcessHandler::TryAllocateHardware( ...@@ -252,7 +252,7 @@ bool cmCTestMultiProcessHandler::TryAllocateHardware(
allocations.clear(); allocations.clear();
std::size_t processIndex = 0; 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 (auto const& requirement : process) {
for (int i = 0; i < requirement.UnitsNeeded; ++i) { for (int i = 0; i < requirement.UnitsNeeded; ++i) {
allocations[requirement.ResourceType].push_back( allocations[requirement.ResourceType].push_back(
...@@ -912,14 +912,14 @@ static Json::Value DumpTimeoutAfterMatch( ...@@ -912,14 +912,14 @@ static Json::Value DumpTimeoutAfterMatch(
return timeoutAfterMatch; return timeoutAfterMatch;
} }
static Json::Value DumpProcessesToJsonArray( static Json::Value DumpResourceGroupsToJsonArray(
const std::vector< const std::vector<
std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>& std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>&
processes) resourceGroups)
{ {
Json::Value jsonProcesses = Json::arrayValue; Json::Value jsonResourceGroups = Json::arrayValue;
for (auto const& it : processes) { for (auto const& it : resourceGroups) {
Json::Value jsonProcess = Json::objectValue; Json::Value jsonResourceGroup = Json::objectValue;
Json::Value requirements = Json::arrayValue; Json::Value requirements = Json::arrayValue;
for (auto const& it2 : it) { for (auto const& it2 : it) {
Json::Value res = Json::objectValue; Json::Value res = Json::objectValue;
...@@ -928,10 +928,10 @@ static Json::Value DumpProcessesToJsonArray( ...@@ -928,10 +928,10 @@ static Json::Value DumpProcessesToJsonArray(
res["slots"] = it2.SlotsNeeded; res["slots"] = it2.SlotsNeeded;
requirements.append(res); requirements.append(res);
} }
jsonProcess["requirements"] = requirements; jsonResourceGroup["requirements"] = requirements;
jsonProcesses.append(jsonProcess); jsonResourceGroups.append(jsonResourceGroup);
} }
return jsonProcesses; return jsonResourceGroups;
} }
static Json::Value DumpCTestProperty(std::string const& name, static Json::Value DumpCTestProperty(std::string const& name,
...@@ -1005,9 +1005,10 @@ static Json::Value DumpCTestProperties( ...@@ -1005,9 +1005,10 @@ static Json::Value DumpCTestProperties(
"PASS_REGULAR_EXPRESSION", "PASS_REGULAR_EXPRESSION",
DumpRegExToJsonArray(testProperties.RequiredRegularExpressions))); DumpRegExToJsonArray(testProperties.RequiredRegularExpressions)));
} }
if (!testProperties.Processes.empty()) { if (!testProperties.ResourceGroups.empty()) {
properties.append(DumpCTestProperty( properties.append(DumpCTestProperty(
"PROCESSES", DumpProcessesToJsonArray(testProperties.Processes))); "RESOURCE_GROUPS",
DumpResourceGroupsToJsonArray(testProperties.ResourceGroups)));
} }
if (testProperties.WantAffinity) { if (testProperties.WantAffinity) {
properties.append( properties.append(
......
...@@ -693,7 +693,7 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout, ...@@ -693,7 +693,7 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout,
if (this->UseAllocatedHardware) { if (this->UseAllocatedHardware) {
this->SetupHardwareEnvironment(); this->SetupHardwareEnvironment();
} else { } else {
cmSystemTools::UnsetEnv("CTEST_PROCESS_COUNT"); cmSystemTools::UnsetEnv("CTEST_RESOURCE_GROUP_COUNT");
} }
return this->TestProcess->StartProcess(this->MultiTestHandler.Loop, return this->TestProcess->StartProcess(this->MultiTestHandler.Loop,
...@@ -702,13 +702,13 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout, ...@@ -702,13 +702,13 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout,
void cmCTestRunTest::SetupHardwareEnvironment() void cmCTestRunTest::SetupHardwareEnvironment()
{ {
std::string processCount = "CTEST_PROCESS_COUNT="; std::string processCount = "CTEST_RESOURCE_GROUP_COUNT=";
processCount += std::to_string(this->AllocatedHardware.size()); processCount += std::to_string(this->AllocatedHardware.size());
cmSystemTools::PutEnv(processCount); cmSystemTools::PutEnv(processCount);
std::size_t i = 0; std::size_t i = 0;
for (auto const& process : this->AllocatedHardware) { for (auto const& process : this->AllocatedHardware) {
std::string prefix = "CTEST_PROCESS_"; std::string prefix = "CTEST_RESOURCE_GROUP_";
prefix += std::to_string(i); prefix += std::to_string(i);
std::string resourceList = prefix + '='; std::string resourceList = prefix + '=';
prefix += '_'; prefix += '_';
......
...@@ -1626,11 +1626,11 @@ std::string cmCTestTestHandler::FindExecutable( ...@@ -1626,11 +1626,11 @@ std::string cmCTestTestHandler::FindExecutable(
return fullPath; return fullPath;
} }
bool cmCTestTestHandler::ParseProcessesProperty( bool cmCTestTestHandler::ParseResourceGroupsProperty(
const std::string& val, 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); return lexer.ParseString(val);
} }
...@@ -2203,8 +2203,8 @@ bool cmCTestTestHandler::SetTestsProperties( ...@@ -2203,8 +2203,8 @@ bool cmCTestTestHandler::SetTestsProperties(
if (key == "PROCESSOR_AFFINITY") { if (key == "PROCESSOR_AFFINITY") {
rt.WantAffinity = cmIsOn(val); rt.WantAffinity = cmIsOn(val);
} }
if (key == "PROCESSES") { if (key == "RESOURCE_GROUPS") {
if (!ParseProcessesProperty(val, rt.Processes)) { if (!ParseResourceGroupsProperty(val, rt.ResourceGroups)) {
return false; return false;
} }
} }
......
...@@ -158,7 +158,7 @@ public: ...@@ -158,7 +158,7 @@ public:
std::set<std::string> FixturesCleanup; std::set<std::string> FixturesCleanup;
std::set<std::string> FixturesRequired; std::set<std::string> FixturesRequired;
std::set<std::string> RequireSuccessDepends; 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 // Private test generator properties used to track backtraces
cmListFileBacktrace Backtrace; cmListFileBacktrace Backtrace;
}; };
...@@ -202,9 +202,9 @@ public: ...@@ -202,9 +202,9 @@ public:
std::vector<std::string>& extraPaths, std::vector<std::string>& extraPaths,
std::vector<std::string>& failed); std::vector<std::string>& failed);
static bool ParseProcessesProperty( static bool ParseResourceGroupsProperty(
const std::string& val, const std::string& val,
std::vector<std::vector<cmCTestTestResourceRequirement>>& processes); std::vector<std::vector<cmCTestTestResourceRequirement>>& resourceGroups);
using ListOfTests = std::vector<cmCTestTestProperties>; using ListOfTests = std::vector<cmCTestTestProperties>;
......
...@@ -8,9 +8,9 @@ include_directories( ...@@ -8,9 +8,9 @@ include_directories(
set(CMakeLib_TESTS set(CMakeLib_TESTS
testArgumentParser.cxx testArgumentParser.cxx
testCTestBinPacker.cxx testCTestBinPacker.cxx
testCTestProcesses.cxx
testCTestHardwareAllocator.cxx testCTestHardwareAllocator.cxx
testCTestHardwareSpec.cxx testCTestHardwareSpec.cxx
testCTestResourceGroups.cxx
testGeneratedFileStream.cxx testGeneratedFileStream.cxx
testRST.cxx testRST.cxx
testRange.cxx testRange.cxx
......
...@@ -106,24 +106,25 @@ bool TestExpectedParseResult(const ExpectedParseResult& expected) ...@@ -106,24 +106,25 @@ bool TestExpectedParseResult(const ExpectedParseResult& expected)
std::vector<std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>> std::vector<std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>
result; result;
bool retval; bool retval;
if ((retval = cmCTestTestHandler::ParseProcessesProperty( if ((retval = cmCTestTestHandler::ParseResourceGroupsProperty(
expected.String, result)) != expected.ExpectedReturnValue) { expected.String, result)) != expected.ExpectedReturnValue) {
std::cout << "ParseProcessesProperty(\"" << expected.String std::cout << "ParseResourceGroupsProperty(\"" << expected.String
<< "\") returned " << retval << ", should be " << "\") returned " << retval << ", should be "
<< expected.ExpectedReturnValue << std::endl; << expected.ExpectedReturnValue << std::endl;
return false; return false;
} }
if (result != expected.ExpectedValue) { if (result != expected.ExpectedValue) {
std::cout << "ParseProcessesProperty(\"" << expected.String std::cout << "ParseResourceGroupsProperty(\"" << expected.String
<< "\") did not yield expected set of processes" << std::endl; << "\") did not yield expected set of resource groups"
<< std::endl;
return false; return false;
} }
return true; return true;
} }
int testCTestProcesses(int /*unused*/, char* /*unused*/ []) int testCTestResourceGroups(int /*unused*/, char* /*unused*/ [])
{ {
int retval = 0; int retval = 0;
......
...@@ -258,7 +258,7 @@ function(run_ShowOnly) ...@@ -258,7 +258,7 @@ function(run_ShowOnly)
add_test(ShowOnly \"${CMAKE_COMMAND}\" -E echo) add_test(ShowOnly \"${CMAKE_COMMAND}\" -E echo)
set_tests_properties(ShowOnly PROPERTIES set_tests_properties(ShowOnly PROPERTIES
WILL_FAIL true WILL_FAIL true
PROCESSES \"2,threads:2,gpus:4;gpus:2,threads:4\" RESOURCE_GROUPS \"2,threads:2,gpus:4;gpus:2,threads:4\"
REQUIRED_FILES RequiredFileDoesNotExist REQUIRED_FILES RequiredFileDoesNotExist
_BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\" _BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\"
) )
......