diff --git a/azure-pipelines/e2e-assets/ci-skipped-ports/always-built/portfile.cmake b/azure-pipelines/e2e-assets/ci-skipped-ports/always-built/portfile.cmake new file mode 100644 index 0000000000..065116c276 --- /dev/null +++ b/azure-pipelines/e2e-assets/ci-skipped-ports/always-built/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/azure-pipelines/e2e-assets/ci-skipped-ports/always-built/vcpkg.json b/azure-pipelines/e2e-assets/ci-skipped-ports/always-built/vcpkg.json new file mode 100644 index 0000000000..a8d6124d05 --- /dev/null +++ b/azure-pipelines/e2e-assets/ci-skipped-ports/always-built/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "always-built", + "version": "1.0.0" +} diff --git a/azure-pipelines/e2e-assets/ci-skipped-ports/always-cascade/portfile.cmake b/azure-pipelines/e2e-assets/ci-skipped-ports/always-cascade/portfile.cmake new file mode 100644 index 0000000000..5b496536eb --- /dev/null +++ b/azure-pipelines/e2e-assets/ci-skipped-ports/always-cascade/portfile.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This port should always cascade and should not be attempted.") diff --git a/azure-pipelines/e2e-assets/ci-skipped-ports/always-cascade/vcpkg.json b/azure-pipelines/e2e-assets/ci-skipped-ports/always-cascade/vcpkg.json new file mode 100644 index 0000000000..63e37606f6 --- /dev/null +++ b/azure-pipelines/e2e-assets/ci-skipped-ports/always-cascade/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "always-cascade", + "version": "1.0.0", + "dependencies": [ + "always-skip" + ] +} diff --git a/azure-pipelines/e2e-assets/ci-skipped-ports/always-skip/portfile.cmake b/azure-pipelines/e2e-assets/ci-skipped-ports/always-skip/portfile.cmake new file mode 100644 index 0000000000..934efc9642 --- /dev/null +++ b/azure-pipelines/e2e-assets/ci-skipped-ports/always-skip/portfile.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This port should always be skipped by baseline.txt and should not be attempted.") diff --git a/azure-pipelines/e2e-assets/ci-skipped-ports/always-skip/vcpkg.json b/azure-pipelines/e2e-assets/ci-skipped-ports/always-skip/vcpkg.json new file mode 100644 index 0000000000..9c420d0e7b --- /dev/null +++ b/azure-pipelines/e2e-assets/ci-skipped-ports/always-skip/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "always-skip", + "version": "1.0.0", + "dependencies": [ + "always-built" + ] +} diff --git a/azure-pipelines/e2e-assets/ci-skipped-ports/baseline.txt b/azure-pipelines/e2e-assets/ci-skipped-ports/baseline.txt new file mode 100644 index 0000000000..cc7e6a4907 --- /dev/null +++ b/azure-pipelines/e2e-assets/ci-skipped-ports/baseline.txt @@ -0,0 +1,5 @@ +always-skip:arm64-osx=skip +always-skip:x64-linux=skip +always-skip:x64-osx=skip +always-skip:x64-windows=skip +always-skip:x86-windows=skip diff --git a/azure-pipelines/end-to-end-tests-dir/ci.ps1 b/azure-pipelines/end-to-end-tests-dir/ci.ps1 index a6703b0dc6..85f60548c6 100644 --- a/azure-pipelines/end-to-end-tests-dir/ci.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/ci.ps1 @@ -93,6 +93,27 @@ SUMMARY FOR $Triplet UNSUPPORTED: 1 "@ +# test that skipped ports aren't "put back" by downstream dependencies that aren't skipped +Refresh-TestRoot +$Output = Run-VcpkgAndCaptureOutput ci @commonArgs --x-builtin-ports-root="$PSScriptRoot/../e2e-assets/ci-skipped-ports" --binarysource=clear --ci-baseline="$PSScriptRoot/../e2e-assets/ci-skipped-ports/baseline.txt" +Throw-IfFailed +if (-not ($Output -match 'always-built:[^:]+: \*:' -and $Output -match 'Building always-built:[^@]+@1\.0\.0\.\.\.')) { + throw 'did not attempt to build always-built' +} +if (-not ($Output -match 'always-skip:[^:]+: skip\n')) { + throw 'tried to build skipped' +} +# This should be statically determinable but at the moment we do not +# if (-not ($Output -match 'always-cascade:[^:]+: cascade\n')) { +# throw 'tried to build cascaded' +# } +Throw-IfNonContains -Actual $Output -Expected @" +SUMMARY FOR $Triplet + SUCCEEDED: 1 + CASCADED_DUE_TO_MISSING_DEPENDENCIES: 1 + EXCLUDED: 1 +"@ + # test that features included only by skipped ports are not included $xunitFile = Join-Path $TestingRoot 'xunit.xml' Refresh-TestRoot diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index 8c94c375bf..b5bf83cbc0 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -197,7 +197,7 @@ namespace } ret.report_lines.insert_or_assign(exclusion.first, fmt::format("{:>40}: {}", exclusion.first, *state)); - ret.known.emplace(exclusion.first, known_result); + ret.known.insert_or_assign(exclusion.first, known_result); } return ret;