mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-12 21:59:01 +08:00
65 lines
1.7 KiB
PowerShell
65 lines
1.7 KiB
PowerShell
|
$TestingRoot = Join-Path $WorkingRoot 'testing'
|
||
|
$buildtreesRoot = Join-Path $TestingRoot 'buildtrees'
|
||
|
$installRoot = Join-Path $TestingRoot 'installed'
|
||
|
$packagesRoot = Join-Path $TestingRoot 'packages'
|
||
|
$NuGetRoot = Join-Path $TestingRoot 'nuget'
|
||
|
$NuGetRoot2 = Join-Path $TestingRoot 'nuget2'
|
||
|
$ArchiveRoot = Join-Path $TestingRoot 'archives'
|
||
|
$VersionFilesRoot = Join-Path $TestingRoot 'version-test'
|
||
|
$commonArgs = @(
|
||
|
"--triplet",
|
||
|
$Triplet,
|
||
|
"--x-buildtrees-root=$buildtreesRoot",
|
||
|
"--x-install-root=$installRoot",
|
||
|
"--x-packages-root=$packagesRoot",
|
||
|
"--overlay-ports=scripts/e2e_ports"
|
||
|
)
|
||
|
$CurrentTest = 'unassigned'
|
||
|
|
||
|
function Refresh-TestRoot {
|
||
|
Remove-Item -Recurse -Force $TestingRoot -ErrorAction SilentlyContinue
|
||
|
mkdir $TestingRoot | Out-Null
|
||
|
mkdir $NuGetRoot | Out-Null
|
||
|
}
|
||
|
|
||
|
function Require-FileExists {
|
||
|
[CmdletBinding()]
|
||
|
Param(
|
||
|
[string]$File
|
||
|
)
|
||
|
if (-Not (Test-Path $File)) {
|
||
|
throw "'$CurrentTest' failed to create file '$File'"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function Require-FileNotExists {
|
||
|
[CmdletBinding()]
|
||
|
Param(
|
||
|
[string]$File
|
||
|
)
|
||
|
if (Test-Path $File) {
|
||
|
throw "'$CurrentTest' should not have created file '$File'"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function Throw-IfFailed {
|
||
|
if ($LASTEXITCODE -ne 0) {
|
||
|
throw "'$CurrentTest' had a step with a nonzero exit code"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function Throw-IfNotFailed {
|
||
|
if ($LASTEXITCODE -eq 0) {
|
||
|
throw "'$CurrentTest' had a step with an unexpectedly zero exit code"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function Run-Vcpkg {
|
||
|
param([string[]]$TestArgs)
|
||
|
$CurrentTest = "./vcpkg $($testArgs -join ' ')"
|
||
|
Write-Host $CurrentTest
|
||
|
./vcpkg @testArgs
|
||
|
}
|
||
|
|
||
|
Refresh-TestRoot
|