mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 12:17:05 +08:00
[CI system] Add features to test result xml (#8342)
* Add features to test result xml
This commit is contained in:
parent
ad49c27d4e
commit
2f4cb2d5be
@ -60,9 +60,10 @@ namespace vcpkg::Commands::CI
|
|||||||
void add_test_results(const std::string& spec,
|
void add_test_results(const std::string& spec,
|
||||||
const Build::BuildResult& build_result,
|
const Build::BuildResult& build_result,
|
||||||
const Chrono::ElapsedTime& elapsed_time,
|
const Chrono::ElapsedTime& elapsed_time,
|
||||||
const std::string& abi_tag)
|
const std::string& abi_tag,
|
||||||
|
const std::vector<std::string>& features)
|
||||||
{
|
{
|
||||||
m_collections.back().tests.push_back({spec, build_result, elapsed_time, abi_tag});
|
m_collections.back().tests.push_back({spec, build_result, elapsed_time, abi_tag, features});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Starting a new test collection
|
// Starting a new test collection
|
||||||
@ -98,6 +99,7 @@ namespace vcpkg::Commands::CI
|
|||||||
vcpkg::Build::BuildResult result;
|
vcpkg::Build::BuildResult result;
|
||||||
vcpkg::Chrono::ElapsedTime time;
|
vcpkg::Chrono::ElapsedTime time;
|
||||||
std::string abi_tag;
|
std::string abi_tag;
|
||||||
|
std::vector<std::string> features;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct XunitCollection
|
struct XunitCollection
|
||||||
@ -166,9 +168,29 @@ namespace vcpkg::Commands::CI
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string traits_block;
|
std::string traits_block;
|
||||||
if (test.abi_tag != "") // only adding if there is a known abi tag
|
if (test.abi_tag != "")
|
||||||
{
|
{
|
||||||
traits_block = Strings::format(R"(<traits><trait name="abi_tag" value="%s" /></traits>)", test.abi_tag);
|
traits_block += Strings::format(R"(<trait name="abi_tag" value="%s" />)", test.abi_tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!test.features.empty())
|
||||||
|
{
|
||||||
|
std::string feature_list;
|
||||||
|
for (const auto& feature : test.features)
|
||||||
|
{
|
||||||
|
if (!feature_list.empty())
|
||||||
|
{
|
||||||
|
feature_list += ", ";
|
||||||
|
}
|
||||||
|
feature_list += feature;
|
||||||
|
}
|
||||||
|
|
||||||
|
traits_block += Strings::format(R"(<trait name="features" value="%s" />)", feature_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!traits_block.empty())
|
||||||
|
{
|
||||||
|
traits_block = "<traits>" + traits_block + "</traits>";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_xml += Strings::format(R"( <test name="%s" method="%s" time="%lld" result="%s">%s%s</test>)"
|
m_xml += Strings::format(R"( <test name="%s" method="%s" time="%lld" result="%s">%s%s</test>)"
|
||||||
@ -458,20 +480,24 @@ namespace vcpkg::Commands::CI
|
|||||||
// Adding results for ports that were built or pulled from an archive
|
// Adding results for ports that were built or pulled from an archive
|
||||||
for (auto&& result : summary.results)
|
for (auto&& result : summary.results)
|
||||||
{
|
{
|
||||||
|
auto& port_features = split_specs->features[result.spec];
|
||||||
split_specs->known.erase(result.spec);
|
split_specs->known.erase(result.spec);
|
||||||
xunitTestResults.add_test_results(result.spec.to_string(),
|
xunitTestResults.add_test_results(result.spec.to_string(),
|
||||||
result.build_result.code,
|
result.build_result.code,
|
||||||
result.timing,
|
result.timing,
|
||||||
split_specs->abi_tag_map.at(result.spec));
|
split_specs->abi_tag_map.at(result.spec),
|
||||||
|
port_features);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adding results for ports that were not built because they have known states
|
// Adding results for ports that were not built because they have known states
|
||||||
for (auto&& port : split_specs->known)
|
for (auto&& port : split_specs->known)
|
||||||
{
|
{
|
||||||
|
auto& port_features = split_specs->features[port.first];
|
||||||
xunitTestResults.add_test_results(port.first.to_string(),
|
xunitTestResults.add_test_results(port.first.to_string(),
|
||||||
port.second,
|
port.second,
|
||||||
Chrono::ElapsedTime{},
|
Chrono::ElapsedTime{},
|
||||||
split_specs->abi_tag_map.at(port.first));
|
split_specs->abi_tag_map.at(port.first),
|
||||||
|
port_features);
|
||||||
}
|
}
|
||||||
|
|
||||||
all_known_results.emplace_back(std::move(split_specs->known));
|
all_known_results.emplace_back(std::move(split_specs->known));
|
||||||
|
Loading…
Reference in New Issue
Block a user