diff --git a/azure-pipelines/e2e_projects/overlays-bad-paths/vcpkg-configuration.json b/azure-pipelines/e2e_projects/overlays-bad-paths/vcpkg-configuration.json index ca49482b31..827dc498e6 100644 --- a/azure-pipelines/e2e_projects/overlays-bad-paths/vcpkg-configuration.json +++ b/azure-pipelines/e2e_projects/overlays-bad-paths/vcpkg-configuration.json @@ -1,4 +1,4 @@ { - "overlay-ports": [ "./azure-pipelines/e2e_projects/overlays-project-with-config/config-overlays" ], + "overlay-ports": [ "./azure-pipelines/e2e_projects/overlays-project-with-config/config-overlays/nonexistent" ], "overlay-triplets": [ 123 ] } diff --git a/azure-pipelines/end-to-end-tests-dir/overlays.ps1 b/azure-pipelines/end-to-end-tests-dir/overlays.ps1 index f91bf42d11..9d5bf445c1 100644 --- a/azure-pipelines/end-to-end-tests-dir/overlays.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/overlays.ps1 @@ -1,9 +1,13 @@ . $PSScriptRoot/../end-to-end-tests-prelude.ps1 # Tests a simple project with overlay ports and triplets configured on a vcpkg-configuration.json file -$e2eProjects = "$PSScriptRoot/../e2e_projects" +Copy-Item -Recurse -LiteralPath @( + "$PSScriptRoot/../e2e_projects/overlays-project-with-config", + "$PSScriptRoot/../e2e_projects/overlays-project-config-embedded", + "$PSScriptRoot/../e2e_projects/overlays-bad-paths" + ) $TestingRoot -$manifestRoot = "$e2eProjects/overlays-project-with-config" +$manifestRoot = "$TestingRoot/overlays-project-with-config" $env:VCPKG_OVERLAY_PORTS = "$manifestRoot/env-overlays" Run-Vcpkg install --x-manifest-root=$manifestRoot ` @@ -13,7 +17,7 @@ Run-Vcpkg install --x-manifest-root=$manifestRoot ` Throw-IfFailed # Tests overlays configured in env and cli on a project with configuration embedded on the manifest file -$manifestRoot = "$e2eProjects/overlays-project-config-embedded" +$manifestRoot = "$TestingRoot/overlays-project-config-embedded" $env:VCPKG_OVERLAY_PORTS = "$manifestRoot/env-overlays" Run-Vcpkg install --x-manifest-root=$manifestRoot ` --overlay-ports=$manifestRoot/cli-overlays ` @@ -22,7 +26,7 @@ Run-Vcpkg install --x-manifest-root=$manifestRoot ` Throw-IfFailed # Config with bad paths -$manifestRoot = "$e2eProjects/overlays-bad-paths" +$manifestRoot = "$TestingRoot/overlays-bad-paths" $env:VCPKG_OVERLAY_PORTS = "$manifestRoot/env_overlays" Run-Vcpkg install --x-manifest-root=$manifestRoot ` --overlay-triplets=$manifestRoot/my-triplets ` @@ -30,7 +34,7 @@ Run-Vcpkg install --x-manifest-root=$manifestRoot ` Throw-IfNotFailed # Test overlay_triplet paths remain relative to the manifest root after x-update-baseline -$manifestRoot = "$e2eProjects/overlays-project-with-config" +$manifestRoot = "$TestingRoot/overlays-project-with-config" $configurationBefore = Get-Content "$manifestRoot/vcpkg-configuration.json" | ConvertFrom-Json Run-Vcpkg x-update-baseline --x-manifest-root=$manifestRoot $configurationAfter = Get-Content "$manifestRoot/vcpkg-configuration.json" | ConvertFrom-Json diff --git a/azure-pipelines/end-to-end-tests-dir/patterns.ps1 b/azure-pipelines/end-to-end-tests-dir/patterns.ps1 index 8cc837ee29..b34948cce7 100644 --- a/azure-pipelines/end-to-end-tests-dir/patterns.ps1 +++ b/azure-pipelines/end-to-end-tests-dir/patterns.ps1 @@ -1,84 +1,94 @@ . $PSScriptRoot/../end-to-end-tests-prelude.ps1 -### -# Creates a git registry to run the e2e tests on -$e2eProjects = "$PSScriptRoot/../e2e_projects" -$manifestRoot = "$e2eProjects/registries-package-patterns" -$e2eRegistryPath = "$PSScriptRoot/../e2e_registry".Replace('\', '\\') -Push-Location $e2eRegistryPath try { - Write-Host "Initializing test registry" - if (Test-Path "$e2eRegistryPath/.git") - { - Remove-Item -Recurse -Force "$e2eRegistryPath/.git" - } - + Copy-Item -Recurse -LiteralPath @( + "$PSScriptRoot/../e2e_projects/registries-package-patterns", + "$PSScriptRoot/../e2e_registry" + ) $WorkingRoot - $gitConfig = @( - '-c', 'user.name=Nobody', - '-c', 'user.email=nobody@example.com', - '-c', 'core.autocrlf=false' - ) + $manifestRoot = "$WorkingRoot/registries-package-patterns" + $e2eRegistryPath = "$WorkingRoot/e2e_registry".Replace('\', '\\') + Push-Location $e2eRegistryPath + ### + # Creates a git registry to run the e2e tests on + try + { + Write-Host "Initializing test registry" + if (Test-Path "$e2eRegistryPath/.git") + { + Remove-Item -Recurse -Force "$e2eRegistryPath/.git" + } + - git @gitConfig init . | Out-Null - Throw-IfFailed - git @gitConfig add -A | Out-Null - Throw-IfFailed - git @gitConfig commit -m "initial commit" | Out-Null - Throw-IfFailed - $e2eRegistryBaseline = git rev-parse HEAD - Throw-IfFailed -} -finally -{ - Pop-Location -} -### + $gitConfig = @( + '-c', 'user.name=Nobody', + '-c', 'user.email=nobody@example.com', + '-c', 'core.autocrlf=false' + ) -$commonArgs += @("--x-manifest-root=$manifestRoot") + git @gitConfig init . | Out-Null + Throw-IfFailed + git @gitConfig add -A | Out-Null + Throw-IfFailed + git @gitConfig commit -m "initial commit" | Out-Null + Throw-IfFailed + $e2eRegistryBaseline = git rev-parse HEAD + Throw-IfFailed + } + finally + { + Pop-Location + } + ### -# [patterns] No patterns (no default) -Write-Host "[patterns] No patterns (no default)" -$inFile = "$manifestRoot/no-patterns.json.in" -(Get-Content -Path "$inFile").Replace("`$E2ERegistryPath", $e2eRegistryPath).Replace("`$E2ERegistryBaseline", $e2eRegistryBaseline) ` -| Out-File "$manifestRoot/vcpkg.json" + function Update-VcpkgJson { + param($PreReplacementName) + $content = Get-Content -LiteralPath "$manifestRoot/$PreReplacementName" + $content = $content.Replace('$E2ERegistryPath', $e2eRegistryPath) + $content = $content.Replace('$E2ERegistryBaseline', $e2eRegistryBaseline) + Set-Content -LiteralPath "$manifestRoot/vcpkg.json" -Value $content + } -Run-Vcpkg -EndToEndTestSilent @commonArgs install | Out-Null -Throw-IfFailed -Refresh-TestRoot + $commonArgs += @("--x-manifest-root=$manifestRoot") -# [patterns] Patterns only (no default) -Write-Host "[patterns] Patterns only (no default)" -$inFile = "$manifestRoot/only-patterns.json.in" -(Get-Content -Path "$inFile").Replace("`$E2ERegistryPath", $e2eRegistryPath).Replace("`$E2ERegistryBaseline", $e2eRegistryBaseline) ` -| Out-File "$manifestRoot/vcpkg.json" + # [patterns] No patterns (no default) + Write-Host "[patterns] No patterns (no default)" + Update-VcpkgJson 'no-patterns.json.in' + Run-Vcpkg -EndToEndTestSilent @commonArgs install | Out-Null + Throw-IfFailed + Refresh-TestRoot -Run-Vcpkg -EndToEndTestSilent @commonArgs install | Out-Null -Throw-IfFailed -Refresh-TestRoot + # [patterns] Patterns only (no default) + Write-Host "[patterns] Patterns only (no default)" + Update-VcpkgJson 'only-patterns.json.in' + Run-Vcpkg -EndToEndTestSilent @commonArgs install | Out-Null + Throw-IfFailed + Refresh-TestRoot -# [patterns] Patterns with default -Write-Host "[patterns] Patterns with default" -$inFile = "$manifestRoot/with-default.json.in" -(Get-Content -Path "$inFile").Replace("`$E2ERegistryPath", $e2eRegistryPath).Replace("`$E2ERegistryBaseline", $e2eRegistryBaseline) ` -| Out-File "$manifestRoot/vcpkg.json" + # [patterns] Patterns with default + Write-Host "[patterns] Patterns with default" + Update-VcpkgJson 'with-default.json.in' + Run-Vcpkg -EndToEndTestSilent @commonArgs install | Out-Null + Throw-IfFailed + Refresh-TestRoot -Run-Vcpkg -EndToEndTestSilent @commonArgs install | Out-Null -Throw-IfFailed -Refresh-TestRoot - -# [patterns] Repeated patterns -Write-Host "[patterns] Repeated patterns" -$inFile = "$manifestRoot/with-redeclaration.json.in" -(Get-Content -Path "$inFile").Replace("`$E2ERegistryPath", $e2eRegistryPath).Replace("`$E2ERegistryBaseline", $e2eRegistryBaseline) ` -| Out-File "$manifestRoot/vcpkg.json" - -$out = Run-VcpkgAndCaptureOutput -EndToEndTestSilent @commonArgs install -Throw-IfFailed -if ($out -notmatch "redeclarations will be ignored") + # [patterns] Repeated patterns + Write-Host "[patterns] Repeated patterns" + Update-VcpkgJson 'with-redeclaration.json.in' + $out = Run-VcpkgAndCaptureOutput -EndToEndTestSilent @commonArgs install + Throw-IfFailed + if ($out -notmatch "redeclarations will be ignored") + { + $out + throw "Expected warning about redeclaration" + } + Refresh-TestRoot +} +finally { - $out - throw "Expected warning about redeclaration" + Remove-Item -Recurse -Force -LiteralPath @( + "$WorkingRoot/registries-package-patterns", + "$WorkingRoot/e2e_registry" + ) -ErrorAction SilentlyContinue } -Refresh-TestRoot \ No newline at end of file