|
| 1 | +# Copyright (c) Microsoft Corporation. |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +# |
| 4 | + |
| 5 | +<# |
| 6 | +.SYNOPSIS |
| 7 | +Runs the 'Test Modified Ports' part of the vcpkg CI system for all platforms. |
| 8 | +
|
| 9 | +.PARAMETER Triplet |
| 10 | +The triplet to test. |
| 11 | +
|
| 12 | +.PARAMETER WorkingRoot |
| 13 | +The location used as scratch space for 'installed', 'packages', and 'buildtrees' vcpkg directories. |
| 14 | +
|
| 15 | +.PARAMETER FailureLogs |
| 16 | +The location to write failure logs. Defaults to current directory / failure-logs |
| 17 | +
|
| 18 | +.PARAMETER ArchivesRoot |
| 19 | +Equivalent to '-BinarySourceStub "files,$ArchivesRoot"' |
| 20 | +
|
| 21 | +.PARAMETER BinarySourceStub |
| 22 | +The type and parameters of the binary source. Shared across runs of this script. If |
| 23 | +this parameter is not set, binary caching will not be used. Example: "files,W:\" |
| 24 | +#> |
| 25 | + |
| 26 | +[CmdletBinding(DefaultParameterSetName="ArchivesRoot")] |
| 27 | +Param( |
| 28 | + [Parameter(Mandatory = $true)] |
| 29 | + [ValidateNotNullOrEmpty()] |
| 30 | + [string]$Triplet, |
| 31 | + [Parameter(Mandatory = $true)] |
| 32 | + [ValidateNotNullOrEmpty()] |
| 33 | + $WorkingRoot, |
| 34 | + [ValidateNotNullOrEmpty()] |
| 35 | + $FailureLogs = './failure-logs', |
| 36 | + [Parameter(ParameterSetName='ArchivesRoot')] |
| 37 | + $ArchivesRoot = $null, |
| 38 | + [Parameter(ParameterSetName='BinarySourceStub')] |
| 39 | + $BinarySourceStub = $null |
| 40 | +) |
| 41 | + |
| 42 | +if (-Not ((Test-Path "triplets/$Triplet.cmake") -or (Test-Path "triplets/community/$Triplet.cmake"))) { |
| 43 | + Write-Error "Incorrect triplet '$Triplet', please supply a valid triplet." |
| 44 | + exit 1 |
| 45 | +} |
| 46 | + |
| 47 | +if ((-Not [string]::IsNullOrWhiteSpace($ArchivesRoot))) { |
| 48 | + if ((-Not [string]::IsNullOrWhiteSpace($BinarySourceStub))) { |
| 49 | + Write-Error "Only one binary caching setting may be used." |
| 50 | + exit 1 |
| 51 | + } |
| 52 | + |
| 53 | + $BinarySourceStub = "files,$ArchivesRoot" |
| 54 | +} |
| 55 | + |
| 56 | +$buildtreesRoot = Join-Path $WorkingRoot 'b' |
| 57 | +$installRoot = Join-Path $WorkingRoot 'installed' |
| 58 | +$packagesRoot = Join-Path $WorkingRoot 'p' |
| 59 | + |
| 60 | +$commonArgs = @( |
| 61 | + "--x-buildtrees-root=$buildtreesRoot", |
| 62 | + "--x-install-root=$installRoot", |
| 63 | + "--x-packages-root=$packagesRoot", |
| 64 | + "--overlay-ports=scripts/test_ports" |
| 65 | +) |
| 66 | + |
| 67 | +$cachingArgs = @() |
| 68 | +if ([string]::IsNullOrWhiteSpace($BinarySourceStub)) { |
| 69 | + $cachingArgs = @('--no-binarycaching') |
| 70 | +} else { |
| 71 | + $cachingArgs += "--binarysource=clear;$BinarySourceStub,readwrite" |
| 72 | +} |
| 73 | + |
| 74 | +if ($IsWindows) { |
| 75 | + $vcpkgExe = './vcpkg.exe' |
| 76 | +} else { |
| 77 | + $vcpkgExe = './vcpkg' |
| 78 | +} |
| 79 | + |
| 80 | +$ciBaselineFile = "$PSScriptRoot/../ci.feature.baseline.txt" |
| 81 | +$ciBaselineArg = "--ci-feature-baseline=$ciBaselineFile" |
| 82 | + |
| 83 | +if ($Triplet -eq 'x64-windows-release') { |
| 84 | + $tripletArg = "--host-triplet=$Triplet" |
| 85 | +} else { |
| 86 | + $tripletArg = "--triplet=$Triplet" |
| 87 | +} |
| 88 | + |
| 89 | +& $vcpkgExe x-check-features --for-merge-with origin/master $tripletArg "--failure-logs=$FailureLogs" $ciBaselineArg @commonArgs @cachingArgs |
| 90 | +$lastLastExitCode = $LASTEXITCODE |
| 91 | +if ($lastLastExitCode -ne 0) |
| 92 | +{ |
| 93 | + Write-Error "vcpkg feature testing failed; this is usually a bug in a port. Check for failure logs attached to the run in Azure Pipelines." |
| 94 | +} |
| 95 | + |
| 96 | +exit $lastLastExitCode |
0 commit comments