Ci: Detect not needed entries in ci.baseline.txt (#1111)

This commit is contained in:
autoantwort 2023-08-12 06:14:56 +02:00 коммит произвёл GitHub
Родитель 27eb1d47e4
Коммит 47a03cc552
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 59 добавлений и 24 удалений

Просмотреть файл

@ -0,0 +1,16 @@
not-sup-host-b:arm64-osx=fail
not-sup-host-b:x64-osx=fail
not-sup-host-b:x86-windows=fail
not-sup-host-b:x64-windows=fail
not-sup-host-b:arm64-windows=fail
not-sup-host-b:x64-linux=fail
not-sup-host-b:arm64-linux=fail
dep-on-feature-not-sup:arm64-osx=fail
dep-on-feature-not-sup:x64-osx=fail
dep-on-feature-not-sup:x86-windows=fail
dep-on-feature-not-sup:x64-windows=fail
dep-on-feature-not-sup:arm64-windows=fail
dep-on-feature-not-sup:x64-linux=fail
dep-on-feature-not-sup:arm64-linux=fail

Просмотреть файл

@ -1,7 +1,7 @@
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
# test skipped ports
$Output = Run-VcpkgAndCaptureOutput ci --dry-run --triplet=$Triplet --x-builtin-ports-root="$PSScriptRoot/../e2e-ports/ci" --binarysource=clear
$Output = Run-VcpkgAndCaptureOutput ci --dry-run --triplet=$Triplet --x-builtin-ports-root="$PSScriptRoot/../e2e-ports/ci" --binarysource=clear --ci-baseline="$PSScriptRoot/../e2e-assets/ci/ci.baseline.txt"
Throw-IfFailed
if (-not ($Output.Contains("dep-on-feature-not-sup:${Triplet}: cascade"))) {
throw 'dep-on-feature-not-sup must cascade because it depends on a features that is not supported'
@ -15,3 +15,9 @@ if (-not ($Output.Contains("feature-not-sup:${Triplet}: *"))) {
if ($Output.Split("*").Length -ne 3) {
throw 'base-port should not be installed for the host'
}
if (-not ($Output.Contains("REGRESSION: not-sup-host-b:${Triplet} is marked as fail but not supported for ${Triplet}."))) {
throw "feature-not-sup's baseline fail entry should result in a regression because the port is not supported"
}
if (-not ($Output.Contains("REGRESSION: dep-on-feature-not-sup:${Triplet} is marked as fail but one dependency is not supported for ${Triplet}."))) {
throw "feature-not-sup's baseline fail entry should result in a regression because the port is cascade for this triplet"
}

Просмотреть файл

@ -404,6 +404,14 @@ DECLARE_MESSAGE(CiBaselineRegressionHeader,
(),
"Printed before a series of CiBaselineRegression and/or CiBaselineUnexpectedPass messages.",
"REGRESSIONS:")
DECLARE_MESSAGE(CiBaselineUnexpectedFail,
(msg::spec, msg::triplet),
"",
"REGRESSION: {spec} is marked as fail but not supported for {triplet}.")
DECLARE_MESSAGE(CiBaselineUnexpectedFailCascade,
(msg::spec, msg::triplet),
"",
"REGRESSION: {spec} is marked as fail but one dependency is not supported for {triplet}.")
DECLARE_MESSAGE(CiBaselineUnexpectedPass,
(msg::spec, msg::path),
"",

Просмотреть файл

@ -262,6 +262,10 @@
"_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:",
"_CiBaselineRegressionHeader.comment": "Printed before a series of CiBaselineRegression and/or CiBaselineUnexpectedPass messages.",
"CiBaselineUnexpectedFail": "REGRESSION: {spec} is marked as fail but not supported for {triplet}.",
"_CiBaselineUnexpectedFail.comment": "An example of {spec} is zlib:x64-windows. An example of {triplet} is x64-windows.",
"CiBaselineUnexpectedFailCascade": "REGRESSION: {spec} is marked as fail but one dependency is not supported for {triplet}.",
"_CiBaselineUnexpectedFailCascade.comment": "An example of {spec} is zlib:x64-windows. An example of {triplet} is x64-windows.",
"CiBaselineUnexpectedPass": "PASSING, REMOVE FROM FAIL LIST: {spec} ({path}).",
"_CiBaselineUnexpectedPass.comment": "An example of {spec} is zlib:x64-windows. An example of {path} is /foo/bar.",
"ClearingContents": "Clearing contents of {path}",

Просмотреть файл

@ -143,13 +143,6 @@ namespace vcpkg::Commands::CI
return supports_expression.evaluate(context);
}
static bool supported_for_triplet(const CMakeVars::CMakeVarProvider& var_provider,
const InstallPlanAction* install_plan)
{
auto&& scfl = install_plan->source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO);
return supported_for_triplet(var_provider, *scfl.source_control_file, install_plan->spec);
}
static bool supported_for_triplet(const CMakeVars::CMakeVarProvider& var_provider,
const PortFileProvider& provider,
PackageSpec spec)
@ -194,7 +187,6 @@ namespace vcpkg::Commands::CI
static std::unique_ptr<UnknownCIPortsResults> compute_action_statuses(
ExclusionPredicate is_excluded,
const CMakeVars::CMakeVarProvider& var_provider,
const std::vector<CacheAvailability>& precheck_results,
const ActionPlan& action_plan)
{
@ -210,22 +202,12 @@ namespace vcpkg::Commands::CI
auto p = &action;
ret->abi_map.emplace(action.spec, action.abi_info.value_or_exit(VCPKG_LINE_INFO).package_abi);
ret->features.emplace(action.spec, action.feature_list);
if (is_excluded(p->spec))
{
ret->action_state_string.emplace_back("skip");
ret->known.emplace(p->spec, BuildResult::EXCLUDED);
will_fail.emplace(p->spec);
}
else if (!supported_for_triplet(var_provider, p))
{
// This treats unsupported ports as if they are excluded
// which means the ports dependent on it will be cascaded due to missing dependencies
// Should this be changed so instead it is a failure to depend on a unsupported port?
ret->action_state_string.emplace_back("n/a");
ret->known.emplace(p->spec, BuildResult::EXCLUDED);
will_fail.emplace(p->spec);
}
else if (Util::any_of(p->package_dependencies,
[&](const PackageSpec& spec) { return Util::Sets::contains(will_fail, spec); }))
{
@ -301,11 +283,13 @@ namespace vcpkg::Commands::CI
const std::map<PackageSpec, BuildResult>& known,
const CiBaselineData& cidata,
const std::string& ci_baseline_file_name,
const LocalizedString& not_supported_regressions,
bool allow_unexpected_passing)
{
bool has_error = false;
LocalizedString output = msg::format(msgCiBaselineRegressionHeader);
output.append_raw('\n');
output.append(not_supported_regressions);
for (auto&& r : results)
{
auto result = r.build_result.value_or_exit(VCPKG_LINE_INFO).code;
@ -434,9 +418,8 @@ namespace vcpkg::Commands::CI
auto action_plan = compute_full_plan(paths, provider, var_provider, all_default_full_specs, serialize_options);
auto binary_cache = BinaryCache::make(args, paths, stdout_sink).value_or_exit(VCPKG_LINE_INFO);
const auto precheck_results = binary_cache.precheck(action_plan.install_actions);
auto split_specs =
compute_action_statuses(ExclusionPredicate{&exclusions_map}, var_provider, precheck_results, action_plan);
auto split_specs = compute_action_statuses(ExclusionPredicate{&exclusions_map}, precheck_results, action_plan);
LocalizedString regressions;
{
std::string msg;
for (const auto& spec : all_default_full_specs)
@ -447,6 +430,15 @@ namespace vcpkg::Commands::CI
split_specs->known.emplace(spec.package_spec,
supp ? BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES
: BuildResult::EXCLUDED);
if (cidata.expected_failures.contains(spec.package_spec))
{
regressions
.append(supp ? msgCiBaselineUnexpectedFailCascade : msgCiBaselineUnexpectedFail,
msg::spec = spec.package_spec,
msg::triplet = spec.package_spec.triplet())
.append_raw('\n');
}
msg += fmt::format("{:>40}: {:>8}\n", spec.package_spec, supp ? "cascade" : "skip");
}
}
@ -503,6 +495,11 @@ namespace vcpkg::Commands::CI
if (is_dry_run)
{
print_plan(action_plan, true, paths.builtin_ports_directory());
if (!regressions.empty())
{
msg::println(Color::error, msgCiBaselineRegressionHeader);
msg::print(Color::error, regressions);
}
}
else
{
@ -526,8 +523,12 @@ namespace vcpkg::Commands::CI
msg::write_unlocalized_text_to_stdout(Color::none, fmt::format("\nTriplet: {}\n", target_triplet));
summary.print();
print_regressions(
summary.results, split_specs->known, cidata, baseline_iter->second, allow_unexpected_passing);
print_regressions(summary.results,
split_specs->known,
cidata,
baseline_iter->second,
regressions,
allow_unexpected_passing);
auto it_xunit = settings.find(OPTION_XUNIT);
if (it_xunit != settings.end())