This commit is contained in:
Nick Banks 2022-03-11 16:08:56 -05:00 коммит произвёл GitHub
Родитель 1f2e91a5fa
Коммит f7f4115943
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
29 изменённых файлов: 412 добавлений и 390 удалений

Просмотреть файл

@ -29,7 +29,6 @@ stages:
platform: windows
tls: schannel
logProfile: Full.Light
testCerts: true
#
# Build Verification Tests (Kernel Mode)
@ -47,7 +46,6 @@ stages:
logProfile: Full.Light
extraArgs: -Kernel -Filter -*NthAllocFail*
kernel: true
testCerts: true
#
# Windows Release BVTs
@ -83,4 +81,3 @@ stages:
config: Release
kernel: true
extraArgs: -Kernel
testCerts: true

Просмотреть файл

@ -29,7 +29,6 @@ stages:
platform: windows
tls: schannel
logProfile: Full.Light
testCerts: true
#
# Build Verification Tests (Kernel Mode)
@ -47,7 +46,6 @@ stages:
logProfile: Full.Light
extraArgs: -Kernel -Filter -*NthAllocFail*
kernel: true
testCerts: true
#
# Windows Release BVTs
@ -83,4 +81,3 @@ stages:
config: Release
kernel: true
extraArgs: -Kernel
testCerts: true

Просмотреть файл

@ -123,7 +123,7 @@ stages:
tls: schannel
config: Release
extraName: 'xdp'
extraPrepareArgs: -Xdp
extraPrepareArgs: -InstallXdpSdk
extraBuildArgs: -EnableTelemetryAsserts -UseXdp -ExtraArtifactDir xdp
- template: ./templates/build-config-user.yml
parameters:
@ -133,7 +133,7 @@ stages:
tls: openssl
config: Release
extraName: 'xdp'
extraPrepareArgs: -Xdp
extraPrepareArgs: -InstallXdpSdk
extraBuildArgs: -EnableTelemetryAsserts -UseXdp -ExtraArtifactDir xdp
- stage: build_windows_debug
@ -200,7 +200,7 @@ stages:
tls: schannel
config: Debug
extraName: 'xdp'
extraPrepareArgs: -Xdp
extraPrepareArgs: -InstallXdpSdk
extraBuildArgs: -EnableTelemetryAsserts -UseXdp -ExtraArtifactDir Xdp
- stage: build_windows_nontest
@ -241,6 +241,7 @@ stages:
platform: uwp
arch: x64
tls: schannel
extraPrepareArgs: -DisableTest
extraBuildArgs: -DisableTools -DisableTest -EnableTelemetryAsserts
- template: ./templates/build-config-user.yml
parameters:
@ -248,6 +249,7 @@ stages:
platform: uwp
arch: x64
tls: openssl
extraPrepareArgs: -DisableTest
extraBuildArgs: -DisableTools -DisableTest -EnableTelemetryAsserts
- template: ./templates/build-config-user.yml
parameters:
@ -255,6 +257,7 @@ stages:
platform: uwp
arch: x86
tls: openssl
extraPrepareArgs: -DisableTest
extraBuildArgs: -DisableTools -DisableTest -EnableTelemetryAsserts
- template: ./templates/build-config-user.yml
parameters:
@ -262,6 +265,7 @@ stages:
platform: uwp
arch: arm64
tls: openssl
extraPrepareArgs: -DisableTest
extraBuildArgs: -DisableTools -DisableTest -EnableTelemetryAsserts
- template: ./templates/build-config-user.yml
parameters:
@ -507,7 +511,7 @@ stages:
tls: schannel
logProfile: Full.Light
config: Release
extraArgs: -SkipUnitTests -EnableTcpipVerifier -Filter -*ValidateConfiguration:*ValidAlpnLengths:*ResumeRejection*:*ConnectClientCertificate*
extraTestArgs: -SkipUnitTests -EnableTcpipVerifier -Filter -*ValidateConfiguration:*ValidAlpnLengths:*ResumeRejection*:*ConnectClientCertificate*
- template: ./templates/run-bvt.yml
parameters:
pool: MsQuic-Win-Latest
@ -515,14 +519,14 @@ stages:
tls: schannel
logProfile: Full.Light
config: Release
extraArgs: -SkipUnitTests -EnableTcpipVerifier
extraTestArgs: -SkipUnitTests -EnableTcpipVerifier
- template: ./templates/run-bvt.yml
parameters:
image: ubuntu-latest
platform: linux
tls: openssl
config: Release
extraArgs: -Filter -*CredValidation*
extraTestArgs: -Filter -*CredValidation*
- stage: test_bvt_winkernel_release
displayName: BVT Windows Kernel Release
@ -538,8 +542,7 @@ stages:
logProfile: Full.Light
config: Release
kernel: true
testCerts: true
extraArgs: -Kernel -Filter -*ValidateConfiguration:*ValidAlpnLengths:*ResumeRejection*:*ClientCertificate*:*LoadBalanced*
extraTestArgs: -Kernel -Filter -*ValidateConfiguration:*ValidAlpnLengths:*ResumeRejection*:*ClientCertificate*:*LoadBalanced*
- template: ./templates/run-bvt.yml
parameters:
pool: MsQuic-Win-Latest
@ -548,8 +551,7 @@ stages:
logProfile: Full.Light
config: Release
kernel: true
testCerts: true
extraArgs: -Kernel
extraTestArgs: -Kernel
#
# Kernel Build Verification Tests
@ -567,18 +569,16 @@ stages:
platform: windows
tls: schannel
logProfile: Full.Light
extraArgs: -Kernel -Filter -*ValidateConfiguration:*ValidAlpnLengths:*ResumeRejection*:*ClientCertificate*:*LoadBalanced*:*NthAllocFail*
extraTestArgs: -Kernel -Filter -*ValidateConfiguration:*ValidAlpnLengths:*ResumeRejection*:*ClientCertificate*:*LoadBalanced*:*NthAllocFail*
kernel: true
testCerts: true
- template: ./templates/run-bvt.yml
parameters:
pool: MsQuic-Win-Latest
platform: windows
tls: schannel
logProfile: Full.Light
extraArgs: -Kernel -Filter -*NthAllocFail*
extraTestArgs: -Kernel -Filter -*NthAllocFail*
kernel: true
testCerts: true
#
# Build Verification Tests
@ -597,65 +597,63 @@ stages:
platform: windows
tls: schannel
logProfile: Full.Light
testCerts: true
extraArgs: -Filter -*ValidateConfiguration:*ValidAlpnLengths:*ResumeRejection*:*ClientCertificate*:*LoadBalanced*
extraTestArgs: -Filter -*ValidateConfiguration:*ValidAlpnLengths:*ResumeRejection*:*ClientCertificate*:*LoadBalanced*
- template: ./templates/run-bvt.yml
parameters:
pool: MsQuic-Win-Latest
platform: windows
tls: schannel
logProfile: Full.Light
testCerts: true
- template: ./templates/run-bvt.yml
parameters:
image: windows-2022
platform: windows
tls: schannel
logProfile: Full.Light
testCerts: true
extraArtifactDir: '_Xdp'
extraArgs: -DuoNic -ExtraArtifactDir Xdp
extraPrepareArgs: -InstallDuoNic
extraTestArgs: -DuoNic -ExtraArtifactDir Xdp
- template: ./templates/run-bvt.yml
parameters:
image: windows-2019
platform: windows
tls: openssl
logProfile: Full.Light
extraArgs: -Filter -*Unreachable/0:CredValidation*:*NthAllocFail*
extraTestArgs: -Filter -*Unreachable/0:CredValidation*:*NthAllocFail*
- template: ./templates/run-bvt.yml
parameters:
image: windows-2022
platform: windows
tls: openssl
logProfile: Full.Light
extraArgs: -Filter -*CredValidation*:*NthAllocFail*
extraTestArgs: -Filter -*CredValidation*:*NthAllocFail*
- template: ./templates/run-bvt.yml
parameters:
image: ubuntu-latest
platform: linux
tls: openssl
extraArgs: -Filter -*CredValidation*
extraTestArgs: -Filter -*CredValidation*
- template: ./templates/run-bvt.yml
parameters:
image: ubuntu-latest
platform: linux
tls: openssl
extraArtifactDir: '_Sanitize'
extraArgs: -Filter -*CredValidation* -ExtraArtifactDir Sanitize
extraTestArgs: -Filter -*CredValidation* -ExtraArtifactDir Sanitize
- template: ./templates/run-bvt.yml
parameters:
image: macOS-10.15
platform: macos
tls: openssl
logProfile: None
extraArgs: -Filter -*CredValidation* -ErrorsAsWarnings
extraTestArgs: -Filter -*CredValidation* -ErrorsAsWarnings
- template: ./templates/run-bvt.yml
parameters:
image: ubuntu-latest
platform: linux
tls: openssl
extraArtifactDir: '_SystemCrypto'
extraArgs: -Filter -*CredValidation* -ExtraArtifactDir SystemCrypto
extraTestArgs: -Filter -*CredValidation* -ExtraArtifactDir SystemCrypto
#
# SpinQuic Tests
@ -699,7 +697,7 @@ stages:
tls: openssl
allocFail: 100
extraArtifactDir: '_Sanitize'
extraArgs: -ExtraArtifactDir Sanitize
extraTestArgs: -ExtraArtifactDir Sanitize
- template: ./templates/run-spinquic.yml
parameters:
image: ubuntu-latest
@ -755,8 +753,8 @@ stages:
pool: MsQuic-Win-Latest
platform: windows
tls: schannel
testCerts: true
codeCoverage: true
extraPrepareArgs: -InstallCodeCoverage
- template: ./templates/run-spinquic.yml
parameters:
pool: MsQuic-Win-Latest
@ -764,6 +762,7 @@ stages:
tls: schannel
allocFail: 100
codeCoverage: true
extraPrepareArgs: -InstallCodeCoverage
- template: ./templates/merge-publish-coverage.yml
parameters:
image: windows-2019

Просмотреть файл

@ -135,6 +135,7 @@ stages:
arch: ${{ parameters.arch }}
tls: schannel
config: Release
extraPrepareArgs: -DisableTest
${{ if eq(parameters.pgo_mode, false) }}:
extraBuildArgs: -DisableTest -DisableTools
${{ if eq(parameters.pgo_mode, true) }}:
@ -154,6 +155,7 @@ stages:
arch: ${{ parameters.arch }}
tls: openssl
config: Release
extraPrepareArgs: -DisableTest
${{ if eq(parameters.pgo_mode, false) }}:
extraBuildArgs: -DisableTest -DisableTools
${{ if eq(parameters.pgo_mode, true) }}:
@ -173,6 +175,7 @@ stages:
arch: ${{ parameters.arch }}
tls: openssl
config: Release
extraPrepareArgs: -DisableTest
extraBuildArgs: -DisableTest -DisableTools
#

Просмотреть файл

@ -34,6 +34,7 @@ stages:
arch: x64
tls: schannel
config: Release
extraPrepareArgs: -DisableTest
extraBuildArgs: -DisableTest -DisableTools
- template: ./templates/build-config-winkernel.yml
parameters:

Просмотреть файл

@ -81,7 +81,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration Build
arguments: -ForBuild
- task: PowerShell@2
displayName: Distribution

Просмотреть файл

@ -14,7 +14,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration OneBranchPackage
arguments: -ForOneBranchPackage
- task: DownloadPipelineArtifact@2
inputs:
artifact: drop_build_linux_build_linux_openssl_Debug

Просмотреть файл

@ -19,7 +19,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration OneBranch -InitSubmodules -Tls ${{ parameters.tls }} -FailOnError -Extra '${{ parameters.extraBuildArgs }}'
arguments: -Tls ${{ parameters.tls }} -ForOneBranch -InitSubmodules
- task: PowerShell@2
displayName: x64
target: linux_build_container

Просмотреть файл

@ -10,7 +10,6 @@ parameters:
kernel: false
logProfile: 'Basic.Light'
extraArgs: ''
testCerts: false
jobs:
- job: bvt_${{ parameters.platform }}_${{ parameters.arch }}_${{ parameters.tls }}_${{ parameters.kernel }}
@ -45,18 +44,11 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
${{ if and(eq(parameters.kernel, true), eq(parameters.testCerts, true)) }}:
arguments: -Configuration Test -TestCertificates -SignCode
${{ if and(eq(parameters.kernel, false), eq(parameters.testCerts, true)) }}:
arguments: -Configuration Test -TestCertificates
${{ if eq(parameters.testCerts, false) }}:
arguments: -Configuration Test
arguments: -ForTest
- task: PowerShell@2
displayName: Run BVTs
timeoutInMinutes: 60
${{ if eq(parameters.codeCoverage, true) }}:
continueOnError: true
inputs:
pwsh: true
filePath: scripts/test.ps1

Просмотреть файл

@ -51,7 +51,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration Build -InitSubmodules -Tls ${{ parameters.tls }} -FailOnError -Extra '${{ parameters.extraBuildArgs }}' ${{ parameters.extraPrepareArgs }}
arguments: -Tls ${{ parameters.tls }} -ForBuild ${{ parameters.extraPrepareArgs }}
- task: PowerShell@2
displayName: Build Source Code (Debug)

Просмотреть файл

@ -18,7 +18,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration Build -InitSubmodules -Tls schannel -Kernel -FailOnError
arguments: -ForBuild -ForKernel
- task: NuGetCommand@2
displayName: Nuget Restore

Просмотреть файл

@ -86,7 +86,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration Build
arguments: -ForBuild
- task: PowerShell@2
displayName: Package Distribution

Просмотреть файл

@ -76,7 +76,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration Build
arguments: -ForBuild
- task: PowerShell@2
displayName: Package Nuget

Просмотреть файл

@ -26,7 +26,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration Test
arguments: -ForTest -InstallCodeCoverage
- task: DownloadBuildArtifacts@0
displayName: Download Build Artifacts

Просмотреть файл

@ -10,8 +10,8 @@ parameters:
kernel: false
codeCoverage: false
logProfile: 'Basic.Light'
extraArgs: ''
testCerts: false
extraPrepareArgs: ''
extraTestArgs: ''
extraArtifactDir: ''
jobs:
@ -42,14 +42,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
${{ if and(eq(parameters.kernel, true), eq(parameters.testCerts, true)) }}:
arguments: -Configuration Test -TestCertificates -SignCode
${{ if and(eq(parameters.kernel, false), eq(parameters.testCerts, true), eq(parameters.extraArtifactDir, '_Xdp')) }}:
arguments: -Configuration Test -TestCertificates -DuoNic
${{ if and(eq(parameters.kernel, false), eq(parameters.testCerts, true), ne(parameters.extraArtifactDir, '_Xdp')) }}:
arguments: -Configuration Test -TestCertificates
${{ if eq(parameters.testCerts, false) }}:
arguments: -Configuration Test
arguments: -ForTest ${{ parameters.extraPrepareArgs }}
- task: PowerShell@2
displayName: Run BVTs
@ -60,9 +53,9 @@ jobs:
pwsh: true
filePath: scripts/test.ps1
${{ if eq(parameters.codeCoverage, true) }}:
arguments: -NoProgress -IsolationMode Batch -CodeCoverage -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }} ${{ parameters.extraArgs }}
arguments: -NoProgress -IsolationMode Batch -CodeCoverage -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }} ${{ parameters.extraTestArgs }}
${{ if eq(parameters.codeCoverage, false) }}:
arguments: -AZP -NoProgress -LogProfile ${{ parameters.logProfile }} -GenerateXmlResults -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }} ${{ parameters.extraArgs }}
arguments: -AZP -NoProgress -LogProfile ${{ parameters.logProfile }} -GenerateXmlResults -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }} ${{ parameters.extraTestArgs }}
- template: ./upload-test-artifacts.yml
parameters:

Просмотреть файл

@ -38,7 +38,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration Test
arguments: -ForTest
- task: PowerShell@2
displayName: Run Lang Interop

Просмотреть файл

@ -53,13 +53,6 @@ jobs:
tls: ${{ parameters.remoteTls }}
includeKernel: ${{ ne(parameters.kernelMode, '') }}
- task: PowerShell@2
displayName: Prepare Test Machine
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration Test
- task: PowerShell@2
condition: contains('${{ parameters.testTypes }}', 'Remote')
displayName: Run Performance Test

Просмотреть файл

@ -34,7 +34,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration Test
arguments: -ForTest
- task: PowerShell@2
displayName: Run QuicInterop

Просмотреть файл

@ -11,7 +11,8 @@ parameters:
timeout: 600000
repeat: 20
codeCoverage: false
extraArgs: ''
extraPrepareArgs: ''
extraTestArgs: ''
extraArtifactDir: ''
jobs:
@ -41,7 +42,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Configuration Test
arguments: -ForTest ${{ parameters.extraPrepareArgs }}
- task: PowerShell@2
displayName: Run SpinQuic
@ -50,9 +51,9 @@ jobs:
pwsh: true
filePath: scripts/spin.ps1
${{ if eq(parameters.codeCoverage, true) }}:
arguments: -GenerateXmlResults -Timeout ${{ parameters.timeout }} -RepeatCount ${{ parameters.repeat }} -AllocFail ${{ parameters.allocFail }} -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }} -CodeCoverage -LogProfile Basic.Light ${{ parameters.extraArgs }}
arguments: -GenerateXmlResults -Timeout ${{ parameters.timeout }} -RepeatCount ${{ parameters.repeat }} -AllocFail ${{ parameters.allocFail }} -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }} -CodeCoverage -LogProfile Basic.Light ${{ parameters.extraTestArgs }}
${{ if eq(parameters.codeCoverage, false) }}:
arguments: -AZP -GenerateXmlResults -Timeout ${{ parameters.timeout }} -RepeatCount ${{ parameters.repeat }} -AllocFail ${{ parameters.allocFail }} -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }} ${{ parameters.extraArgs }}
arguments: -AZP -GenerateXmlResults -Timeout ${{ parameters.timeout }} -RepeatCount ${{ parameters.repeat }} -AllocFail ${{ parameters.allocFail }} -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }} ${{ parameters.extraTestArgs }}
- template: ./upload-test-artifacts.yml
parameters:

2
.github/workflows/cargo.yml поставляемый
Просмотреть файл

@ -28,7 +28,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
- name: Prepare Machine
run: scripts/prepare-machine.ps1 -Configuration Build -InitSubmodules -Tls openssl -FailOnError
run: scripts/prepare-machine.ps1 -Tls openssl -ForBuild
shell: pwsh
- name: Install Perl
if: runner.os == 'Windows'

2
.github/workflows/check-clog.yml поставляемый
Просмотреть файл

@ -30,7 +30,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
- name: Prepare Machine
run: scripts/prepare-machine.ps1 -Configuration Dev
run: scripts/prepare-machine.ps1
shell: pwsh
- name: Run CLOG Update
run: scripts/update-sidecar.ps1

2
.github/workflows/check-dotnet.yml поставляемый
Просмотреть файл

@ -30,7 +30,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
- name: Prepare Machine
run: scripts/prepare-machine.ps1 -Configuration Dev
run: scripts/prepare-machine.ps1
shell: pwsh
- name: Run DotNet Update
run: scripts/generate-dotnet.ps1

2
.github/workflows/test-down-level.yml поставляемый
Просмотреть файл

@ -36,7 +36,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
- name: Prepare Machine
run: scripts/prepare-machine.ps1 -Configuration Dev -Tls ${{ matrix.tls }} -InitSubmodules -TestCertificates -FailOnError
run: scripts/prepare-machine.ps1 -Tls ${{ matrix.tls }} -DisableTest
shell: pwsh
- name: Build Release
shell: pwsh

4
.github/workflows/wan-perf.yml поставляемый
Просмотреть файл

@ -47,7 +47,7 @@ jobs:
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
- name: Prepare Machine
shell: pwsh
run: scripts/prepare-machine.ps1 -Configuration Build -InitSubmodules -Extra "-DisableTest -DisableTools"
run: scripts/prepare-machine.ps1 -ForBuild -DisableTest
- name: Prepare Machine
shell: pwsh
run: scripts/build.ps1 -Config Release -DisableTest -DisableTools
@ -98,7 +98,7 @@ jobs:
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
- name: Prepare Machine
shell: pwsh
run: scripts/prepare-machine.ps1 -Configuration Test -DuoNic -NoCodeCoverage
run: scripts/prepare-machine.ps1 -ForTest -InstallDuoNic
- uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741
with:
name: bin

Просмотреть файл

@ -93,7 +93,7 @@ After installing .NET Core, you will need to restart your terminal.
For the very first time you build, it's recommend to make sure you have all the dependencies installed. You can ensure this by running:
```PowerShell
./scripts/prepare-machine.ps1 -Configuration Dev
./scripts/prepare-machine.ps1
```
Note at minimum CMake 3.20 on windows and 3.16 on other platforms is required. Instructions for installing the newest version on Ubuntu can be found here. https://apt.kitware.com/. The prepare-machine script will not do this for you.

Просмотреть файл

@ -14,7 +14,7 @@ On Windows, MsQuic leverages manifested [ETW](https://docs.microsoft.com/en-us/w
### Linux
On Linux, MsQuic leverages [LTTng](https://lttng.org/features/) for its logging. Some dependencies, such as babeltrace, lttng, and clog2text_lttng are required. The simplest way to install all dependencies is by running `./scripts/prepare-machine.ps1 -Configuration Test`, but if you only want to collect the traces on the machine, the **minimal dependencies** are:
On Linux, MsQuic leverages [LTTng](https://lttng.org/features/) for its logging. Some dependencies, such as babeltrace, lttng, and clog2text_lttng are required. The simplest way to install all dependencies is by running `./scripts/prepare-machine.ps1 -ForTest`, but if you only want to collect the traces on the machine, the **minimal dependencies** are:
```
sudo apt-add-repository ppa:lttng/stable-2.12

Просмотреть файл

@ -5,13 +5,7 @@
First [build](./BUILD.md). Then prepare the machine:
```PowerShell
.\scripts\prepare-machine.ps1 -Configuration Test -TestCertificates
```
If not testing on Windows, omit `-TestCertificates`:
```PowerShell
.\scripts\prepare-machine.ps1 -Configuration Test
.\scripts\prepare-machine.ps1 -ForTest
```
Then all the tests can be run with:

Просмотреть файл

@ -4,134 +4,153 @@
This script installs all necessary dependencies on the machine, depending
on the provided configuration.
.PARAMETER Configuration
The type of configuration to install dependencies for.
.PARAMETER Tls
The TLS library in use.
.PARAMETER Force
Overwrite and force installation of all dependencies.
.PARAMETER InitSubmodules
Dynamically initializes submodules based Tls and Extra configuration knobs.
.PARAMETER Tls
The TLS library in use.
.PARAMETER Extra
Any extra build flags being used.
.PARAMETER Kernel
.PARAMETER ForKernel
Indicates build is for kernel mode.
.PARAMETER TestCertificates
Generate test certificates. Only supported for Windows test configuration.
.PARAMETER InstallTestCertificates
Generate test certificates. Only supported on Windows.
.PARAMETER SignCode
.PARAMETER InstallSigningCertificates
Generate a code signing certificate for kernel driver tests.
.EXAMPLE
prepare-machine.ps1 -Configuration Build
prepare-machine.ps1
.EXAMPLE
prepare-machine.ps1 -Configuration Test
prepare-machine.ps1 -ForBuild
.EXAMPLE
prepare-machine.ps1 -ForTest
#>
param (
[Parameter(Mandatory = $true)]
[ValidateSet("Build", "Test", "Dev", "OneBranch", "OneBranchPackage")]
[string]$Configuration,
[Parameter(Mandatory = $false)]
[string]$Tls = "",
[Parameter(Mandatory = $false)]
[switch]$Force,
[Parameter(Mandatory = $false)]
[switch]$ForOneBranch,
[Parameter(Mandatory = $false)]
[switch]$ForOneBranchPackage,
[Parameter(Mandatory = $false)]
[switch]$ForBuild,
[Parameter(Mandatory = $false)]
[switch]$ForTest,
[Parameter(Mandatory = $false)]
[switch]$ForKernel,
[Parameter(Mandatory = $false)]
[switch]$InitSubmodules,
[Parameter(Mandatory = $false)]
[string]$Tls = "",
[switch]$InstallSigningCertificate,
[Parameter(Mandatory = $false)]
[string]$Extra = "",
[switch]$InstallTestCertificates,
[Parameter(Mandatory = $false)]
[switch]$Kernel,
[switch]$InstallDuoNic,
[Parameter(Mandatory = $false)]
[switch]$FailOnError,
[switch]$InstallCodeCoverage,
[Parameter(Mandatory = $false)]
[switch]$TestCertificates,
[switch]$InstallNasm,
[Parameter(Mandatory = $false)]
[switch]$SignCode,
[switch]$InstallJom,
[Parameter(Mandatory = $false)]
[switch]$DuoNic,
[switch]$InstallXdpSdk,
[Parameter(Mandatory = $false)]
[switch]$NoCodeCoverage,
[Parameter(Mandatory = $false)]
[switch]$Xdp,
[Parameter(Mandatory = $false)]
[switch]$Force
[switch]$DisableTest
)
# Admin is required because a lot of things are installed to the local machine
# in the script.
#Requires -RunAsAdministrator
Set-StrictMode -Version 'Latest'
$PSDefaultParameterValues['*:ErrorAction'] = 'Stop'
$ProgressPreference = 'SilentlyContinue'
# Root directory of the project.
$RootDir = Split-Path $PSScriptRoot -Parent
$NuGetPath = Join-Path $RootDir "nuget"
$MessagesAtEnd = New-Object Collections.Generic.List[string]
if ($PSVersionTable.PSVersion.Major -lt 7) {
Write-Error ("`nPowerShell v7.x is needed for this script to work. " +
# This script requires PowerShell core (mostly for xplat stuff).
Write-Error ("`nPowerShell v7.x or greater is needed for this script to work. " +
"Please visit https://github.com/microsoft/msquic/blob/main/docs/BUILD.md#powershell-usage")
}
if ($InitSubmodules) {
# Default TLS based on current platform.
if ("" -eq $Tls) {
if ($IsWindows) {
$Tls = "schannel"
} else {
$Tls = "openssl"
}
}
if ($Tls -eq "openssl") {
Write-Host "Initializing openssl submodule"
git submodule init submodules/openssl
git submodule update
}
if ($Kernel) {
# Remove OpenSSL
git rm submodules/openssl
}
if (!$Extra.Contains("-DisableTest")) {
Write-Host "Initializing googletest submodule"
git submodule init submodules/googletest
git submodule update
}
if (!$ForOneBranch -and !$ForOneBranchPackage -and !$ForBuild -and !$ForTest) {
# When no args are passed, assume we want to build and test everything
# locally (i.e. a dev environment). Set Tls to OpenSSL to make sure
# everything is available.
Write-Host "No arguments passed, defaulting -ForBuild and -ForTest"
$ForBuild = $true
$ForTest = $true
if ("" -eq $Tls -and !$ForKernel) { $Tls = "openssl" }
}
Write-Host "Initializing clog submodule"
git submodule init submodules/clog
git submodule update
if ($ForBuild) {
# When configured for building, make sure we have all possible dependencies
# enabled for any possible build.
$InstallNasm = $true
$InstallJom = $true
$InstallXdpSdk = $true
$InitSubmodules = $true
}
if ($ForTest) {
# When configured for testing, make sure we have all possible dependencies
# enabled for any possible test.
$InstallSigningCertificate = $true
$InstallTestCertificates = $true
#$InstallCodeCoverage = $true # Ideally we'd enable this by default, but it
# hangs sometimes, so we only want to install
# for jobs that absoultely need it.
}
# 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
$ArtifactsPath = Join-Path $RootDir "artifacts"
if (!(Test-Path $ArtifactsPath)) { mkdir $ArtifactsPath }
# Directory for the corenet CI install.
$CoreNetCiPath = Join-Path $ArtifactsPath "corenet-ci-main"
$SetupPath = Join-Path $CoreNetCiPath "vm-setup"
# Generic, default password for test certificates.
$PfxPassword = ConvertTo-SecureString -String "placeholder" -Force -AsPlainText
# Downloads and caches the latest version of the corenet-ci-main repo.
function Download-CoreNet-Deps {
# Download and extract https://github.com/microsoft/corenet-ci.
if (!(Test-Path $ArtifactsPath)) { mkdir $ArtifactsPath }
if ($Force) { rm -Force -Recurse $CoreNetCiPath -ErrorAction Ignore }
if (!(Test-Path $CoreNetCiPath)) {
Write-Host "Downloading CoreNet-CI"
$ZipPath = Join-Path $ArtifactsPath "corenet-ci.zip"
Invoke-WebRequest -Uri "https://github.com/microsoft/corenet-ci/archive/refs/heads/main.zip" -OutFile $ZipPath
Expand-Archive -Path $ZipPath -DestinationPath $ArtifactsPath -Force
@ -139,12 +158,13 @@ function Download-CoreNet-Deps {
}
}
function Download-Xdp-Kit {
if ($Force) { rm -Force -Recurse $ArtifactsPath }
if (!(Test-Path $ArtifactsPath)) { mkdir $ArtifactsPath }
# Downloads the latest version of XDP (for building).
function Install-Xdp-Sdk {
if (!$IsWindows) { return } # Windows only
$XdpPath = Join-Path $ArtifactsPath "xdp"
if ($Force) { rm -Force -Recurse $XdpPath -ErrorAction Ignore }
if (!(Test-Path $XdpPath)) {
Write-Host "Downloading XDP Kit"
Write-Host "Downloading XDP"
$ZipPath = Join-Path $ArtifactsPath "xdp.zip"
Invoke-WebRequest -Uri "https://lolafiles.blob.core.windows.net/nibanks/xdp-latest.zip" -OutFile $ZipPath
Expand-Archive -Path $ZipPath -DestinationPath $XdpPath -Force
@ -154,13 +174,13 @@ function Download-Xdp-Kit {
# Installs DuoNic from the CoreNet-CI repo.
function Install-DuoNic {
if (!$IsWindows) { return } # Windows only
# Check to see if test signing is enabled.
$HasTestSigning = $false
try { $HasTestSigning = ("$(bcdedit)" | Select-String -Pattern "testsigning\s+Yes").Matches.Success } catch { }
if (!$HasTestSigning) { Write-Error "Test Signing Not Enabled!" }
# Download the CI repo that contains DuoNic.
Write-Host "Downloading CoreNet-CI"
Download-CoreNet-Deps
# Install the test root certificate.
@ -177,239 +197,271 @@ function Install-DuoNic {
Invoke-Expression "cmd /c `"pushd $DuoNicPath && pwsh duonic.ps1 -Install`""
}
if ($IsWindows) {
function Update-Path($NewPath) {
Write-Host "Updating PATH"
$CurrentSystemPath = [Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::Machine)
$CurrentSystemPath = "$CurrentSystemPath;$NewPath"
$env:PATH = "${env:PATH};$NewPath"
[Environment]::SetEnvironmentVariable("PATH", $CurrentSystemPath, [System.EnvironmentVariableTarget]::Machine)
Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH}"
Write-Host "PATH has been updated. You'll need to restart your terminal for this to take affect."
}
if ($Configuration -eq "Dev") {
# TODO - Support installing VS and necessary addins
# TODO - Install CMake
# TODO - Check for Windows preview
# Installs NASM from the public release.
function Install-NASM {
if (!$IsWindows) { return } # Windows only
$NasmVersion = "2.15.05"
$NasmPath = Join-Path $env:Programfiles "nasm-$NasmVersion"
$NasmExe = Join-Path $NasmPath "nasm.exe"
if ($Force) { rm -Force -Recurse $NasmPath -ErrorAction Ignore }
if (!(Test-Path $NasmExe) -and $env:GITHUB_PATH -eq $null) {
Write-Host "Downloading NASM"
$NasmArch = "win64"
if (![System.Environment]::Is64BitOperatingSystem) { $NasmArch = "win32" }
try {
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/$NasmVersion/win64/nasm-$NasmVersion-$NasmArch.zip" -OutFile "artifacts\nasm.zip"
} catch {
# Mirror fallback
Invoke-WebRequest -Uri "https://fossies.org/windows/misc/nasm-$NasmVersion-$NasmArch.zip" -OutFile "artifacts\nasm.zip"
}
Write-Host "Extracting/installing NASM"
Expand-Archive -Path "artifacts\nasm.zip" -DestinationPath $env:Programfiles -Force
Remove-Item -Path "artifacts\nasm.zip"
Update-Path $NasmPath
}
}
# Installs JOM from the public release.
function Install-JOM {
if (!$IsWindows) { return } # Windows only
$JomVersion = "1_1_3"
$JomPath = Join-Path $env:Programfiles "jom_$JomVersion"
$JomExe = Join-Path $JomPath "jom.exe"
if (!(Test-Path $JomExe) -and $env:GITHUB_PATH -eq $null) {
Write-Host "Downloading JOM"
try {
Invoke-WebRequest -Uri "https://qt.mirror.constant.com/official_releases/jom/jom_$JomVersion.zip" -OutFile "artifacts\jom.zip"
} catch {
# Mirror fallback
Invoke-WebRequest -Uri "https://mirrors.ocf.berkeley.edu/qt/official_releases/jom/jom_$JomVersion.zip" -OutFile "artifacts\jom.zip"
}
Write-Host "Extracting/installing JOM"
New-Item -Path $JomPath -ItemType Directory -Force
Expand-Archive -Path "artifacts\jom.zip" -DestinationPath $JomPath -Force
Remove-Item -Path "artifacts\jom.zip"
Update-Path $JomPath
}
}
# Installs OpenCppCoverage from the public release.
function Install-OpenCppCoverage {
if (!$IsWindows) { return } # Windows only
if (!(Test-Path "C:\Program Files\OpenCppCoverage\OpenCppCoverage.exe")) {
# Download the installer.
$Installer = $null
if ([System.Environment]::Is64BitOperatingSystem) {
$Installer = "OpenCppCoverageSetup-x64-0.9.9.0.exe"
} else {
$Installer = "OpenCppCoverageSetup-x86-0.9.9.0.exe"
}
$ExeFile = Join-Path $Env:TEMP $Installer
Write-Host "Downloading $Installer"
Invoke-WebRequest -Uri "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.9.0/$($Installer)" -OutFile $ExeFile
# Start the installer and wait for it to finish.
Write-Host "Installing $Installer"
Start-Process $ExeFile -Wait -ArgumentList {"/silent"} -NoNewWindow
Remove-Item -Path $ExeFile
}
}
# Checks the OS version number to see if it's recent enough (> 2019) to support
# the necessary features for creating and installing the test certificates.
function Win-SupportsCerts {
$ver = [environment]::OSVersion.Version
if ($ver.Build -lt 20000) { return $false }
return $true
}
# Creates and installs a certificate to use for local signing.
function Install-SigningCertificate {
if (!$IsWindows -or !(Win-SupportsCerts)) { return } # Windows only
if (!(Test-Path c:\CodeSign.pfx)) {
Write-Host "Creating signing certificate"
$CodeSignCert = New-SelfSignedCertificate -Type Custom -Subject "CN=MsQuicTestCodeSignRoot" -FriendlyName MsQuicTestCodeSignRoot -KeyUsageProperty Sign -KeyUsage DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -NotAfter(Get-Date).AddYears(1) -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.6","2.5.29.19 = {text}")
$CodeSignCertPath = Join-Path $Env:TEMP "CodeSignRoot.cer"
Export-Certificate -Type CERT -Cert $CodeSignCert -FilePath $CodeSignCertPath
CertUtil.exe -addstore Root $CodeSignCertPath
Export-PfxCertificate -Cert $CodeSignCert -Password $PfxPassword -FilePath c:\CodeSign.pfx
Remove-Item $CodeSignCertPath
Remove-Item $CodeSignCert.PSPath
}
}
# Creates and installs certificates used for testing.
function Install-TestCertificates {
if (!$IsWindows -or !(Win-SupportsCerts)) { return } # Windows only
$NewRoot = $false
Write-Host "Searching for MsQuicTestRoot certificate..."
$RootCert = Get-ChildItem -path Cert:\LocalMachine\Root\* -Recurse | Where-Object {$_.Subject -eq "CN=MsQuicTestRoot"}
if (!$RootCert) {
Write-Host "MsQuicTestRoot not found! Creating new MsQuicTestRoot certificate..."
$RootCert = New-SelfSignedCertificate -Subject "CN=MsQuicTestRoot" -FriendlyName MsQuicTestRoot -KeyUsageProperty Sign -KeyUsage CertSign,DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -KeyAlgorithm ECDSA_nistP521 -CurveExport CurveName -NotAfter(Get-Date).AddYears(5) -TextExtension @("2.5.29.19 = {text}ca=1&pathlength=0") -Type Custom
$TempRootPath = Join-Path $Env:TEMP "MsQuicTestRoot.cer"
Export-Certificate -Type CERT -Cert $RootCert -FilePath $TempRootPath
CertUtil.exe -addstore Root $TempRootPath
Remove-Item $TempRootPath
$NewRoot = $true
Write-Host "New MsQuicTestRoot certificate installed!"
} else {
Write-Host "Found existing MsQuicTestRoot certificate!"
}
if (($Configuration -eq "Dev") -or ($Configuration -eq "Build")) {
$NasmVersion = "2.15.05"
$NasmPath = Join-Path $env:Programfiles "nasm-$NasmVersion"
$NasmExe = Join-Path $NasmPath "nasm.exe"
if (!(Test-Path $NasmExe) -and $env:GITHUB_PATH -eq $null) {
New-Item -Path .\build -ItemType Directory -Force
$NasmArch = "win64"
if (![System.Environment]::Is64BitOperatingSystem) {
$NasmArch = "win32"
}
try {
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/$NasmVersion/win64/nasm-$NasmVersion-$NasmArch.zip" -OutFile "build\nasm.zip"
} catch {
# Mirror fallback
Invoke-WebRequest -Uri "https://fossies.org/windows/misc/nasm-$NasmVersion-$NasmArch.zip" -OutFile "build\nasm.zip"
}
Expand-Archive -Path "build\nasm.zip" -DestinationPath $env:Programfiles -Force
$CurrentSystemPath = [Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::Machine)
$CurrentSystemPath = "$CurrentSystemPath;$NasmPath"
$env:PATH = "${env:PATH};$NasmPath"
[Environment]::SetEnvironmentVariable("PATH", $CurrentSystemPath, [System.EnvironmentVariableTarget]::Machine)
Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH}"
Write-Host "PATH has been updated. You'll need to restart your terminal for this to take affect."
}
$JomVersion = "1_1_3"
$JomPath = Join-Path $env:Programfiles "jom_$JomVersion"
$JomExe = Join-Path $JomPath "jom.exe"
if (!(Test-Path $JomExe) -and $env:GITHUB_PATH -eq $null) {
New-Item -Path .\build -ItemType Directory -Force
try {
Invoke-WebRequest -Uri "https://qt.mirror.constant.com/official_releases/jom/jom_$JomVersion.zip" -OutFile "build\jom.zip"
} catch {
Invoke-WebRequest -Uri "https://mirrors.ocf.berkeley.edu/qt/official_releases/jom/jom_$JomVersion.zip" -OutFile "build\jom.zip"
}
New-Item -Path $JomPath -ItemType Directory -Force
Expand-Archive -Path "build\jom.zip" -DestinationPath $JomPath -Force
$CurrentSystemPath = [Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::Machine)
$CurrentSystemPath = "$CurrentSystemPath;$JomPath"
$env:PATH = "${env:PATH};$JomPath"
[Environment]::SetEnvironmentVariable("PATH", $CurrentSystemPath, [System.EnvironmentVariableTarget]::Machine)
Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH}"
Write-Host "PATH has been updated. You'll need to restart your terminal for this to take affect."
}
Write-Host "Searching for MsQuicTestServer certificate..."
$ServerCert = Get-ChildItem -path Cert:\LocalMachine\My\* -Recurse | Where-Object {$_.Subject -eq "CN=MsQuicTestServer"}
if (!$ServerCert) {
Write-Host "MsQuicTestServer not found! Creating new MsQuicTestServer certificate..."
$ServerCert = New-SelfSignedCertificate -Subject "CN=MsQuicTestServer" -DnsName $env:computername,localhost,"127.0.0.1","::1" -FriendlyName MsQuicTestServer -KeyUsageProperty Sign -KeyUsage DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -KeyAlgorithm ECDSA_nistP256 -CurveExport CurveName -NotAfter(Get-Date).AddYears(5) -TextExtension @("2.5.29.19 = {text}","2.5.29.37 = {text}1.3.6.1.5.5.7.3.1") -Signer $RootCert
$TempServerPath = Join-Path $Env:TEMP "MsQuicTestServerCert.pfx"
Export-PfxCertificate -Cert $ServerCert -Password $PfxPassword -FilePath $TempServerPath
Import-PfxCertificate -FilePath $TempServerPath -Password $PfxPassword -Exportable -CertStoreLocation Cert:\LocalMachine\My
Remove-Item $TempServerPath
Write-Host "New MsQuicTestServer certificate installed!"
} else {
Write-Host "Found existing MsQuicTestServer certificate!"
}
if ($Configuration -eq "Test" -or $Configuration -eq "Dev") {
$PfxPassword = ConvertTo-SecureString -String "placeholder" -Force -AsPlainText
if ($SignCode -and !(Test-Path c:\CodeSign.pfx)) {
$CodeSignCert = New-SelfSignedCertificate -Type Custom -Subject "CN=MsQuicTestCodeSignRoot" -FriendlyName MsQuicTestCodeSignRoot -KeyUsageProperty Sign -KeyUsage DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -NotAfter(Get-Date).AddYears(1) -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.6","2.5.29.19 = {text}")
$CodeSignCertPath = Join-Path $Env:TEMP "CodeSignRoot.cer"
Export-Certificate -Type CERT -Cert $CodeSignCert -FilePath $CodeSignCertPath
CertUtil.exe -addstore Root $CodeSignCertPath
Export-PfxCertificate -Cert $CodeSignCert -Password $PfxPassword -FilePath c:\CodeSign.pfx
Remove-Item $CodeSignCertPath
Remove-Item $CodeSignCert.PSPath
}
if ($TestCertificates) {
# Install test certificates on windows
$NewRoot = $false
Write-Host "Searching for MsQuicTestRoot certificate..."
$RootCert = Get-ChildItem -path Cert:\LocalMachine\Root\* -Recurse | Where-Object {$_.Subject -eq "CN=MsQuicTestRoot"}
if (!$RootCert) {
Write-Host "MsQuicTestRoot not found! Creating new MsQuicTestRoot certificate..."
$RootCert = New-SelfSignedCertificate -Subject "CN=MsQuicTestRoot" -FriendlyName MsQuicTestRoot -KeyUsageProperty Sign -KeyUsage CertSign,DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -KeyAlgorithm ECDSA_nistP521 -CurveExport CurveName -NotAfter(Get-Date).AddYears(5) -TextExtension @("2.5.29.19 = {text}ca=1&pathlength=0") -Type Custom
$TempRootPath = Join-Path $Env:TEMP "MsQuicTestRoot.cer"
Export-Certificate -Type CERT -Cert $RootCert -FilePath $TempRootPath
CertUtil.exe -addstore Root $TempRootPath
Remove-Item $TempRootPath
$NewRoot = $true
Write-Host "New MsQuicTestRoot certificate installed!"
} else {
Write-Host "Found existing MsQuicTestRoot certificate!"
}
Write-Host "Searching for MsQuicTestServer certificate..."
$ServerCert = Get-ChildItem -path Cert:\LocalMachine\My\* -Recurse | Where-Object {$_.Subject -eq "CN=MsQuicTestServer"}
if (!$ServerCert) {
Write-Host "MsQuicTestServer not found! Creating new MsQuicTestServer certificate..."
$ServerCert = New-SelfSignedCertificate -Subject "CN=MsQuicTestServer" -DnsName $env:computername,localhost,"127.0.0.1","::1" -FriendlyName MsQuicTestServer -KeyUsageProperty Sign -KeyUsage DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -KeyAlgorithm ECDSA_nistP256 -CurveExport CurveName -NotAfter(Get-Date).AddYears(5) -TextExtension @("2.5.29.19 = {text}","2.5.29.37 = {text}1.3.6.1.5.5.7.3.1") -Signer $RootCert
$TempServerPath = Join-Path $Env:TEMP "MsQuicTestServerCert.pfx"
Export-PfxCertificate -Cert $ServerCert -Password $PfxPassword -FilePath $TempServerPath
Import-PfxCertificate -FilePath $TempServerPath -Password $PfxPassword -Exportable -CertStoreLocation Cert:\LocalMachine\My
Remove-Item $TempServerPath
Write-Host "New MsQuicTestServer certificate installed!"
} else {
Write-Host "Found existing MsQuicTestServer certificate!"
}
Write-Host "Searching for MsQuicTestExpiredServer certificate..."
$ExpiredServerCert = Get-ChildItem -path Cert:\LocalMachine\My\* -Recurse | Where-Object {$_.Subject -eq "CN=MsQuicTestExpiredServer"}
if (!$ExpiredServerCert) {
Write-Host "MsQuicTestExpiredServer not found! Creating new MsQuicTestExpiredServer certificate..."
$ExpiredServerCert = New-SelfSignedCertificate -Subject "CN=MsQuicTestExpiredServer" -DnsName $env:computername,localhost,"127.0.0.1","::1" -FriendlyName MsQuicTestExpiredServer -KeyUsageProperty Sign -KeyUsage DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -KeyAlgorithm ECDSA_nistP256 -CurveExport CurveName -NotBefore (Get-Date).AddYears(-2) -NotAfter(Get-Date).AddYears(-1) -TextExtension @("2.5.29.19 = {text}","2.5.29.37 = {text}1.3.6.1.5.5.7.3.1") -Signer $RootCert
$TempExpiredServerPath = Join-Path $Env:TEMP "MsQuicTestExpiredServerCert.pfx"
Export-PfxCertificate -Cert $ExpiredServerCert -Password $PfxPassword -FilePath $TempExpiredServerPath
Import-PfxCertificate -FilePath $TempExpiredServerPath -Password $PfxPassword -Exportable -CertStoreLocation Cert:\LocalMachine\My
Remove-Item $TempExpiredServerPath
Write-Host "New MsQuicTestExpiredServer certificate installed!"
} else {
Write-Host "Found existing MsQuicTestExpiredServer certificate!"
}
Write-Host "Searching for MsQuicTestClient certificate..."
$ClientCert = Get-ChildItem -path Cert:\LocalMachine\My\* -Recurse | Where-Object {$_.Subject -eq "CN=MsQuicTestClient"}
if (!$ClientCert) {
Write-Host "MsQuicTestClient not found! Creating new MsQuicTestClient certificate..."
$ClientCert = New-SelfSignedCertificate -Subject "CN=MsQuicTestClient" -FriendlyName MsQuicTestClient -KeyUsageProperty Sign -KeyUsage DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -KeyAlgorithm ECDSA_nistP256 -CurveExport CurveName -NotAfter(Get-Date).AddYears(5) -TextExtension @("2.5.29.19 = {text}","2.5.29.37 = {text}1.3.6.1.5.5.7.3.2") -Signer $RootCert
$TempClientPath = Join-Path $Env:TEMP "MsQuicTestClientCert.pfx"
Export-PfxCertificate -Cert $ClientCert -Password $PfxPassword -FilePath $TempClientPath
Import-PfxCertificate -FilePath $TempClientPath -Password $PfxPassword -Exportable -CertStoreLocation Cert:\LocalMachine\My
Remove-Item $TempClientPath
Write-Host "New MsQuicTestClient certificate installed!"
}else {
Write-Host "Found existing MsQuicTestClient certificate!"
}
Write-Host "Searching for MsQuicTestExpiredClient certificate..."
$ExpiredClientCert = Get-ChildItem -path Cert:\LocalMachine\My\* -Recurse | Where-Object {$_.Subject -eq "CN=MsQuicTestExpiredClient"}
if (!$ExpiredClientCert) {
Write-Host "MsQuicTestExpiredClient not found! Creating new MsQuicTestExpiredClient certificate..."
$ExpiredClientCert = New-SelfSignedCertificate -Subject "CN=MsQuicTestExpiredClient" -FriendlyName MsQuicTestExpiredClient -KeyUsageProperty Sign -KeyUsage DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -KeyAlgorithm ECDSA_nistP256 -CurveExport CurveName -NotBefore (Get-Date).AddYears(-2) -NotAfter(Get-Date).AddYears(-1) -TextExtension @("2.5.29.19 = {text}","2.5.29.37 = {text}1.3.6.1.5.5.7.3.2") -Signer $RootCert
$TempExpiredClientPath = Join-Path $Env:TEMP "MsQuicTestClientExpiredCert.pfx"
Export-PfxCertificate -Cert $ExpiredClientCert -Password $PfxPassword -FilePath $TempExpiredClientPath
Import-PfxCertificate -FilePath $TempExpiredClientPath -Password $PfxPassword -Exportable -CertStoreLocation Cert:\LocalMachine\My
Remove-Item $TempExpiredClientPath
Write-Host "New MsQuicTestExpiredClient certificate installed!"
}else {
Write-Host "Found existing MsQuicTestExpiredClient certificate!"
}
if ($NewRoot) {
Write-Host "Deleting MsQuicTestRoot from MY store..."
Remove-Item $rootCert.PSPath
}
}
# Install OpenCppCoverage on test machines
if (!$NoCodeCoverage -and !(Test-Path "C:\Program Files\OpenCppCoverage\OpenCppCoverage.exe")) {
# Download the installer.
$Installer = $null
if ([System.Environment]::Is64BitOperatingSystem) {
$Installer = "OpenCppCoverageSetup-x64-0.9.9.0.exe"
} else {
$Installer = "OpenCppCoverageSetup-x86-0.9.9.0.exe"
}
$ExeFile = Join-Path $Env:TEMP $Installer
Write-Host "Downloading $Installer"
Invoke-WebRequest -Uri "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.9.0/$($Installer)" -OutFile $ExeFile
# Start the installer and wait for it to finish.
Write-Host "Installing $Installer"
Start-Process $ExeFile -Wait -ArgumentList {"/silent"} -NoNewWindow
# Delete the installer.
Remove-Item -Path $ExeFile
}
if ($DuoNic) {
Install-DuoNic
}
Write-Host "Searching for MsQuicTestExpiredServer certificate..."
$ExpiredServerCert = Get-ChildItem -path Cert:\LocalMachine\My\* -Recurse | Where-Object {$_.Subject -eq "CN=MsQuicTestExpiredServer"}
if (!$ExpiredServerCert) {
Write-Host "MsQuicTestExpiredServer not found! Creating new MsQuicTestExpiredServer certificate..."
$ExpiredServerCert = New-SelfSignedCertificate -Subject "CN=MsQuicTestExpiredServer" -DnsName $env:computername,localhost,"127.0.0.1","::1" -FriendlyName MsQuicTestExpiredServer -KeyUsageProperty Sign -KeyUsage DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -KeyAlgorithm ECDSA_nistP256 -CurveExport CurveName -NotBefore (Get-Date).AddYears(-2) -NotAfter(Get-Date).AddYears(-1) -TextExtension @("2.5.29.19 = {text}","2.5.29.37 = {text}1.3.6.1.5.5.7.3.1") -Signer $RootCert
$TempExpiredServerPath = Join-Path $Env:TEMP "MsQuicTestExpiredServerCert.pfx"
Export-PfxCertificate -Cert $ExpiredServerCert -Password $PfxPassword -FilePath $TempExpiredServerPath
Import-PfxCertificate -FilePath $TempExpiredServerPath -Password $PfxPassword -Exportable -CertStoreLocation Cert:\LocalMachine\My
Remove-Item $TempExpiredServerPath
Write-Host "New MsQuicTestExpiredServer certificate installed!"
} else {
Write-Host "Found existing MsQuicTestExpiredServer certificate!"
}
if ($Xdp) {
Download-Xdp-Kit
Write-Host "Searching for MsQuicTestClient certificate..."
$ClientCert = Get-ChildItem -path Cert:\LocalMachine\My\* -Recurse | Where-Object {$_.Subject -eq "CN=MsQuicTestClient"}
if (!$ClientCert) {
Write-Host "MsQuicTestClient not found! Creating new MsQuicTestClient certificate..."
$ClientCert = New-SelfSignedCertificate -Subject "CN=MsQuicTestClient" -FriendlyName MsQuicTestClient -KeyUsageProperty Sign -KeyUsage DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -KeyAlgorithm ECDSA_nistP256 -CurveExport CurveName -NotAfter(Get-Date).AddYears(5) -TextExtension @("2.5.29.19 = {text}","2.5.29.37 = {text}1.3.6.1.5.5.7.3.2") -Signer $RootCert
$TempClientPath = Join-Path $Env:TEMP "MsQuicTestClientCert.pfx"
Export-PfxCertificate -Cert $ClientCert -Password $PfxPassword -FilePath $TempClientPath
Import-PfxCertificate -FilePath $TempClientPath -Password $PfxPassword -Exportable -CertStoreLocation Cert:\LocalMachine\My
Remove-Item $TempClientPath
Write-Host "New MsQuicTestClient certificate installed!"
} else {
Write-Host "Found existing MsQuicTestClient certificate!"
}
} elseif ($IsLinux) {
switch ($Configuration) {
"Build" {
sudo apt-add-repository ppa:lttng/stable-2.12
sudo apt-get update
sudo apt-get install -y liblttng-ust-dev
# only used for the codecheck CI run:
sudo apt-get install -y cppcheck clang-tidy
# used for packaging
sudo apt-get install -y ruby ruby-dev rpm
sudo gem install fpm
}
"Test" {
sudo apt-add-repository ppa:lttng/stable-2.12
sudo apt-get update
sudo apt-get install -y lttng-tools
sudo apt-get install -y gdb
# Enable core dumps for the system.
Write-Host "[$(Get-Date)] Setting core dump size limit..."
sudo sh -c "echo 'root soft core unlimited' >> /etc/security/limits.conf"
sudo sh -c "echo 'root hard core unlimited' >> /etc/security/limits.conf"
sudo sh -c "echo '* soft core unlimited' >> /etc/security/limits.conf"
sudo sh -c "echo '* hard core unlimited' >> /etc/security/limits.conf"
#sudo cat /etc/security/limits.conf
# Set the core dump pattern.
Write-Host "[$(Get-Date)] Setting core dump pattern..."
sudo sh -c "echo -n '%e.%p.%t.core' > /proc/sys/kernel/core_pattern"
#sudo cat /proc/sys/kernel/core_pattern
}
"Dev" {
sudo apt-add-repository ppa:lttng/stable-2.12
sudo apt-get update
sudo apt-get install -y cmake
sudo apt-get install -y build-essential
sudo apt-get install -y liblttng-ust-dev
sudo apt-get install -y lttng-tools
}
"OneBranch" {
sudo apt-add-repository ppa:lttng/stable-2.12
sh -c "wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null"
sh -c "echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null"
sudo apt-get update
sudo apt-get install -y cmake
sudo apt-get install -y build-essential
sudo apt-get install -y liblttng-ust-dev
sudo apt-get install -y lttng-tools
sudo apt-get install -y libssl-dev
}
"OneBranchPackage" {
sudo apt-get update
# used for packaging
sudo apt-get install -y ruby ruby-dev rpm
sudo gem install fpm
}
Write-Host "Searching for MsQuicTestExpiredClient certificate..."
$ExpiredClientCert = Get-ChildItem -path Cert:\LocalMachine\My\* -Recurse | Where-Object {$_.Subject -eq "CN=MsQuicTestExpiredClient"}
if (!$ExpiredClientCert) {
Write-Host "MsQuicTestExpiredClient not found! Creating new MsQuicTestExpiredClient certificate..."
$ExpiredClientCert = New-SelfSignedCertificate -Subject "CN=MsQuicTestExpiredClient" -FriendlyName MsQuicTestExpiredClient -KeyUsageProperty Sign -KeyUsage DigitalSignature -CertStoreLocation cert:\CurrentUser\My -HashAlgorithm SHA256 -Provider "Microsoft Software Key Storage Provider" -KeyExportPolicy Exportable -KeyAlgorithm ECDSA_nistP256 -CurveExport CurveName -NotBefore (Get-Date).AddYears(-2) -NotAfter(Get-Date).AddYears(-1) -TextExtension @("2.5.29.19 = {text}","2.5.29.37 = {text}1.3.6.1.5.5.7.3.2") -Signer $RootCert
$TempExpiredClientPath = Join-Path $Env:TEMP "MsQuicTestClientExpiredCert.pfx"
Export-PfxCertificate -Cert $ExpiredClientCert -Password $PfxPassword -FilePath $TempExpiredClientPath
Import-PfxCertificate -FilePath $TempExpiredClientPath -Password $PfxPassword -Exportable -CertStoreLocation Cert:\LocalMachine\My
Remove-Item $TempExpiredClientPath
Write-Host "New MsQuicTestExpiredClient certificate installed!"
} else {
Write-Host "Found existing MsQuicTestExpiredClient certificate!"
}
} elseif ($IsMacOS) {
if ($Configuration -eq "Test") {
Write-Host "[$(Get-Date)] Setting core dump pattern..."
if ($NewRoot) {
Write-Host "Deleting MsQuicTestRoot from MY store..."
Remove-Item $rootCert.PSPath
}
}
# We remove OpenSSL path for kernel builds because it's not needed.
if ($ForKernel) { git rm submodules/openssl }
if ($InitSubmodules) {
Write-Host "Initializing clog submodule"
git submodule init submodules/clog
git submodule update
if ($Tls -eq "openssl") {
Write-Host "Initializing openssl submodule"
git submodule init submodules/openssl
git submodule update
}
if (!$DisableTest) {
Write-Host "Initializing googletest submodule"
git submodule init submodules/googletest
git submodule update
}
}
if ($InstallDuoNic) { Install-DuoNic }
if ($InstallXdpSdk) { Install-Xdp-Sdk }
if ($InstallNasm) { Install-NASM }
if ($InstallJOM) { Install-JOM }
if ($InstallCodeCoverage) { Install-OpenCppCoverage }
if ($InstallSigningCertificate) { Install-SigningCertificate }
if ($InstallTestCertificates) { Install-TestCertificates }
if ($IsLinux) {
if ($ForOneBranch) {
sh -c "wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null"
sh -c "echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null"
$ForBuild = $true
}
if ($ForOneBranchPackage) {
sudo apt-get update
# used for packaging
sudo apt-get install -y ruby ruby-dev rpm
sudo gem install fpm
}
if ($ForBuild) {
sudo apt-add-repository ppa:lttng/stable-2.12
sudo apt-get update
sudo apt-get install -y cmake
sudo apt-get install -y build-essential
sudo apt-get install -y liblttng-ust-dev
# only used for the codecheck CI run:
sudo apt-get install -y cppcheck clang-tidy
# used for packaging
sudo apt-get install -y ruby ruby-dev rpm
sudo gem install fpm
}
if ($ForTest) {
sudo apt-add-repository ppa:lttng/stable-2.12
sudo apt-get update
sudo apt-get install -y lttng-tools
sudo apt-get install -y gdb
# Enable core dumps for the system.
Write-Host "Setting core dump size limit"
sudo sh -c "echo 'root soft core unlimited' >> /etc/security/limits.conf"
sudo sh -c "echo 'root hard core unlimited' >> /etc/security/limits.conf"
sudo sh -c "echo '* soft core unlimited' >> /etc/security/limits.conf"
sudo sh -c "echo '* hard core unlimited' >> /etc/security/limits.conf"
#sudo cat /etc/security/limits.conf
# Set the core dump pattern.
Write-Host "Setting core dump pattern"
sudo sh -c "echo -n '%e.%p.%t.core' > /proc/sys/kernel/core_pattern"
#sudo cat /proc/sys/kernel/core_pattern
}
}
if ($IsMacOS) {
if ($ForTest) {
Write-Host "Setting core dump pattern"
sudo sysctl -w kern.corefile=%N.%P.core
}
}
foreach ($errMsg in $MessagesAtEnd) {
Write-Warning $errMsg
}

Просмотреть файл

@ -65,7 +65,7 @@ This script runs the MsQuic tests.
Treats all errors as warnings.
.Parameter DuoNic
Uses DuoNic instead of loopback (DuoNic must already be installed by prepare-machine.ps1).
Uses DuoNic instead of loopback (DuoNic must already be installed via 'prepare-machine.ps1 -InstallDuoNic').
.EXAMPLE
test.ps1