2020-12-16 02:26:00 +08:00
|
|
|
$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",
|
2020-12-22 07:40:21 +08:00
|
|
|
"--overlay-ports=scripts/e2e_ports/overlays"
|
2020-12-16 02:26:00 +08:00
|
|
|
)
|
2020-12-22 07:40:21 +08:00
|
|
|
$Script:CurrentTest = 'unassigned'
|
2020-12-16 02:26:00 +08:00
|
|
|
|
|
|
|
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)) {
|
2020-12-22 07:40:21 +08:00
|
|
|
throw "'$Script:CurrentTest' failed to create file '$File'"
|
2020-12-16 02:26:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Require-FileNotExists {
|
|
|
|
[CmdletBinding()]
|
|
|
|
Param(
|
|
|
|
[string]$File
|
|
|
|
)
|
|
|
|
if (Test-Path $File) {
|
2020-12-22 07:40:21 +08:00
|
|
|
throw "'$Script:CurrentTest' should not have created file '$File'"
|
2020-12-16 02:26:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Throw-IfFailed {
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
2020-12-22 07:40:21 +08:00
|
|
|
throw "'$Script:CurrentTest' had a step with a nonzero exit code"
|
2020-12-16 02:26:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Throw-IfNotFailed {
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
2020-12-22 07:40:21 +08:00
|
|
|
throw "'$Script:CurrentTest' had a step with an unexpectedly zero exit code"
|
2020-12-16 02:26:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Run-Vcpkg {
|
2020-12-22 07:40:21 +08:00
|
|
|
Param(
|
|
|
|
[Parameter(ValueFromRemainingArguments)]
|
|
|
|
[string[]]$TestArgs
|
|
|
|
)
|
|
|
|
$Script:CurrentTest = "./vcpkg $($testArgs -join ' ')"
|
|
|
|
Write-Host $Script:CurrentTest
|
2020-12-16 02:26:00 +08:00
|
|
|
./vcpkg @testArgs
|
|
|
|
}
|
|
|
|
|
|
|
|
Refresh-TestRoot
|