mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 14:50:10 -06:00
ctest: Show custom test properties in --show-only=json-v1
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -2435,6 +2435,8 @@ bool cmCTestTestHandler::SetTestsProperties(
|
||||
rt.TimeoutRegularExpressions.emplace_back(cr, cr);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rt.CustomProperties[key] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
")
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user