-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
7e3b1a7
commit add000a
Showing
3 changed files
with
89 additions
and
75 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
azure-pipelines/e2e_projects/overlays-bad-paths/vcpkg-configuration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
finally | ||
{ | ||
Pop-Location | ||
} | ||
### </Initialize Registry> | ||
$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 | ||
} | ||
### </Initialize Registry> | ||
|
||
# [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 |