2020-05-13 05:08:05 +03:00
<#
. SYNOPSIS
This script runs quicinterop locally .
. PARAMETER Config
Specifies the build configuration to use .
. PARAMETER Arch
The CPU architecture to use .
. PARAMETER Tls
The TLS library use .
. PARAMETER KeepOutputOnSuccess
Don ' t discard console output or logs on success .
. PARAMETER GenerateXmlResults
Generates an xml Test report for the run .
. PARAMETER Debugger
Attaches the debugger to the process .
2020-11-13 06:13:47 +03:00
. PARAMETER InitialBreak
Debugger starts broken into the process to allow setting breakpoints , etc .
2020-05-13 05:08:05 +03:00
. PARAMETER LogProfile
The name of the profile to use for log collection .
2020-06-06 02:17:10 +03:00
. PARAMETER Target
A target to connect to .
. PARAMETER Custom
A custom hostname to connect to .
. PARAMETER Port
A UDP port to connect to .
. PARAMETER Test
A particular test case to run .
2020-06-09 22:12:59 +03:00
. PARAMETER Version
The initial version to use for the connection .
2020-06-09 00:11:25 +03:00
. PARAMETER Serial
Runs the test cases serially .
2020-09-05 04:01:14 +03:00
. PARAMETER UrlPath
Path to resource on the server to download .
2020-05-13 05:08:05 +03:00
#>
param (
[ Parameter ( Mandatory = $false ) ]
[ ValidateSet ( " Debug " , " Release " ) ]
[ string ] $Config = " Debug " ,
[ Parameter ( Mandatory = $false ) ]
[ ValidateSet ( " x86 " , " x64 " , " arm " , " arm64 " ) ]
[ string ] $Arch = " x64 " ,
[ Parameter ( Mandatory = $false ) ]
2023-02-02 21:43:49 +03:00
[ ValidateSet ( " schannel " , " openssl " , " openssl3 " ) ]
2020-05-13 05:08:05 +03:00
[ string ] $Tls = " " ,
[ Parameter ( Mandatory = $false ) ]
[ switch ] $KeepOutputOnSuccess = $false ,
[ Parameter ( Mandatory = $false ) ]
[ switch ] $GenerateXmlResults = $false ,
[ Parameter ( Mandatory = $false ) ]
[ switch ] $Debugger = $false ,
2020-11-13 06:13:47 +03:00
[ Parameter ( Mandatory = $false ) ]
[ switch ] $InitialBreak = $false ,
2020-05-13 05:08:05 +03:00
[ Parameter ( Mandatory = $false ) ]
[ ValidateSet ( " None " , " Basic.Light " , " Basic.Verbose " , " Full.Light " , " Full.Verbose " , " SpinQuic.Light " ) ]
[ string ] $LogProfile = " None " ,
2020-06-06 02:17:10 +03:00
[ Parameter ( Mandatory = $false ) ]
[ string ] $Target = " " ,
[ Parameter ( Mandatory = $false ) ]
[ string ] $Custom = " " ,
[ Parameter ( Mandatory = $false ) ]
[ string ] $Port = " " ,
[ Parameter ( Mandatory = $false ) ]
2020-06-09 00:11:25 +03:00
[ string ] $Test = " " ,
2020-06-09 22:12:59 +03:00
[ Parameter ( Mandatory = $false ) ]
[ string ] $Version = " " ,
2020-06-09 00:11:25 +03:00
[ Parameter ( Mandatory = $false ) ]
2020-09-05 04:01:14 +03:00
[ switch ] $Serial = $false ,
[ Parameter ( Mandatory = $false ) ]
2021-05-14 02:14:58 +03:00
[ string ] $UrlPath = " " ,
[ Parameter ( Mandatory = $false ) ]
2023-07-05 22:08:43 +03:00
[ switch ] $AZP = $false ,
[ Parameter ( Mandatory = $false ) ]
[ switch ] $GHA = $false
2020-05-13 05:08:05 +03:00
)
Set-StrictMode -Version 'Latest'
$PSDefaultParameterValues [ '*:ErrorAction' ] = 'Stop'
# Default TLS based on current platform.
if ( " " -eq $Tls ) {
if ( $IsWindows ) {
$Tls = " schannel "
} else {
$Tls = " openssl "
}
}
# Root directory of the project.
$RootDir = Split-Path $PSScriptRoot -Parent
# Path to the run-executable Powershell script.
2020-06-23 02:18:26 +03:00
$RunExecutable = Join-Path $RootDir " scripts/run-executable.ps1 "
2020-05-13 05:08:05 +03:00
# Path to the quicinterop exectuable.
$QuicInterop = $null
if ( $IsWindows ) {
2020-07-17 22:25:51 +03:00
$QuicInterop = Join-Path $RootDir " \artifacts\bin\windows\ $( $Arch ) _ $( $Config ) _ $( $Tls ) \quicinterop.exe "
2021-02-12 21:58:41 +03:00
} elseif ( $IsLinux ) {
2020-07-17 22:25:51 +03:00
$QuicInterop = Join-Path $RootDir " /artifacts/bin/linux/ $( $Arch ) _ $( $Config ) _ $( $Tls ) /quicinterop "
2021-02-12 21:58:41 +03:00
} elseif ( $IsMacOS ) {
$QuicInterop = Join-Path $RootDir " /artifacts/bin/macos/ $( $Arch ) _ $( $Config ) _ $( $Tls ) /quicinterop "
} else {
Write-Error " Unsupported platform type! "
2020-05-13 05:08:05 +03:00
}
# Make sure the build is present.
if ( ! ( Test-Path $QuicInterop ) ) {
Write-Error " Build does not exist! `n `n Run the following to generate it: `n `n $( Join-Path $RootDir " scripts " " build.ps1 " ) -Config $Config -Arch $Arch -Tls $Tls `n "
}
# Build up all the arguments to pass to the Powershell script.
$Arguments = " -Path $( $QuicInterop ) -ShowOutput "
if ( $KeepOutputOnSuccess ) {
$Arguments + = " -KeepOutputOnSuccess "
}
if ( $GenerateXmlResults ) {
$Arguments + = " -GenerateXmlResults "
}
if ( $Debugger ) {
$Arguments + = " -Debugger "
}
2020-11-13 06:13:47 +03:00
if ( $InitialBreak ) {
$Arguments + = " -InitialBreak "
}
2020-05-13 05:08:05 +03:00
if ( " None " -ne $LogProfile ) {
2020-08-10 22:37:19 +03:00
$Arguments + = " -LogProfile $( $LogProfile ) "
2020-05-13 05:08:05 +03:00
}
2021-05-14 02:14:58 +03:00
if ( $AZP ) {
$Arguments + = " -AZP "
}
2020-05-13 05:08:05 +03:00
2023-07-05 22:08:43 +03:00
if ( $GHA ) {
$Arguments + = " -GHA "
}
2020-06-06 02:17:10 +03:00
$ExtraArgs = " "
if ( $Target -ne " " ) {
$ExtraArgs + = " -target: $Target "
}
if ( $Custom -ne " " ) {
$ExtraArgs + = " -custom: $Custom "
}
if ( $Port -ne " " ) {
$ExtraArgs + = " -port: $Port "
}
if ( $Test -ne " " ) {
$ExtraArgs + = " -test: $Test "
}
2020-06-09 22:12:59 +03:00
if ( $Version -ne " " ) {
$ExtraArgs + = " -version: $Version "
}
2020-06-09 00:11:25 +03:00
if ( $Serial ) {
$ExtraArgs + = " -serial "
}
2020-09-05 04:01:14 +03:00
if ( $UrlPath -ne " " ) {
$ExtraArgs + = " -urlpath: $UrlPath "
}
2020-06-06 02:17:10 +03:00
if ( $ExtraArgs -ne " " ) {
$Arguments + = " -Arguments `" $ExtraArgs `" "
}
2020-05-13 05:08:05 +03:00
# Run the script.
Invoke-Expression ( $RunExecutable + " " + $Arguments )