summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2019-07-24 14:56:05 (GMT)
committerBrad King <brad.king@kitware.com>2019-10-02 13:33:54 (GMT)
commitd1f100a41582fecc05c3e04a87c72de94b0e6316 (patch)
tree5bbe3c26c3e26af2a85ee18a42d83cfb1ce1b1dd /Source/CTest
parentb741ee820d9d5e81a7ec73bda5515465359782af (diff)
downloadCMake-d1f100a41582fecc05c3e04a87c72de94b0e6316.zip
CMake-d1f100a41582fecc05c3e04a87c72de94b0e6316.tar.gz
CMake-d1f100a41582fecc05c3e04a87c72de94b0e6316.tar.bz2
CTest: Add Json output for PROCESSES property
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index aee6d67..7e8d548 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -912,6 +912,28 @@ static Json::Value DumpTimeoutAfterMatch(
return timeoutAfterMatch;
}
+static Json::Value DumpProcessesToJsonArray(
+ const std::vector<
+ std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>&
+ processes)
+{
+ Json::Value jsonProcesses = Json::arrayValue;
+ for (auto const& it : processes) {
+ Json::Value jsonProcess = Json::objectValue;
+ Json::Value requirements = Json::arrayValue;
+ for (auto const& it2 : it) {
+ Json::Value res = Json::objectValue;
+ res[".type"] = it2.ResourceType;
+ // res[".units"] = it2.UnitsNeeded; // Intentionally commented out
+ res["slots"] = it2.SlotsNeeded;
+ requirements.append(res);
+ }
+ jsonProcess["requirements"] = requirements;
+ jsonProcesses.append(jsonProcess);
+ }
+ return jsonProcesses;
+}
+
static Json::Value DumpCTestProperty(std::string const& name,
Json::Value value)
{
@@ -983,6 +1005,10 @@ static Json::Value DumpCTestProperties(
"PASS_REGULAR_EXPRESSION",
DumpRegExToJsonArray(testProperties.RequiredRegularExpressions)));
}
+ if (!testProperties.Processes.empty()) {
+ properties.append(DumpCTestProperty(
+ "PROCESSES", DumpProcessesToJsonArray(testProperties.Processes)));
+ }
if (testProperties.WantAffinity) {
properties.append(
DumpCTestProperty("PROCESSOR_AFFINITY", testProperties.WantAffinity));