Fix end to end tests writing into the source tree. (#1106)
* Fix overlays test writing to the source tree. * Fix patterns test writing into the source tree.
This commit is contained in:
Родитель
7e3b1a79a9
Коммит
add000ac05
|
@ -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 ]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,84 +1,94 @@
|
|||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
### <Initialize registry>
|
||||
# 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
|
||||
### <Initialize registry>
|
||||
# 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
|
||||
$gitConfig = @(
|
||||
'-c', 'user.name=Nobody',
|
||||
'-c', 'user.email=nobody@example.com',
|
||||
'-c', 'core.autocrlf=false'
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
### </Initialize Registry>
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
$commonArgs += @("--x-manifest-root=$manifestRoot")
|
||||
|
||||
# [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
|
||||
|
||||
# [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"
|
||||
Update-VcpkgJson 'with-default.json.in'
|
||||
Run-Vcpkg -EndToEndTestSilent @commonArgs install | Out-Null
|
||||
Throw-IfFailed
|
||||
Refresh-TestRoot
|
||||
|
||||
# [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
|
||||
finally
|
||||
{
|
||||
Pop-Location
|
||||
Remove-Item -Recurse -Force -LiteralPath @(
|
||||
"$WorkingRoot/registries-package-patterns",
|
||||
"$WorkingRoot/e2e_registry"
|
||||
) -ErrorAction SilentlyContinue
|
||||
}
|
||||
### </Initialize Registry>
|
||||
|
||||
$commonArgs += @("--x-manifest-root=$manifestRoot")
|
||||
|
||||
# [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"
|
||||
|
||||
Run-Vcpkg -EndToEndTestSilent @commonArgs install | Out-Null
|
||||
Throw-IfFailed
|
||||
Refresh-TestRoot
|
||||
|
||||
# [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"
|
||||
|
||||
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"
|
||||
|
||||
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")
|
||||
{
|
||||
$out
|
||||
throw "Expected warning about redeclaration"
|
||||
}
|
||||
Refresh-TestRoot
|
Загрузка…
Ссылка в новой задаче