2020-06-25 16:36:28 -07:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
#
|
|
|
|
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Runs the 'Test Modified Ports' part of the vcpkg CI system for all platforms.
|
|
|
|
|
|
|
|
.PARAMETER Triplet
|
|
|
|
The triplet to test.
|
|
|
|
|
|
|
|
.PARAMETER WorkingRoot
|
|
|
|
The location used as scratch space for 'installed', 'packages', and 'buildtrees' vcpkg directories.
|
|
|
|
|
2020-09-21 17:27:35 -07:00
|
|
|
.PARAMETER ArtifactStagingDirectory
|
2020-06-25 16:36:28 -07:00
|
|
|
The Azure Pipelines artifacts directory. If not supplied, defaults to the current directory.
|
|
|
|
|
2020-09-28 13:54:10 -07:00
|
|
|
.PARAMETER ArchivesRoot
|
2020-11-18 12:21:23 -08:00
|
|
|
Equivalent to '-BinarySourceStub "files,$ArchivesRoot"'
|
|
|
|
|
|
|
|
.PARAMETER BinarySourceStub
|
|
|
|
The type and parameters of the binary source. Shared across runs of this script. If
|
|
|
|
this parameter is not set, binary caching will not be used. Example: "files,W:\"
|
2020-09-28 13:54:10 -07:00
|
|
|
|
2020-06-25 16:36:28 -07:00
|
|
|
.PARAMETER BuildReason
|
2020-09-28 13:54:10 -07:00
|
|
|
The reason Azure Pipelines is running this script (controls in which mode Binary Caching is used).
|
2020-12-22 14:52:58 -08:00
|
|
|
If BinarySourceStub is not set, this parameter has no effect. If BinarySourceStub is set and this is
|
|
|
|
not, binary caching will default to read-write mode.
|
2021-07-19 19:55:00 -07:00
|
|
|
|
|
|
|
.PARAMETER PassingIsPassing
|
|
|
|
Indicates that 'Passing, remove from fail list' results should not be emitted as failures. (For example, this is used
|
|
|
|
when using vcpkg to test a prerelease MSVC++ compiler)
|
2020-06-25 16:36:28 -07:00
|
|
|
#>
|
|
|
|
|
2020-11-18 12:21:23 -08:00
|
|
|
[CmdletBinding(DefaultParameterSetName="ArchivesRoot")]
|
2020-06-25 16:36:28 -07:00
|
|
|
Param(
|
2020-06-26 12:37:53 -07:00
|
|
|
[Parameter(Mandatory = $true)]
|
2020-06-25 16:36:28 -07:00
|
|
|
[ValidateNotNullOrEmpty()]
|
|
|
|
[string]$Triplet,
|
2020-06-26 12:37:53 -07:00
|
|
|
[Parameter(Mandatory = $true)]
|
2020-06-25 16:36:28 -07:00
|
|
|
[ValidateNotNullOrEmpty()]
|
|
|
|
$WorkingRoot,
|
|
|
|
[ValidateNotNullOrEmpty()]
|
2020-09-21 17:27:35 -07:00
|
|
|
$ArtifactStagingDirectory = '.',
|
2020-11-18 12:21:23 -08:00
|
|
|
[Parameter(ParameterSetName='ArchivesRoot')]
|
2020-09-28 13:54:10 -07:00
|
|
|
$ArchivesRoot = $null,
|
2020-11-18 12:21:23 -08:00
|
|
|
[Parameter(ParameterSetName='BinarySourceStub')]
|
|
|
|
$BinarySourceStub = $null,
|
2021-07-19 19:55:00 -07:00
|
|
|
$BuildReason = $null,
|
|
|
|
[switch]
|
2021-09-15 11:39:39 -07:00
|
|
|
$PassingIsPassing = $false
|
2020-06-25 16:36:28 -07:00
|
|
|
)
|
|
|
|
|
2021-01-08 11:55:31 -08:00
|
|
|
if (-Not ((Test-Path "triplets/$Triplet.cmake") -or (Test-Path "triplets/community/$Triplet.cmake"))) {
|
2020-06-25 16:36:28 -07:00
|
|
|
Write-Error "Incorrect triplet '$Triplet', please supply a valid triplet."
|
2020-07-01 10:53:10 -07:00
|
|
|
throw
|
2020-06-25 16:36:28 -07:00
|
|
|
}
|
|
|
|
|
2021-09-03 00:02:29 -07:00
|
|
|
if ((-Not [string]::IsNullOrWhiteSpace($ArchivesRoot))) {
|
|
|
|
if ((-Not [string]::IsNullOrWhiteSpace($BinarySourceStub))) {
|
|
|
|
Write-Error "Only one binary caching setting may be used."
|
|
|
|
throw
|
2020-12-22 14:52:58 -08:00
|
|
|
}
|
2021-09-03 00:02:29 -07:00
|
|
|
|
|
|
|
$BinarySourceStub = "files,$ArchivesRoot"
|
2020-12-22 14:52:58 -08:00
|
|
|
}
|
|
|
|
|
2020-06-25 16:36:28 -07:00
|
|
|
$env:VCPKG_DOWNLOADS = Join-Path $WorkingRoot 'downloads'
|
|
|
|
$buildtreesRoot = Join-Path $WorkingRoot 'buildtrees'
|
|
|
|
$installRoot = Join-Path $WorkingRoot 'installed'
|
|
|
|
$packagesRoot = Join-Path $WorkingRoot 'packages'
|
2020-09-28 13:54:10 -07:00
|
|
|
|
2021-09-03 00:02:29 -07:00
|
|
|
$commonArgs = @(
|
2020-06-25 16:36:28 -07:00
|
|
|
"--x-buildtrees-root=$buildtreesRoot",
|
|
|
|
"--x-install-root=$installRoot",
|
2020-08-01 01:48:52 +02:00
|
|
|
"--x-packages-root=$packagesRoot",
|
|
|
|
"--overlay-ports=scripts/test_ports"
|
2020-06-25 16:36:28 -07:00
|
|
|
)
|
|
|
|
|
2020-07-02 20:20:07 -07:00
|
|
|
$skipFailures = $false
|
2021-09-03 00:02:29 -07:00
|
|
|
if ([string]::IsNullOrWhiteSpace($BinarySourceStub)) {
|
|
|
|
$commonArgs += @('--no-binarycaching')
|
|
|
|
} else {
|
|
|
|
$commonArgs += @('--binarycaching')
|
2020-09-28 13:54:10 -07:00
|
|
|
$binaryCachingMode = 'readwrite'
|
|
|
|
if ([string]::IsNullOrWhiteSpace($BuildReason)) {
|
|
|
|
Write-Host 'Build reason not specified, defaulting to using binary caching in read write mode.'
|
|
|
|
}
|
|
|
|
elseif ($BuildReason -eq 'PullRequest') {
|
|
|
|
Write-Host 'Build reason was Pull Request, using binary caching in read write mode, skipping failures.'
|
|
|
|
$skipFailures = $true
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Write-Host "Build reason was $BuildReason, using binary caching in write only mode."
|
|
|
|
$binaryCachingMode = 'write'
|
|
|
|
}
|
2020-12-22 14:52:58 -08:00
|
|
|
|
|
|
|
$commonArgs += @("--binarysource=clear;$BinarySourceStub,$binaryCachingMode")
|
2020-09-28 13:54:10 -07:00
|
|
|
}
|
2020-06-26 12:37:53 -07:00
|
|
|
|
2020-06-25 16:36:28 -07:00
|
|
|
if ($Triplet -eq 'x64-linux') {
|
|
|
|
$env:HOME = '/home/agent'
|
|
|
|
$executableExtension = [string]::Empty
|
2020-06-26 12:37:53 -07:00
|
|
|
}
|
|
|
|
elseif ($Triplet -eq 'x64-osx') {
|
2020-06-25 16:36:28 -07:00
|
|
|
$executableExtension = [string]::Empty
|
2020-06-26 12:37:53 -07:00
|
|
|
}
|
|
|
|
else {
|
2020-06-25 16:36:28 -07:00
|
|
|
$executableExtension = '.exe'
|
|
|
|
}
|
|
|
|
|
2020-09-21 17:27:35 -07:00
|
|
|
$xmlResults = Join-Path $ArtifactStagingDirectory 'xml-results'
|
2020-06-25 16:36:28 -07:00
|
|
|
mkdir $xmlResults
|
|
|
|
$xmlFile = Join-Path $xmlResults "$Triplet.xml"
|
|
|
|
|
2020-09-21 17:27:35 -07:00
|
|
|
$failureLogs = Join-Path $ArtifactStagingDirectory 'failure-logs'
|
2020-07-02 20:20:07 -07:00
|
|
|
|
2020-06-25 16:36:28 -07:00
|
|
|
& "./vcpkg$executableExtension" x-ci-clean @commonArgs
|
2021-09-14 17:46:38 -07:00
|
|
|
if ($LASTEXITCODE -ne 0)
|
|
|
|
{
|
|
|
|
throw "vcpkg clean failed"
|
|
|
|
}
|
|
|
|
|
2020-07-02 20:20:07 -07:00
|
|
|
$skipList = . "$PSScriptRoot/generate-skip-list.ps1" `
|
|
|
|
-Triplet $Triplet `
|
|
|
|
-BaselineFile "$PSScriptRoot/../ci.baseline.txt" `
|
|
|
|
-SkipFailures:$skipFailures
|
2020-06-25 16:36:28 -07:00
|
|
|
|
2021-05-06 07:12:43 -07:00
|
|
|
if ($Triplet -in @('x64-windows', 'x64-osx', 'x64-linux'))
|
|
|
|
{
|
|
|
|
# WORKAROUND: These triplets are native-targetting which triggers an issue in how vcpkg handles the skip list.
|
|
|
|
# The workaround is to pass the skip list as host-excludes as well.
|
2021-09-15 11:39:39 -07:00
|
|
|
& "./vcpkg$executableExtension" ci $Triplet --x-xunit=$xmlFile --exclude=$skipList --host-exclude=$skipList --failure-logs=$failureLogs @commonArgs
|
2021-05-06 07:12:43 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-09-15 11:39:39 -07:00
|
|
|
& "./vcpkg$executableExtension" ci $Triplet --x-xunit=$xmlFile --exclude=$skipList --failure-logs=$failureLogs @commonArgs
|
2021-09-14 17:46:38 -07:00
|
|
|
}
|
|
|
|
|
2021-09-28 23:00:33 +02:00
|
|
|
$failureLogsEmpty = ((Test-Path $failureLogs) -and (Get-ChildItem $failureLogs).count -eq 0)
|
|
|
|
Write-Host "##vso[task.setvariable variable=FAILURE_LOGS_EMPTY]$failureLogsEmpty"
|
|
|
|
|
2021-09-14 17:46:38 -07:00
|
|
|
if ($LASTEXITCODE -ne 0)
|
|
|
|
{
|
|
|
|
throw "vcpkg ci failed"
|
2021-05-06 07:12:43 -07:00
|
|
|
}
|
2021-09-14 17:46:38 -07:00
|
|
|
|
2020-07-02 20:20:07 -07:00
|
|
|
& "$PSScriptRoot/analyze-test-results.ps1" -logDir $xmlResults `
|
|
|
|
-triplet $Triplet `
|
2021-07-19 19:55:00 -07:00
|
|
|
-baselineFile .\scripts\ci.baseline.txt `
|
|
|
|
-passingIsPassing:$PassingIsPassing
|