diff --git a/include/vcpkg/base/message-data.inc.h b/include/vcpkg/base/message-data.inc.h index 30e517e647..fe6ee34577 100644 --- a/include/vcpkg/base/message-data.inc.h +++ b/include/vcpkg/base/message-data.inc.h @@ -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), "", diff --git a/include/vcpkg/ci-baseline.h b/include/vcpkg/ci-baseline.h index 2b5ab2c931..d6e7cd3a46 100644 --- a/include/vcpkg/ci-baseline.h +++ b/include/vcpkg/ci-baseline.h @@ -69,5 +69,6 @@ namespace vcpkg BuildResult result, const CiBaselineData& cidata, StringView cifile, - bool allow_unexpected_passing); + bool allow_unexpected_passing, + bool is_independent); } diff --git a/locales/messages.json b/locales/messages.json index e27bbb3858..e805dc6bff 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -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:", diff --git a/src/vcpkg-test/ci-baseline.cpp b/src/vcpkg-test/ci-baseline.cpp index ea4db19ac9..cc9f3d7dac 100644 --- a/src/vcpkg-test/ci-baseline.cpp +++ b/src/vcpkg-test/ci-baseline.cpp @@ -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) == ""); @@ -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}) == ""); @@ -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}) == ""); diff --git a/src/vcpkg/ci-baseline.cpp b/src/vcpkg/ci-baseline.cpp index 324e91d2d1..40fba32acc 100644 --- a/src/vcpkg/ci-baseline.cpp +++ b/src/vcpkg/ci-baseline.cpp @@ -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) { @@ -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: diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index d79298c3ea..bfaeae14f0 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -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)) @@ -292,11 +296,11 @@ namespace vcpkg::Commands::CI : SortedVector(Strings::split(it_exclusions->second, ','))); } - static void print_baseline_regressions(const std::vector& results, - const std::map& known, - const CiBaselineData& cidata, - const std::string& ci_baseline_file_name, - bool allow_unexpected_passing) + static void print_regressions(const std::vector& results, + const std::map& known, + const CiBaselineData& cidata, + const std::string& ci_baseline_file_name, + bool allow_unexpected_passing) { bool has_error = false; LocalizedString output = msg::format(msgCiBaselineRegressionHeader); @@ -304,7 +308,12 @@ namespace vcpkg::Commands::CI 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; @@ -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; @@ -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())