Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/vcpkg/base/message-data.inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ DECLARE_MESSAGE(CiBaselineDisallowedCascade,
(msg::spec, msg::path),
"",
"REGRESSION: {spec} cascaded, but it is required to pass. ({path}).")
DECLARE_MESSAGE(CiBaselineIndependentRegression,
(msg::spec, msg::build_result),
"",
"REGRESSION: Independent {spec} failed with {build_result}.")
DECLARE_MESSAGE(CiBaselineRegression,
(msg::spec, msg::build_result, msg::path),
"",
Expand Down
3 changes: 2 additions & 1 deletion include/vcpkg/ci-baseline.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ namespace vcpkg
BuildResult result,
const CiBaselineData& cidata,
StringView cifile,
bool allow_unexpected_passing);
bool allow_unexpected_passing,
bool is_independent);
}
2 changes: 2 additions & 0 deletions locales/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@
"CiBaselineAllowUnexpectedPassingRequiresBaseline": "--allow-unexpected-passing can only be used if a baseline is provided via --ci-baseline.",
"CiBaselineDisallowedCascade": "REGRESSION: {spec} cascaded, but it is required to pass. ({path}).",
"_CiBaselineDisallowedCascade.comment": "An example of {spec} is zlib:x64-windows. An example of {path} is /foo/bar.",
"CiBaselineIndependentRegression": "REGRESSION: Independent {spec} failed with {build_result}.",
"_CiBaselineIndependentRegression.comment": "An example of {spec} is zlib:x64-windows. An example of {build_result} is One of the BuildResultXxx messages (such as BuildResultSucceeded/SUCCEEDED).",
"CiBaselineRegression": "REGRESSION: {spec} failed with {build_result}. If expected, add {spec}=fail to {path}.",
"_CiBaselineRegression.comment": "An example of {spec} is zlib:x64-windows. An example of {build_result} is One of the BuildResultXxx messages (such as BuildResultSucceeded/SUCCEEDED). An example of {path} is /foo/bar.",
"CiBaselineRegressionHeader": "REGRESSIONS:",
Expand Down
7 changes: 4 additions & 3 deletions src/vcpkg-test/ci-baseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ TEST_CASE ("format_ci_result 1", "[ci-baseline]")
SECTION ("SUCCEEDED")
{
const auto test = [&](PackageSpec s, bool allow_unexpected_passing) {
return format_ci_result(s, BuildResult::SUCCEEDED, cidata, "cifile", allow_unexpected_passing);
return format_ci_result(s, BuildResult::SUCCEEDED, cidata, "cifile", allow_unexpected_passing, false);
};
CHECK(test({"pass", Test::X64_UWP}, true) == "");
CHECK(test({"pass", Test::X64_UWP}, false) == "");
Expand All @@ -352,7 +352,7 @@ TEST_CASE ("format_ci_result 1", "[ci-baseline]")
SECTION ("BUILD_FAILED")
{
const auto test = [&](PackageSpec s) {
return format_ci_result(s, BuildResult::BUILD_FAILED, cidata, "cifile", false);
return format_ci_result(s, BuildResult::BUILD_FAILED, cidata, "cifile", false, false);
};
CHECK(test({"pass", Test::X64_UWP}) == fmt::format(failmsg, "pass:x64-uwp"));
CHECK(test({"fail", Test::X64_UWP}) == "");
Expand All @@ -362,7 +362,8 @@ TEST_CASE ("format_ci_result 1", "[ci-baseline]")
SECTION ("CASCADED_DUE_TO_MISSING_DEPENDENCIES")
{
const auto test = [&](PackageSpec s) {
return format_ci_result(s, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES, cidata, "cifile", false);
return format_ci_result(
s, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES, cidata, "cifile", false, false);
};
CHECK(test({"pass", Test::X64_UWP}) == fmt::format(cascademsg, "pass:x64-uwp"));
CHECK(test({"fail", Test::X64_UWP}) == "");
Expand Down
20 changes: 15 additions & 5 deletions src/vcpkg/ci-baseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ namespace vcpkg
BuildResult result,
const CiBaselineData& cidata,
StringView cifile,
bool allow_unexpected_passing)
bool allow_unexpected_passing,
bool is_independent)
{
switch (result)
{
Expand All @@ -213,10 +214,19 @@ namespace vcpkg
case BuildResult::FILE_CONFLICTS:
if (!cidata.expected_failures.contains(spec))
{
return msg::format(msgCiBaselineRegression,
msg::spec = spec,
msg::build_result = to_string_locale_invariant(result),
msg::path = cifile);
if (is_independent)
{
return msg::format(msgCiBaselineIndependentRegression,
msg::spec = spec,
msg::build_result = to_string_locale_invariant(result));
}
else
{
return msg::format(msgCiBaselineRegression,
msg::spec = spec,
msg::build_result = to_string_locale_invariant(result),
msg::path = cifile);
}
}
break;
case BuildResult::SUCCEEDED:
Expand Down
36 changes: 21 additions & 15 deletions src/vcpkg/commands.ci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,13 @@ namespace vcpkg::Commands::CI
auto it_known = known.find(it->spec);
const auto& abi = it->abi_info.value_or_exit(VCPKG_LINE_INFO).package_abi;
auto it_parent = std::find(parent_hashes.begin(), parent_hashes.end(), abi);
if (it_known == known.end() && it_parent == parent_hashes.end())
if (it_parent == parent_hashes.end())
{
to_keep.insert(it->spec);
it->request_type = RequestType::USER_REQUESTED;
if (it_known == known.end())
{
to_keep.insert(it->spec);
}
}

if (Util::Sets::contains(to_keep, it->spec))
Expand Down Expand Up @@ -292,19 +296,24 @@ namespace vcpkg::Commands::CI
: SortedVector<std::string>(Strings::split(it_exclusions->second, ',')));
}

static void print_baseline_regressions(const std::vector<SpecSummary>& results,
const std::map<PackageSpec, BuildResult>& known,
const CiBaselineData& cidata,
const std::string& ci_baseline_file_name,
bool allow_unexpected_passing)
static void print_regressions(const std::vector<SpecSummary>& results,
const std::map<PackageSpec, BuildResult>& known,
const CiBaselineData& cidata,
const std::string& ci_baseline_file_name,
bool allow_unexpected_passing)
{
bool has_error = false;
LocalizedString output = msg::format(msgCiBaselineRegressionHeader);
output.append_raw('\n');
for (auto&& r : results)
{
auto result = r.build_result.value_or_exit(VCPKG_LINE_INFO).code;
auto msg = format_ci_result(r.get_spec(), result, cidata, ci_baseline_file_name, allow_unexpected_passing);
auto msg = format_ci_result(r.get_spec(),
result,
cidata,
ci_baseline_file_name,
allow_unexpected_passing,
!r.is_user_requested_install());
if (!msg.empty())
{
has_error = true;
Expand All @@ -313,7 +322,8 @@ namespace vcpkg::Commands::CI
}
for (auto&& r : known)
{
auto msg = format_ci_result(r.first, r.second, cidata, ci_baseline_file_name, allow_unexpected_passing);
auto msg =
format_ci_result(r.first, r.second, cidata, ci_baseline_file_name, allow_unexpected_passing, true);
if (!msg.empty())
{
has_error = true;
Expand Down Expand Up @@ -509,12 +519,8 @@ namespace vcpkg::Commands::CI

msg::write_unlocalized_text_to_stdout(Color::none, fmt::format("\nTriplet: {}\n", target_triplet));
summary.print();

if (baseline_iter != settings.end())
{
print_baseline_regressions(
summary.results, split_specs->known, cidata, baseline_iter->second, allow_unexpected_passing);
}
print_regressions(
summary.results, split_specs->known, cidata, baseline_iter->second, allow_unexpected_passing);

auto it_xunit = settings.find(OPTION_XUNIT);
if (it_xunit != settings.end())
Expand Down