summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx5
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx2
-rw-r--r--Source/CTest/cmCTestTestHandler.h1
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py12
5 files changed, 21 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 34f9d43..4c39d6e 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -1166,6 +1166,11 @@ static Json::Value DumpCTestProperties(
properties.append(
DumpCTestProperty("WORKING_DIRECTORY", testProperties.Directory));
}
+ if (!testProperties.CustomProperties.empty()) {
+ for (auto const& it : testProperties.CustomProperties) {
+ properties.append(DumpCTestProperty(it.first, it.second));
+ }
+ }
return properties;
}
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 0a8d4b8..6fa46a5 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -2435,6 +2435,8 @@ bool cmCTestTestHandler::SetTestsProperties(
rt.TimeoutRegularExpressions.emplace_back(cr, cr);
}
}
+ } else {
+ rt.CustomProperties[key] = val;
}
}
}
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 84e6098..fb88ea0 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -145,6 +145,7 @@ public:
std::vector<std::pair<cmsys::RegularExpression, std::string>>
TimeoutRegularExpressions;
std::map<std::string, std::string> Measurements;
+ std::map<std::string, std::string> CustomProperties;
bool IsInBasedOnREOptions = true;
bool WillFail = false;
bool Disabled = false;
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index c09fff8..51648b5 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -391,6 +391,8 @@ function(run_ShowOnly)
RESOURCE_GROUPS \"2,threads:2,gpus:4;gpus:2,threads:4\"
REQUIRED_FILES RequiredFileDoesNotExist
_BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\"
+ USER_DEFINED_A \"User defined property A value\"
+ USER_DEFINED_B \"User defined property B value\"
)
add_test(ShowOnlyNotAvailable NOT_AVAILABLE)
")
diff --git a/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
index b818650..f9667ae 100644
--- a/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
+++ b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
@@ -144,13 +144,23 @@ def check_workingdir_property(p):
assert p["name"] == "WORKING_DIRECTORY"
assert p["value"].endswith("Tests/RunCMake/CTestCommandLine/ShowOnly")
+def check_defined_properties(p_list):
+ for property_id, p in zip(["A", "B"], p_list):
+ assert is_dict(p)
+ assert sorted(p.keys()) == ["name", "value"]
+ assert is_string(p["name"])
+ assert is_string(p["value"])
+ assert p["name"] == "USER_DEFINED_" + property_id
+ assert p["value"] == "User defined property " + property_id + " value"
+
def check_properties(p):
assert is_list(p)
- assert len(p) == 4
+ assert len(p) == 6
check_resource_groups_property(p[0])
check_reqfiles_property(p[1])
check_willfail_property(p[2])
check_workingdir_property(p[3])
+ check_defined_properties(p[4:5])
def check_tests(t):
assert is_list(t)