From dcbbb830576b2655b2759a8cf73191ab989eb13f Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Sun, 16 Jun 2024 20:39:17 +0200 Subject: [PATCH 1/7] Test ci command on malformed port manifests --- .../e2e-ports/ci-overlay/malformed/portfile.cmake | 1 + .../e2e-ports/ci-overlay/malformed/vcpkg.json | 4 ++++ azure-pipelines/end-to-end-tests-dir/ci.ps1 | 14 ++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 azure-pipelines/e2e-ports/ci-overlay/malformed/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/ci-overlay/malformed/vcpkg.json diff --git a/azure-pipelines/e2e-ports/ci-overlay/malformed/portfile.cmake b/azure-pipelines/e2e-ports/ci-overlay/malformed/portfile.cmake new file mode 100644 index 0000000000..065116c276 --- /dev/null +++ b/azure-pipelines/e2e-ports/ci-overlay/malformed/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/azure-pipelines/e2e-ports/ci-overlay/malformed/vcpkg.json b/azure-pipelines/e2e-ports/ci-overlay/malformed/vcpkg.json new file mode 100644 index 0000000000..01850f8037 --- /dev/null +++ b/azure-pipelines/e2e-ports/ci-overlay/malformed/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "malformed", + "version": "1", +} diff --git a/azure-pipelines/end-to-end-tests-dir/ci.ps1 b/azure-pipelines/end-to-end-tests-dir/ci.ps1 index f02177fa28..5ee9411267 100644 --- a/azure-pipelines/end-to-end-tests-dir/ci.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/ci.ps1 @@ -21,3 +21,17 @@ if (-not ($Output.Contains("REGRESSION: not-sup-host-b:${Triplet} is marked as f 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" } + +# test malformed port manifests +$Output = Run-VcpkgAndCaptureOutput ci --dry-run --triplet=$Triplet --x-builtin-ports-root="$PSScriptRoot/../e2e-ports/ci-overlay" --binarysource=clear --ci-baseline="$PSScriptRoot/../e2e-assets/ci/ci.baseline.txt" +Throw-IfNotFailed +if (-not ($Output.Contains("e2e-ports/ci-overlay/malformed/vcpkg.json:3:17: error:"))) { + throw 'malformed port manifest must raise a parsing error' +} + +# test malformed overlay port manifests +$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" --overlay-ports="$PSScriptRoot/../e2e-ports/ci-overlay" +Throw-IfNotFailed +if (-not ($Output.Contains("e2e-ports/ci-overlay/malformed/vcpkg.json:3:17: error:"))) { + throw 'malformed overlay port manifest must raise a parsing error' +} From 004533006765592d2d49d85ef267b3298679d07c Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 17 Jun 2024 07:05:17 +0200 Subject: [PATCH 2/7] Test ci command on individual malformed port manifest --- azure-pipelines/end-to-end-tests-dir/ci.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/azure-pipelines/end-to-end-tests-dir/ci.ps1 b/azure-pipelines/end-to-end-tests-dir/ci.ps1 index 5ee9411267..9b47e420eb 100644 --- a/azure-pipelines/end-to-end-tests-dir/ci.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/ci.ps1 @@ -29,6 +29,13 @@ if (-not ($Output.Contains("e2e-ports/ci-overlay/malformed/vcpkg.json:3:17: erro throw 'malformed port manifest must raise a parsing error' } +# test malformed individual overlay port manifest +$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" --overlay-ports="$PSScriptRoot/../e2e-ports/ci-overlay/malformed" +Throw-IfNotFailed +if (-not ($Output.Contains("e2e-ports/ci-overlay/malformed/vcpkg.json:3:17: error:"))) { + throw 'malformed port manifest must raise a parsing error' +} + # test malformed overlay port manifests $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" --overlay-ports="$PSScriptRoot/../e2e-ports/ci-overlay" Throw-IfNotFailed From dc2b67075e5b76c3c011361c3016ea729c304662 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 17 Jun 2024 08:35:55 +0200 Subject: [PATCH 3/7] Pass overlay port errors to OverlayProviderImpl --- include/vcpkg/paragraphs.h | 2 ++ src/vcpkg/paragraphs.cpp | 12 +++++++++--- src/vcpkg/portfileprovider.cpp | 15 +++++++++++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/include/vcpkg/paragraphs.h b/include/vcpkg/paragraphs.h index e48b902c09..4411fe6b2e 100644 --- a/include/vcpkg/paragraphs.h +++ b/include/vcpkg/paragraphs.h @@ -55,5 +55,7 @@ namespace vcpkg::Paragraphs std::vector load_all_registry_ports(const ReadOnlyFilesystem& fs, const RegistrySet& registries); + + LoadResults try_load_overlay_ports(const ReadOnlyFilesystem& fs, const Path& dir); std::vector load_overlay_ports(const ReadOnlyFilesystem& fs, const Path& dir); } diff --git a/src/vcpkg/paragraphs.cpp b/src/vcpkg/paragraphs.cpp index efdf97cf14..26186f8fc8 100644 --- a/src/vcpkg/paragraphs.cpp +++ b/src/vcpkg/paragraphs.cpp @@ -564,7 +564,7 @@ namespace vcpkg::Paragraphs return std::move(results.paragraphs); } - std::vector load_overlay_ports(const ReadOnlyFilesystem& fs, const Path& directory) + LoadResults try_load_overlay_ports(const ReadOnlyFilesystem& fs, const Path& directory) { LoadResults ret; @@ -590,8 +590,14 @@ namespace vcpkg::Paragraphs } } - load_results_print_error(ret); - return std::move(ret.paragraphs); + return ret; + } + + std::vector load_overlay_ports(const ReadOnlyFilesystem& fs, const Path& directory) + { + auto results = try_load_overlay_ports(fs, directory); + load_results_print_error(results); + return std::move(results.paragraphs); } uint64_t get_load_ports_stats() { return g_load_ports_stats.load(); } diff --git a/src/vcpkg/portfileprovider.cpp b/src/vcpkg/portfileprovider.cpp index d4e3ff4c63..183a749451 100644 --- a/src/vcpkg/portfileprovider.cpp +++ b/src/vcpkg/portfileprovider.cpp @@ -370,8 +370,19 @@ namespace vcpkg } // Try loading all ports inside ports_dir - auto found_scfls = Paragraphs::load_overlay_ports(m_fs, ports_dir); - for (auto&& scfl : found_scfls) + auto results = Paragraphs::try_load_overlay_ports(m_fs, ports_dir); + if (!results.errors.empty()) + { + print_error_message(LocalizedString::from_raw(Strings::join( + "\n", + results.errors, + [](const std::pair& err) -> const LocalizedString& { + return err.second; + }))); + Checks::exit_maybe_upgrade(VCPKG_LINE_INFO); + } + + for (auto&& scfl : results.paragraphs) { auto name = scfl.to_name(); auto it = m_overlay_cache.emplace(std::move(name), std::move(scfl)).first; From efcad1d7c883d421f8c20dd022d714d731dcf716 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 17 Jun 2024 09:25:22 +0200 Subject: [PATCH 4/7] Move broken-manifest overlay ports into separate dir "e2e-ports/overlays" is in common vcpkg test args. It must not contain ports with broken manifests where the the tool is expected to report the error. The tests which need these broken ports already passed an explicit "--overlay-ports" argument which duplicated the one in @commonArgs. That is why this commit only changes the value of the explicit argument. --- .../broken-no-name}/portfile.cmake | 0 .../broken-no-name/vcpkg.json | 0 .../broken-no-version}/portfile.cmake | 0 .../broken-no-version/vcpkg.json | 0 .../malformed}/portfile.cmake | 0 .../malformed/vcpkg.json | 0 .../end-to-end-tests-dir/build-test-ports.ps1 | 14 ++++++++++---- azure-pipelines/end-to-end-tests-dir/ci.ps1 | 15 ++++++--------- 8 files changed, 16 insertions(+), 13 deletions(-) rename azure-pipelines/e2e-ports/{ci-overlay/malformed => broken-manifests/broken-no-name}/portfile.cmake (100%) rename azure-pipelines/e2e-ports/{overlays => broken-manifests}/broken-no-name/vcpkg.json (100%) rename azure-pipelines/e2e-ports/{overlays/broken-no-name => broken-manifests/broken-no-version}/portfile.cmake (100%) rename azure-pipelines/e2e-ports/{overlays => broken-manifests}/broken-no-version/vcpkg.json (100%) rename azure-pipelines/e2e-ports/{overlays/broken-no-version => broken-manifests/malformed}/portfile.cmake (100%) rename azure-pipelines/e2e-ports/{ci-overlay => broken-manifests}/malformed/vcpkg.json (100%) diff --git a/azure-pipelines/e2e-ports/ci-overlay/malformed/portfile.cmake b/azure-pipelines/e2e-ports/broken-manifests/broken-no-name/portfile.cmake similarity index 100% rename from azure-pipelines/e2e-ports/ci-overlay/malformed/portfile.cmake rename to azure-pipelines/e2e-ports/broken-manifests/broken-no-name/portfile.cmake diff --git a/azure-pipelines/e2e-ports/overlays/broken-no-name/vcpkg.json b/azure-pipelines/e2e-ports/broken-manifests/broken-no-name/vcpkg.json similarity index 100% rename from azure-pipelines/e2e-ports/overlays/broken-no-name/vcpkg.json rename to azure-pipelines/e2e-ports/broken-manifests/broken-no-name/vcpkg.json diff --git a/azure-pipelines/e2e-ports/overlays/broken-no-name/portfile.cmake b/azure-pipelines/e2e-ports/broken-manifests/broken-no-version/portfile.cmake similarity index 100% rename from azure-pipelines/e2e-ports/overlays/broken-no-name/portfile.cmake rename to azure-pipelines/e2e-ports/broken-manifests/broken-no-version/portfile.cmake diff --git a/azure-pipelines/e2e-ports/overlays/broken-no-version/vcpkg.json b/azure-pipelines/e2e-ports/broken-manifests/broken-no-version/vcpkg.json similarity index 100% rename from azure-pipelines/e2e-ports/overlays/broken-no-version/vcpkg.json rename to azure-pipelines/e2e-ports/broken-manifests/broken-no-version/vcpkg.json diff --git a/azure-pipelines/e2e-ports/overlays/broken-no-version/portfile.cmake b/azure-pipelines/e2e-ports/broken-manifests/malformed/portfile.cmake similarity index 100% rename from azure-pipelines/e2e-ports/overlays/broken-no-version/portfile.cmake rename to azure-pipelines/e2e-ports/broken-manifests/malformed/portfile.cmake diff --git a/azure-pipelines/e2e-ports/ci-overlay/malformed/vcpkg.json b/azure-pipelines/e2e-ports/broken-manifests/malformed/vcpkg.json similarity index 100% rename from azure-pipelines/e2e-ports/ci-overlay/malformed/vcpkg.json rename to azure-pipelines/e2e-ports/broken-manifests/malformed/vcpkg.json diff --git a/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 b/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 index be70cb4be4..b5068fc1c5 100644 --- a/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 @@ -26,27 +26,33 @@ Run-Vcpkg @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install vcpkg Throw-IfFailed Run-Vcpkg @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install control-file Throw-IfFailed -$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/overlays" install broken-no-name +$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests" install broken-no-name Throw-IfNotFailed if ($output -notmatch "missing required field 'name'") { throw 'Did not detect missing field' } -$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/overlays" install broken-no-version +$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests" install broken-no-version Throw-IfNotFailed if ($output -notmatch 'expected a versioning field') { throw 'Did not detect missing field' } +$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests" install malformed +Throw-IfNotFailed +if ($output -notmatch 'Trailing comma') { + throw 'Did not detect malformed JSON' +} + # Check for msgAlreadyInstalled vs. msgAlreadyInstalledNotHead $output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install vcpkg-internal-e2e-test-port3 Throw-IfFailed if ($output -notmatch 'vcpkg-internal-e2e-test-port3:[^ ]+ is already installed') { - throw 'Wrong already installed message' + throw 'Wrong already installed message' } $output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install vcpkg-internal-e2e-test-port3 --head Throw-IfFailed if ($output -notmatch 'vcpkg-internal-e2e-test-port3:[^ ]+ is already installed -- not building from HEAD') { - throw 'Wrong already installed message for --head' + throw 'Wrong already installed message for --head' } diff --git a/azure-pipelines/end-to-end-tests-dir/ci.ps1 b/azure-pipelines/end-to-end-tests-dir/ci.ps1 index 9b47e420eb..dbac1d93aa 100644 --- a/azure-pipelines/end-to-end-tests-dir/ci.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/ci.ps1 @@ -22,23 +22,20 @@ if (-not ($Output.Contains("REGRESSION: dep-on-feature-not-sup:${Triplet} is mar throw "feature-not-sup's baseline fail entry should result in a regression because the port is cascade for this triplet" } -# test malformed port manifests -$Output = Run-VcpkgAndCaptureOutput ci --dry-run --triplet=$Triplet --x-builtin-ports-root="$PSScriptRoot/../e2e-ports/ci-overlay" --binarysource=clear --ci-baseline="$PSScriptRoot/../e2e-assets/ci/ci.baseline.txt" +# any invalid manifest must raise an error +$Output = Run-VcpkgAndCaptureOutput ci --dry-run --triplet=$Triplet --x-builtin-ports-root="$PSScriptRoot/../e2e-ports/broken-manifests" --binarysource=clear --ci-baseline="$PSScriptRoot/../e2e-assets/ci/ci.baseline.txt" Throw-IfNotFailed -if (-not ($Output.Contains("e2e-ports/ci-overlay/malformed/vcpkg.json:3:17: error:"))) { - throw 'malformed port manifest must raise a parsing error' -} # test malformed individual overlay port manifest -$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" --overlay-ports="$PSScriptRoot/../e2e-ports/ci-overlay/malformed" +$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" --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests/malformed" Throw-IfNotFailed -if (-not ($Output.Contains("e2e-ports/ci-overlay/malformed/vcpkg.json:3:17: error:"))) { +if (-not ($Output.Contains("vcpkg.json:3:17: error: Trailing comma"))) { throw 'malformed port manifest must raise a parsing error' } # test malformed overlay port manifests -$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" --overlay-ports="$PSScriptRoot/../e2e-ports/ci-overlay" +$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" --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests" Throw-IfNotFailed -if (-not ($Output.Contains("e2e-ports/ci-overlay/malformed/vcpkg.json:3:17: error:"))) { +if (-not ($Output.Contains("vcpkg.json:3:17: error: Trailing comma"))) { throw 'malformed overlay port manifest must raise a parsing error' } From b3977f064d722ac66f8d15ae18716d0168be46e8 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Thu, 20 Jun 2024 07:50:03 +0200 Subject: [PATCH 5/7] Ensure that inactive feature can have broken dependencies --- .../e2e-ports/ci/feature-dep-missing/portfile.cmake | 1 + .../e2e-ports/ci/feature-dep-missing/vcpkg.json | 12 ++++++++++++ azure-pipelines/end-to-end-tests-dir/ci.ps1 | 5 ++++- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 azure-pipelines/e2e-ports/ci/feature-dep-missing/portfile.cmake create mode 100644 azure-pipelines/e2e-ports/ci/feature-dep-missing/vcpkg.json diff --git a/azure-pipelines/e2e-ports/ci/feature-dep-missing/portfile.cmake b/azure-pipelines/e2e-ports/ci/feature-dep-missing/portfile.cmake new file mode 100644 index 0000000000..065116c276 --- /dev/null +++ b/azure-pipelines/e2e-ports/ci/feature-dep-missing/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/azure-pipelines/e2e-ports/ci/feature-dep-missing/vcpkg.json b/azure-pipelines/e2e-ports/ci/feature-dep-missing/vcpkg.json new file mode 100644 index 0000000000..cb34c6f616 --- /dev/null +++ b/azure-pipelines/e2e-ports/ci/feature-dep-missing/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "feature-dep-missing", + "version": "1", + "features": { + "dep-missing": { + "description": "dependency does not exist", + "dependencies": [ + "this-dependency-does-not-exist" + ] + } + } +} diff --git a/azure-pipelines/end-to-end-tests-dir/ci.ps1 b/azure-pipelines/end-to-end-tests-dir/ci.ps1 index dbac1d93aa..196effb8a8 100644 --- a/azure-pipelines/end-to-end-tests-dir/ci.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/ci.ps1 @@ -12,7 +12,10 @@ if (-not ($Output.Contains("not-sup-host-b:${Triplet}: skip"))) { if (-not ($Output.Contains("feature-not-sup:${Triplet}: *"))) { throw 'feature-not-sup must be build because the port that causes this port to skip should not be installed' } -if ($Output.Split("*").Length -ne 3) { +if (-not ($Output.Contains("feature-dep-missing:${Triplet}: *"))) { + throw 'feature-dep-missing must be build because the broken feature is not selected.' +} +if ($Output.Split("*").Length -ne 4) { 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}."))) { From d774fddd635844badc01032410f7a35445b2adc9 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Fri, 21 Jun 2024 07:55:53 +0200 Subject: [PATCH 6/7] Remove/restore problem matchers --- .../end-to-end-tests-dir/build-test-ports.ps1 | 2 ++ azure-pipelines/end-to-end-tests-dir/ci.ps1 | 4 ++++ azure-pipelines/end-to-end-tests-prelude.ps1 | 13 +++++++++++++ 3 files changed, 19 insertions(+) diff --git a/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 b/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 index b5068fc1c5..6223dffd7d 100644 --- a/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 @@ -38,7 +38,9 @@ if ($output -notmatch 'expected a versioning field') { throw 'Did not detect missing field' } +Remove-Problem-Matchers $output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests" install malformed +Restore-Problem-Matchers Throw-IfNotFailed if ($output -notmatch 'Trailing comma') { throw 'Did not detect malformed JSON' diff --git a/azure-pipelines/end-to-end-tests-dir/ci.ps1 b/azure-pipelines/end-to-end-tests-dir/ci.ps1 index 196effb8a8..8966c150b4 100644 --- a/azure-pipelines/end-to-end-tests-dir/ci.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/ci.ps1 @@ -30,14 +30,18 @@ $Output = Run-VcpkgAndCaptureOutput ci --dry-run --triplet=$Triplet --x-builtin- Throw-IfNotFailed # test malformed individual overlay port manifest +Remove-Problem-Matchers $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" --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests/malformed" +Restore-Problem-Matchers Throw-IfNotFailed if (-not ($Output.Contains("vcpkg.json:3:17: error: Trailing comma"))) { throw 'malformed port manifest must raise a parsing error' } # test malformed overlay port manifests +Remove-Problem-Matchers $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" --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests" +Restore-Problem-Matchers Throw-IfNotFailed if (-not ($Output.Contains("vcpkg.json:3:17: error: Trailing comma"))) { throw 'malformed overlay port manifest must raise a parsing error' diff --git a/azure-pipelines/end-to-end-tests-prelude.ps1 b/azure-pipelines/end-to-end-tests-prelude.ps1 index fe7e6095f2..e5b6156bec 100644 --- a/azure-pipelines/end-to-end-tests-prelude.ps1 +++ b/azure-pipelines/end-to-end-tests-prelude.ps1 @@ -158,4 +158,17 @@ function Run-Vcpkg { Run-VcpkgAndCaptureOutput -ForceExe:$ForceExe @TestArgs | Out-Null } + +# https://github.com/actions/toolkit/blob/main/docs/commands.md#problem-matchers +# .github/workflows/matchers.json +function Remove-Problem-Matchers { + Write-Host "::remove-matcher owner=vcpkg-msvc::" + Write-Host "::remove-matcher owner=vcpkg-gcc::" + Write-Host "::remove-matcher owner=vcpkg-catch::" +} +function Restore-Problem-Matchers { + Write-Host "::add-matcher::.github/workflows/matchers.json" +} + + Refresh-TestRoot From 15d334c2955ea2b9675840a40334819f3c91ca5b Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Fri, 5 Jul 2024 15:43:25 -0700 Subject: [PATCH 7/7] Add test that `install` behavior isn't regressed by adding this behavior. --- azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 b/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 index 6223dffd7d..d2dc4f97b3 100644 --- a/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1 @@ -20,12 +20,14 @@ if ($output -match 'vcpkg-internal-e2e-test-port3') { throw "Should not emit messages about -port3 while checking -port2" } -Run-Vcpkg @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/overlays" install vcpkg-empty-port +# Note that broken-manifests contains ports that must not be 'visited' while trying to install these +Run-Vcpkg @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/overlays" --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests" install vcpkg-empty-port Throw-IfFailed -Run-Vcpkg @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install vcpkg-internal-e2e-test-port +Run-Vcpkg @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests" install vcpkg-internal-e2e-test-port Throw-IfFailed -Run-Vcpkg @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install control-file +Run-Vcpkg @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests" install control-file Throw-IfFailed + $output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/broken-manifests" install broken-no-name Throw-IfNotFailed if ($output -notmatch "missing required field 'name'") {