Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ce00d41
Add a test for not removing features from skipped ports, see related …
BillyONeal Oct 21, 2025
ddf8c35
Extract calculate_ci_requested_specs function and fix the bug.
BillyONeal Oct 21, 2025
39579e5
Added test sanity check.
BillyONeal Oct 21, 2025
d2e5ab3
Merge remote-tracking branch 'origin/main' into ci-skip-baseline-feat…
BillyONeal Oct 23, 2025
13fa6bc
Eliminate ExclusionsPredicate and extract RandomizerInstance.
BillyONeal Oct 23, 2025
7da5f07
Deoptionalize package_abi()
BillyONeal Oct 23, 2025
83286ec
fixup ci randomizer
BillyONeal Oct 24, 2025
ef28223
Simplify exclusionmap slightly, also record intentionally excluded sp…
BillyONeal Oct 24, 2025
1177c7d
wip
BillyONeal Oct 24, 2025
f39e414
Update src/vcpkg/commands.ci.cpp
BillyONeal Oct 30, 2025
afe1b14
Apply suggestion from @ras0219-msft
BillyONeal Oct 30, 2025
babd750
Another @ras0219-msft suggestion
BillyONeal Oct 30, 2025
aaa0ea7
wip
BillyONeal Oct 31, 2025
848b828
wip
BillyONeal Nov 1, 2025
fa9941a
wip
BillyONeal Nov 4, 2025
63aa137
Merge remote-tracking branch 'origin/main' into ci-skip-baseline-feat…
BillyONeal Nov 4, 2025
ec5581a
Merge remote-tracking branch 'origin/main' into ci-skip-baseline-feat…
BillyONeal Nov 4, 2025
5fa7e82
WIP every report mechanism working except msgCiBaselineUnexpectedFail…
BillyONeal Nov 5, 2025
502ea32
Merge remote-tracking branch 'origin/main' into ci-skip-baseline-feat…
BillyONeal Nov 5, 2025
52c149c
Fix remaining test failures, remove "all results" from the report at …
BillyONeal Nov 6, 2025
f3befa5
Test fixes. Note that CiBaselineUnexpectedPassCascade is deleted and …
BillyONeal Nov 6, 2025
4ca3651
Use Throw-IfNonContains and add assertions for counts
BillyONeal Nov 10, 2025
20ea65c
Merge remote-tracking branch 'origin/main' into ci-skip-baseline-feat…
BillyONeal Nov 10, 2025
788d96d
Add xunit test.
BillyONeal Nov 10, 2025
29ca402
Code review feedback from @ras0219-msft
BillyONeal Nov 12, 2025
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
5 changes: 5 additions & 0 deletions azure-pipelines/e2e-assets/ci-skipped-features/baseline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
skipped-depends:arm64-osx=skip
skipped-depends:x64-linux=skip
skipped-depends:x64-osx=skip
skipped-depends:x64-windows=skip
skipped-depends:x86-windows=skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
message(FATAL_ERROR "This port is skipped and should not be attempted.")
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "skipped-depends",
"version": "1.0.0",
"dependencies": [
{
"name": "skipped-features",
"default-features": false,
"features": [
"fail-if-included"
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
if ("fail-if-included" IN_LIST FEATURES)
message(FATAL_ERROR "The feature 'fail-if-included' should not be included.")
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "skipped-features",
"version": "1.0.0",
"features": {
"fail-if-included": {
"description": "This feature should cause a failure if it is included in the build."
}
}
}
13 changes: 12 additions & 1 deletion azure-pipelines/end-to-end-tests-dir/ci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ if (-not ($Output.Contains("vcpkg.json:3:17: error: Trailing comma"))) {
Remove-Problem-Matchers
$emptyDir = "$TestingRoot/empty"
New-Item -ItemType Directory -Path $emptyDir -Force | Out-Null
$Output = Run-VcpkgAndCaptureOutput ci --triplet=$Triplet --x-builtin-ports-root="$emptyDir" --binarysource=clear --overlay-ports="$PSScriptRoot/../e2e-ports/duplicate-file-a" --overlay-ports="$PSScriptRoot/../e2e-ports/duplicate-file-b"
$Output = Run-VcpkgAndCaptureOutput ci @commonArgs --x-builtin-ports-root="$emptyDir" --binarysource=clear --overlay-ports="$PSScriptRoot/../e2e-ports/duplicate-file-a" --overlay-ports="$PSScriptRoot/../e2e-ports/duplicate-file-b"
Throw-IfNotFailed
Restore-Problem-Matchers

# test that features included only by skipped ports are not included
Remove-Problem-Matchers
Refresh-TestRoot
$Output = Run-VcpkgAndCaptureOutput ci @commonArgs --x-builtin-ports-root="$PSScriptRoot/../e2e-assets/ci-skipped-features" --binarysource=clear --ci-baseline="$PSScriptRoot/../e2e-assets/ci-skipped-features/baseline.txt"
Throw-IfFailed
if (-not ($Output -match 'skipped-features:[^:]+: \*' -and $Output -match 'Building skipped-features:[^@][email protected]...')) {
throw 'did not attempt to build skipped-features'
}

Restore-Problem-Matchers
1 change: 1 addition & 0 deletions include/vcpkg/base/checks.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace vcpkg::Checks
}

// If expression is false, call exit_fail.
VCPKG_SAL_ANNOTATION(_Post_satisfies_(_Old_(expression)))
void check_exit(const LineInfo& line_info, bool expression);

// if expression is false, call exit_with_message.
Expand Down
9 changes: 1 addition & 8 deletions include/vcpkg/ci-baseline.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,8 @@ namespace vcpkg
{
std::vector<TripletExclusions> triplets;

void insert(Triplet triplet);
void insert(Triplet triplet, SortedVector<std::string>&& exclusions);
};

struct ExclusionPredicate
{
const ExclusionsMap* data;

bool operator()(const PackageSpec& spec) const;
bool is_excluded(const PackageSpec& spec) const;
};

std::vector<CiBaselineLine> parse_ci_baseline(StringView text, StringView origin, ParseMessages& messages);
Expand Down
19 changes: 17 additions & 2 deletions include/vcpkg/commands.install.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,24 @@ namespace vcpkg

const BinaryParagraph* get_binary_paragraph() const;
const PackageSpec& get_spec() const { return m_spec; }
Optional<const std::string&> get_abi() const
const std::string* package_abi() const
{
return m_install_action ? m_install_action->package_abi() : nullopt;
if (m_install_action)
{
return m_install_action->package_abi();
}

return nullptr;
}
const std::string& package_abi_or_exit(LineInfo li) const
{
auto pabi = package_abi();
if (!pabi)
{
Checks::unreachable(li);
}

return *pabi;
}
bool is_user_requested_install() const;
Optional<ExtendedBuildResult> build_result;
Expand Down
3 changes: 2 additions & 1 deletion include/vcpkg/dependencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ namespace vcpkg

const std::string& public_abi() const;
bool has_package_abi() const;
Optional<const std::string&> package_abi() const;
const std::string* package_abi() const;
const std::string& package_abi_or_exit(LineInfo li) const;
const PreBuildInfo& pre_build_info(LineInfo li) const;
Version version() const;
std::string display_name() const;
Expand Down
1 change: 0 additions & 1 deletion include/vcpkg/fwd/ci-baseline.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace vcpkg
struct CiBaselineLine;
struct TripletExclusions;
struct ExclusionsMap;
struct ExclusionPredicate;

enum class CiBaselineState
{
Expand Down
4 changes: 2 additions & 2 deletions src/vcpkg-test/ci-baseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ bill-made-up-another-skip:x64-linux=skip)"; // note no trailing newline
SECTION ("Applies Skips and Fails")
{
ExclusionsMap exclusions;
exclusions.insert(x64_uwp); // example triplet
exclusions.insert(x64_linux); // example host triplet
exclusions.insert(x64_uwp, {}); // example triplet
exclusions.insert(x64_linux, {}); // example host triplet
auto actual = parse_and_apply_ci_baseline(expected_from_example_input, exclusions, SkipFailures::No);
const SortedVector<PackageSpec> expected_expected_failures{
PackageSpec{"aubio", x64_uwp},
Expand Down
1 change: 1 addition & 0 deletions src/vcpkg/base/checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ namespace vcpkg
exit_fail(line_info);
}

VCPKG_SAL_ANNOTATION(_Post_satisfies_(_Old_(expression)))
void Checks::check_exit(const LineInfo& line_info, bool expression)
{
if (!expression)
Expand Down
31 changes: 16 additions & 15 deletions src/vcpkg/binarycaching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ namespace
{
for (size_t i = 0; i < actions.size(); ++i)
{
const auto& abi_tag = actions[i]->package_abi().value_or_exit(VCPKG_LINE_INFO);
const auto& abi_tag = actions[i]->package_abi_or_exit(VCPKG_LINE_INFO);
auto archive_path = m_dir / files_archive_subpath(abi_tag);
if (m_fs.exists(archive_path, IgnoreErrors{}))
{
Expand All @@ -440,7 +440,7 @@ namespace
for (size_t idx = 0; idx < actions.size(); ++idx)
{
const auto& action = *actions[idx];
const auto& abi_tag = action.package_abi().value_or_exit(VCPKG_LINE_INFO);
const auto& abi_tag = action.package_abi_or_exit(VCPKG_LINE_INFO);

bool any_available = false;
if (m_fs.exists(m_dir / files_archive_subpath(abi_tag), IgnoreErrors{}))
Expand Down Expand Up @@ -1008,7 +1008,7 @@ namespace
for (size_t idx = 0; idx < actions.size(); ++idx)
{
auto&& action = *actions[idx];
const auto& abi = action.package_abi().value_or_exit(VCPKG_LINE_INFO);
const auto& abi = action.package_abi_or_exit(VCPKG_LINE_INFO);
auto tmp = make_temp_archive_path(m_buildtrees, action.spec, abi);
auto res = m_tool->download_file(make_object_path(m_prefix, abi), tmp);
if (auto cache_result = res.get())
Expand All @@ -1030,7 +1030,7 @@ namespace
for (size_t idx = 0; idx < actions.size(); ++idx)
{
auto&& action = *actions[idx];
const auto& abi = action.package_abi().value_or_exit(VCPKG_LINE_INFO);
const auto& abi = action.package_abi_or_exit(VCPKG_LINE_INFO);
auto maybe_res = m_tool->stat(make_object_path(m_prefix, abi));
if (auto res = maybe_res.get())
{
Expand Down Expand Up @@ -1166,7 +1166,7 @@ namespace
for (size_t idx = 0; idx < actions.size(); ++idx)
{
auto&& action = *actions[idx];
const auto& abi = action.package_abi().value_or_exit(VCPKG_LINE_INFO);
const auto& abi = action.package_abi_or_exit(VCPKG_LINE_INFO);
abis.push_back(abi);
abi_index_map[abi] = idx;
}
Expand Down Expand Up @@ -1225,7 +1225,7 @@ namespace
for (size_t idx = 0; idx < actions.size(); ++idx)
{
auto&& action = *actions[idx];
const auto& abi = action.package_abi().value_or_exit(VCPKG_LINE_INFO);
const auto& abi = action.package_abi_or_exit(VCPKG_LINE_INFO);
cache_status[idx] =
Util::contains(abis, abi) ? CacheAvailability::available : CacheAvailability::unavailable;
}
Expand Down Expand Up @@ -2406,7 +2406,7 @@ namespace vcpkg
statuses.clear();
for (size_t i = 0; i < actions.size(); ++i)
{
if (auto abi = actions[i].package_abi().get())
if (auto abi = actions[i].package_abi())
{
CacheStatus& status = m_status[*abi];
if (status.should_attempt_restore(provider.get()))
Expand Down Expand Up @@ -2441,7 +2441,7 @@ namespace vcpkg

bool ReadOnlyBinaryCache::is_restored(const InstallPlanAction& action) const
{
if (auto abi = action.package_abi().get())
if (auto abi = action.package_abi())
{
auto it = m_status.find(*abi);
if (it != m_status.end()) return it->second.is_restored();
Expand All @@ -2464,10 +2464,11 @@ namespace vcpkg

std::vector<CacheAvailability> ReadOnlyBinaryCache::precheck(View<const InstallPlanAction*> actions)
{
std::vector<CacheStatus*> statuses = Util::fmap(actions, [this](const auto& action) {
Checks::check_exit(VCPKG_LINE_INFO, action && action->package_abi());
ASSUME(action);
return &m_status[*action->package_abi().get()];
std::vector<CacheStatus*> statuses = Util::fmap(actions, [this](const InstallPlanAction* action) {
Checks::check_exit(VCPKG_LINE_INFO, action);
auto pabi = action->package_abi();
Checks::check_exit(VCPKG_LINE_INFO, pabi);
return &m_status[*pabi];
});

std::vector<const InstallPlanAction*> action_ptrs;
Expand All @@ -2493,7 +2494,7 @@ namespace vcpkg

for (size_t i = 0; i < action_ptrs.size(); ++i)
{
auto&& this_status = m_status[*action_ptrs[i]->package_abi().get()];
auto&& this_status = m_status[action_ptrs[i]->package_abi_or_exit(VCPKG_LINE_INFO)];
if (cache_result[i] == CacheAvailability::available)
{
this_status.mark_available(provider.get());
Expand Down Expand Up @@ -2793,7 +2794,7 @@ namespace vcpkg

void BinaryCache::push_success(CleanPackages clean_packages, const InstallPlanAction& action)
{
if (auto abi = action.package_abi().get())
if (auto abi = action.package_abi())
{
bool restored;
auto it = m_status.find(*abi);
Expand Down Expand Up @@ -3000,7 +3001,7 @@ namespace vcpkg
}

BinaryPackageReadInfo::BinaryPackageReadInfo(const InstallPlanAction& action)
: package_abi(action.package_abi().value_or_exit(VCPKG_LINE_INFO))
: package_abi(action.package_abi_or_exit(VCPKG_LINE_INFO))
, spec(action.spec)
, display_name(action.display_name())
, version(action.version())
Expand Down
17 changes: 2 additions & 15 deletions src/vcpkg/ci-baseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ namespace vcpkg
{
}

void ExclusionsMap::insert(Triplet triplet)
{
for (auto& triplet_exclusions : triplets)
{
if (triplet_exclusions.triplet == triplet)
{
return;
}
}

triplets.emplace_back(triplet);
}

void ExclusionsMap::insert(Triplet triplet, SortedVector<std::string>&& exclusions)
{
for (auto& triplet_exclusions : triplets)
Expand All @@ -43,9 +30,9 @@ namespace vcpkg
triplets.emplace_back(triplet, std::move(exclusions));
}

bool ExclusionPredicate::operator()(const PackageSpec& spec) const
bool ExclusionsMap::is_excluded(const PackageSpec& spec) const
{
for (const auto& triplet_exclusions : data->triplets)
for (const auto& triplet_exclusions : triplets)
{
if (triplet_exclusions.triplet == spec.triplet())
{
Expand Down
Loading
Loading