diff --git a/azure-pipelines/e2e-ports/ci-independent-regression/v1/regression/portfile.cmake b/azure-pipelines/e2e-ports/ci-independent-regression/v1/regression/portfile.cmake new file mode 100644 index 0000000000..065116c276 --- /dev/null +++ b/azure-pipelines/e2e-ports/ci-independent-regression/v1/regression/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/azure-pipelines/e2e-ports/ci-independent-regression/v1/regression/vcpkg.json b/azure-pipelines/e2e-ports/ci-independent-regression/v1/regression/vcpkg.json new file mode 100644 index 0000000000..ea1039fb59 --- /dev/null +++ b/azure-pipelines/e2e-ports/ci-independent-regression/v1/regression/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "regression", + "version": "1", + "dependencies": [ + { + "name": "feature-fails", + "features": [ + "fail" + ] + } + ] +} diff --git a/azure-pipelines/e2e-ports/ci-independent-regression/v2/regression/portfile.cmake b/azure-pipelines/e2e-ports/ci-independent-regression/v2/regression/portfile.cmake new file mode 100644 index 0000000000..065116c276 --- /dev/null +++ b/azure-pipelines/e2e-ports/ci-independent-regression/v2/regression/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/azure-pipelines/e2e-ports/ci-independent-regression/v2/regression/vcpkg.json b/azure-pipelines/e2e-ports/ci-independent-regression/v2/regression/vcpkg.json new file mode 100644 index 0000000000..33341a58eb --- /dev/null +++ b/azure-pipelines/e2e-ports/ci-independent-regression/v2/regression/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "regression", + "version": "2", + "dependencies": [ + { + "name": "feature-fails", + "features": [ + "fail" + ] + } + ] +} diff --git a/azure-pipelines/e2e-ports/ci/feature-fails/portfile.cmake b/azure-pipelines/e2e-ports/ci/feature-fails/portfile.cmake new file mode 100644 index 0000000000..e24b12f61b --- /dev/null +++ b/azure-pipelines/e2e-ports/ci/feature-fails/portfile.cmake @@ -0,0 +1,4 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) +if("fail" IN_LIST FEATURES) + message(FATAL_ERROR "Failing, triggered by feature 'fail'.") +endif() diff --git a/azure-pipelines/e2e-ports/ci/feature-fails/vcpkg.json b/azure-pipelines/e2e-ports/ci/feature-fails/vcpkg.json new file mode 100644 index 0000000000..1714f8cc76 --- /dev/null +++ b/azure-pipelines/e2e-ports/ci/feature-fails/vcpkg.json @@ -0,0 +1,9 @@ +{ + "name": "feature-fails", + "version": "1", + "features": { + "fail": { + "description": "fails to build" + } + } +} diff --git a/azure-pipelines/end-to-end-tests-dir/ci.ps1 b/azure-pipelines/end-to-end-tests-dir/ci.ps1 index 87ffc1a8df..bd86a95fa3 100644 --- a/azure-pipelines/end-to-end-tests-dir/ci.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/ci.ps1 @@ -17,8 +17,8 @@ if (-not ($Output.Contains("feature-not-sup:${Triplet}: *"))) { if (-not ($Output.Contains("feature-dep-missing:${Triplet}: *"))) { throw 'feature-dep-missing must be built because the broken feature is not selected.' } -if ($Output.Split("*").Length -ne 4) { - throw 'base-port should not be installed for the host' +if ($Output.Split("*: ").Length -ne 5) { + throw 'Exactly 4 ports should be installed' } if (-not ($ErrorOutput.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" @@ -80,6 +80,9 @@ Throw-IfFailed if (-not ($Output.Contains("base-port:${Triplet}: SUCCEEDED:"))) { throw 'base-port build must succeed' } +if (-not ($Output.Contains("feature-fails:${Triplet}: SUCCEEDED:"))) { + throw 'feature-fails[core] build must succeed' +} Remove-Item -Recurse -Force $installRoot -ErrorAction SilentlyContinue New-Item -ItemType Directory -Path $installRoot -Force | Out-Null $Output = Run-VcpkgAndCaptureOutput ci @commonArgs --x-builtin-ports-root="$PSScriptRoot/../e2e-ports/ci" --binarysource="clear;files,$ArchiveRoot" --parent-hashes="$TestingRoot/parent-hashes.json" @@ -87,3 +90,35 @@ Throw-IfFailed if ($Output.Contains("base-port:${Triplet}: SUCCEEDED:")) { throw 'base-port must not be rebuilt again' } + +# With parent-hashes, test detection of regressions of independent ports. +Remove-Item -Recurse -Force $installRoot -ErrorAction SilentlyContinue +New-Item -ItemType Directory -Path $installRoot -Force | Out-Null +Remove-Item -Recurse -Force $ArchiveRoot -ErrorAction SilentlyContinue +New-Item -ItemType Directory -Path $ArchiveRoot -Force | Out-Null +# A dry run in order to determine all parent hashes without failing, regression@1 +$Output = Run-VcpkgAndCaptureOutput ci --dry-run @commonArgs --x-builtin-ports-root="$PSScriptRoot/../e2e-ports/ci" --binarysource="clear;files,$ArchiveRoot" --output-hashes="$TestingRoot/parent-hashes.json" --overlay-ports="$PSScriptRoot/../e2e-ports/ci-independent-regression/v1" +Throw-IfFailed +Remove-Item -Recurse -Force $installRoot -ErrorAction SilentlyContinue +New-Item -ItemType Directory -Path $installRoot -Force | Out-Null +# Non-dry run with port regression@2 +$Output = Run-VcpkgAndCaptureOutput ci @commonArgs --x-builtin-ports-root="$PSScriptRoot/../e2e-ports/ci" --binarysource="clear;files,$ArchiveRoot" --parent-hashes="$TestingRoot/parent-hashes.json" --overlay-ports="$PSScriptRoot/../e2e-ports/ci-independent-regression/v2" +Throw-IfNotFailed +if ($Output.Contains("base-port:${Triplet}: SUCCEEDED:")) { + throw 'base-port must not be rebuilt again' +} +if (-not ($Output.Contains("feature-fails:${Triplet}: BUILD_FAILED:"))) { + throw 'feature-fails[fail] build must fail' +} +if (-not ($Output.Contains("regression:${Triplet}: CASCADED_DUE_TO_MISSING_DEPENDENCIES:"))) { + throw 'regression build must cascade' +} +# Non-dry run with port regression@2 +$Output = Run-VcpkgAndCaptureStdErr ci @commonArgs --x-builtin-ports-root="$PSScriptRoot/../e2e-ports/ci" --binarysource="clear;files,$ArchiveRoot" --parent-hashes="$TestingRoot/parent-hashes.json" --overlay-ports="$PSScriptRoot/../e2e-ports/ci-independent-regression/v2" +Throw-IfNotFailed +if (-not ($Output.Contains("REGRESSION: Independent feature-fails:${Triplet} failed with BUILD_FAILED."))) { + throw 'feature-fails[fail] build failure must be reported as independent regression' +} +if ($Output.Contains("REGRESSION: Independent regression:${Triplet} failed with BUILD_FAILED.")) { + throw 'regression (port) build failure must not be reported as independent regression' +} diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index c97635636b..722ab29cdc 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -173,6 +173,8 @@ namespace const std::map& known, View parent_hashes) { + // With parent hashes, ports are merely "auto selected" unless the abi hash changed. + auto const default_request_type = parent_hashes.empty() ? RequestType::USER_REQUESTED : RequestType::AUTO_SELECTED; std::set to_keep; for (auto it = action_plan.install_actions.rbegin(); it != action_plan.install_actions.rend(); ++it) { @@ -187,6 +189,10 @@ namespace to_keep.insert(it->spec); } } + else + { + it->request_type = default_request_type; + } if (Util::Sets::contains(to_keep, it->spec)) {