зеркало из https://github.com/microsoft/msquic.git
Improve Setup Scripts (#240)
This commit is contained in:
Родитель
f78732e494
Коммит
12a00eefc5
|
@ -0,0 +1,55 @@
|
|||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Installs the build artifacts on a test machine.
|
||||
|
||||
.PARAMETER Config
|
||||
Specifies the build configuration to test.
|
||||
|
||||
.PARAMETER Arch
|
||||
The CPU architecture to test.
|
||||
|
||||
.PARAMETER Tls
|
||||
The TLS library test.
|
||||
|
||||
.EXAMPLE
|
||||
install-build-artifacts.ps1
|
||||
|
||||
#>
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory = $false)]
|
||||
[ValidateSet("Debug", "Release")]
|
||||
[string]$Config = "Release",
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateSet("x86", "x64", "arm", "arm64")]
|
||||
[string]$Arch,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateSet("schannel", "openssl", "stub", "mitls")]
|
||||
[string]$Tls
|
||||
)
|
||||
|
||||
Set-StrictMode -Version 'Latest'
|
||||
$PSDefaultParameterValues['*:ErrorAction'] = 'Stop'
|
||||
|
||||
# Important directories.
|
||||
$RootDir = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
|
||||
$ArtifactsDir = Join-Path $RootDir "artifacts"
|
||||
|
||||
if ($IsWindows) {
|
||||
# Install ETW manifest
|
||||
$MsQuicDll = Join-Path $ArtifactsDir "\windows\$($Arch)_$($Config)_$($Tls)\msquic.dll"
|
||||
$ManifestPath = Join-Path $RootDir "\src\manifest\MsQuicEtw.man"
|
||||
$Command = "wevtutil.exe im $($ManifestPath) /rf:$($MsQuicDll) /mf:$($MsQuicDll)"
|
||||
Write-Host $Command
|
||||
Invoke-Expression $Command
|
||||
|
||||
} elseif ($IsLinux) {
|
||||
# TODO - Figure out how to install openssl?
|
||||
|
||||
# Make sure we have full permissions for all artifacts.
|
||||
Write-Host "[$(Get-Date)] Configuring permissions for artifacts..."
|
||||
sudo chmod -R 777 $ArtifactsDir
|
||||
}
|
|
@ -12,7 +12,7 @@ Set-StrictMode -Version 'Latest'
|
|||
$PSDefaultParameterValues['*:ErrorAction'] = 'Stop'
|
||||
|
||||
# Root directory of the project.
|
||||
$RootDir = Join-Path $PSScriptRoot ".." ".."
|
||||
$RootDir = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
|
||||
|
||||
# Installation directory for procdump.
|
||||
$ProcdumpDir = Join-Path $RootDir "bld" "windows" "procdump"
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Prepares the local machine for testing.
|
||||
|
||||
.PARAMETER Config
|
||||
Specifies the build configuration to test.
|
||||
|
||||
.PARAMETER Arch
|
||||
The CPU architecture to test.
|
||||
|
||||
.PARAMETER Tls
|
||||
The TLS library test.
|
||||
|
||||
.PARAMETER InstallManifest
|
||||
Installs the Windows ETW manifest on the test machine.
|
||||
|
||||
.EXAMPLE
|
||||
prepare-test-machine.ps1
|
||||
|
||||
#>
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory = $false)]
|
||||
[ValidateSet("Debug", "Release")]
|
||||
[string]$Config = "Debug",
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[ValidateSet("x86", "x64", "arm", "arm64")]
|
||||
[string]$Arch = "x64",
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[ValidateSet("schannel", "openssl", "stub", "mitls")]
|
||||
[string]$Tls = "schannel",
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[switch]$InstallManifest = $false
|
||||
)
|
||||
|
||||
Set-StrictMode -Version 'Latest'
|
||||
$PSDefaultParameterValues['*:ErrorAction'] = 'Stop'
|
||||
|
||||
# Root directory of the project.
|
||||
$RootDir = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
|
||||
|
||||
# Other important directories.
|
||||
$ScriptsDir = Join-Path $RootDir ".azure" "scripts"
|
||||
$ArtifactsDir = Join-Path $RootDir "artifacts"
|
||||
|
||||
if ($IsWindows) {
|
||||
# Disable SChannel TLS 1.3 (client and server).
|
||||
$TlsServerKeyPath = "HKLM\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server"
|
||||
reg.exe add $TlsServerKeyPath /v DisabledByDefault /t REG_DWORD /d 1 /f | Out-Null
|
||||
reg.exe add $TlsServerKeyPath /v Enabled /t REG_DWORD /d 0 /f | Out-Null
|
||||
$TlsClientKeyPath = "HKLM\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client"
|
||||
reg.exe add $TlsClientKeyPath /v DisabledByDefault /t REG_DWORD /d 1 /f | Out-Null
|
||||
reg.exe add $TlsClientKeyPath /v Enabled /t REG_DWORD /d 0 /f | Out-Null
|
||||
|
||||
# Run procdump installation script.
|
||||
& (Join-Path $ScriptsDir "install-procdump.ps1")
|
||||
|
||||
if ($InstallManifest) {
|
||||
# Install ETW manifest
|
||||
$MsQuicDll = Join-Path $ArtifactsDir "\windows\$($Arch)_$($Config)_$($Tls)\msquic.dll"
|
||||
$ManifestPath = Join-Path $RootDir "\src\manifest\MsQuicEtw.man"
|
||||
$Command = "wevtutil.exe im $($ManifestPath) /rf:$($MsQuicDll) /mf:$($MsQuicDll)"
|
||||
Write-Host $Command
|
||||
Invoke-Expression $Command
|
||||
}
|
||||
|
||||
# Enable SChannel TLS 1.3 (client and server).
|
||||
$TlsServerKeyPath = "HKLM\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server"
|
||||
reg.exe add $TlsServerKeyPath /v DisabledByDefault /t REG_DWORD /d 0 /f | Out-Null
|
||||
reg.exe add $TlsServerKeyPath /v Enabled /t REG_DWORD /d 1 /f | Out-Null
|
||||
$TlsClientKeyPath = "HKLM\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client"
|
||||
reg.exe add $TlsClientKeyPath /v DisabledByDefault /t REG_DWORD /d 0 /f | Out-Null
|
||||
reg.exe add $TlsClientKeyPath /v Enabled /t REG_DWORD /d 1 /f | Out-Null
|
||||
|
||||
} elseif ($IsLinux) {
|
||||
|
||||
# Make sure we have full permissions for all artifacts.
|
||||
Write-Host "[$(Get-Date)] Configuring permissions for artifacts..."
|
||||
sudo chmod -R 777 $ArtifactsDir
|
||||
|
||||
# Enable core dumps (up to ~1GB) 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
|
||||
}
|
|
@ -16,12 +16,19 @@ jobs:
|
|||
- checkout: self
|
||||
submodules: recursive
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Prepare Build Machine
|
||||
inputs:
|
||||
pwsh: true
|
||||
filePath: scripts/prepare-machine.ps1
|
||||
arguments: -Configuration Build
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Build Source Code (Debug)
|
||||
inputs:
|
||||
pwsh: true
|
||||
filePath: scripts/build.ps1
|
||||
arguments: -InstallAzureDependencies -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }} ${{ parameters.extraBuildArgs }}
|
||||
arguments: -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }} ${{ parameters.extraBuildArgs }}
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Build Source Code (Release)
|
||||
|
|
|
@ -18,3 +18,10 @@ steps:
|
|||
inputs:
|
||||
sourceFolder: $(Build.TempDirectory)/drop
|
||||
targetFolder: artifacts
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Install Build Artifacts
|
||||
inputs:
|
||||
pwsh: true
|
||||
filePath: .azure/scripts/install-build-artifacts.ps1
|
||||
arguments: -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }}
|
||||
|
|
|
@ -25,8 +25,8 @@ jobs:
|
|||
displayName: Prepare Test Machine
|
||||
inputs:
|
||||
pwsh: true
|
||||
filePath: .azure/scripts/prepare-test-machine.ps1
|
||||
arguments: -InstallManifest -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls schannel
|
||||
filePath: scripts/prepare-machine.ps1
|
||||
arguments: -Configuration Test
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Run BVTs
|
||||
|
|
|
@ -30,8 +30,8 @@ jobs:
|
|||
displayName: Prepare Test Machine
|
||||
inputs:
|
||||
pwsh: true
|
||||
filePath: .azure/scripts/prepare-test-machine.ps1
|
||||
arguments: -InstallManifest -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }}
|
||||
filePath: scripts/prepare-machine.ps1
|
||||
arguments: -Configuration Test
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Run BVTs
|
||||
|
|
|
@ -26,8 +26,8 @@ jobs:
|
|||
displayName: Prepare Test Machine
|
||||
inputs:
|
||||
pwsh: true
|
||||
filePath: .azure/scripts/prepare-test-machine.ps1
|
||||
arguments: -InstallManifest -Config ${{ parameters.config }} -Arch ${{ parameters.arch }} -Tls ${{ parameters.tls }}
|
||||
filePath: scripts/prepare-machine.ps1
|
||||
arguments: -Configuration Test
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Run SpinQuic
|
||||
|
|
|
@ -86,7 +86,7 @@ sudo dpkg -i libssl1.0.0_1.0.2g-1ubuntu4.15_amd64.deb
|
|||
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/build.ps1 -InstallDependencies
|
||||
./scripts/prepare-machine.ps1 -Configuration Dev
|
||||
```
|
||||
|
||||
### Additional Requirements on Windows
|
||||
|
|
|
@ -3,12 +3,6 @@
|
|||
.SYNOPSIS
|
||||
This script provides helpers for building msquic.
|
||||
|
||||
.PARAMETER InstallDependencies
|
||||
Installs any necessary dependencies.
|
||||
|
||||
.PARAMETER InstallAzureDependencies
|
||||
Installs any necessary Azure Pipelines dependencies.
|
||||
|
||||
.PARAMETER Config
|
||||
The debug or release configurationto build for.
|
||||
|
||||
|
@ -54,12 +48,6 @@ This script provides helpers for building msquic.
|
|||
#>
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory = $false)]
|
||||
[switch]$InstallDependencies = $false,
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[switch]$InstallAzureDependencies = $false,
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[ValidateSet("Debug", "Release")]
|
||||
[string]$Config = "Debug",
|
||||
|
@ -87,9 +75,6 @@ param (
|
|||
[Parameter(Mandatory = $false)]
|
||||
[switch]$Clean = $false,
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[switch]$InstallOutput = $false,
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[int32]$Parallel = -1,
|
||||
|
||||
|
@ -135,27 +120,6 @@ function Log($msg) {
|
|||
Write-Host "[$(Get-Date)] $msg"
|
||||
}
|
||||
|
||||
# Installs just the Azure Pipelines dependencies.
|
||||
function Install-Azure-Dependencies {
|
||||
if ($IsWindows) {
|
||||
# TODO - Anything else?
|
||||
} else {
|
||||
sudo apt-get install liblttng-ust-dev
|
||||
sudo apt-get install lttng-tools
|
||||
}
|
||||
}
|
||||
|
||||
# Installs all the dependencies.
|
||||
function Install-Dependencies {
|
||||
if ($IsWindows) {
|
||||
# TODO - Anything else?
|
||||
} else {
|
||||
sudo apt-get install cmake
|
||||
sudo apt-get install build-essentials
|
||||
}
|
||||
Install-Azure-Dependencies
|
||||
}
|
||||
|
||||
# Executes cmake with the given arguments.
|
||||
function CMake-Execute([String]$Arguments) {
|
||||
Log "cmake $($Arguments)"
|
||||
|
@ -229,32 +193,10 @@ function CMake-Build {
|
|||
}
|
||||
}
|
||||
|
||||
# Installs all the build output.
|
||||
function Install-Output {
|
||||
if ($IsWindows) {
|
||||
# Import the ETW manifest.
|
||||
$ManifestDir = Join-Path $SrcDir "manifest"
|
||||
$ManifestPath = Join-Path $ManifestDir "MsQuicEtw.man"
|
||||
$MsQuicDllPath = Join-Path $ArtifactsDir "bin" $Config "msquic.dll"
|
||||
Log "Installing ETW manifest..."
|
||||
wevtutil.exe im $ManifestPath /rf:$MsQuicDllPath /mf:$MsQuicDllPath
|
||||
} else {
|
||||
# TODO - Anything?
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################
|
||||
# Main Execution #
|
||||
##############################################################
|
||||
|
||||
if ($InstallDependencies) {
|
||||
Log "Installing dependencies..."
|
||||
Install-Dependencies
|
||||
} elseif ($InstallAzureDependencies) {
|
||||
Log "Installing Azure Pipelines dependencies..."
|
||||
Install-Azure-Dependencies
|
||||
}
|
||||
|
||||
# Generate the build files.
|
||||
Log "Generating files..."
|
||||
CMake-Generate
|
||||
|
@ -263,9 +205,4 @@ CMake-Generate
|
|||
Log "Building..."
|
||||
CMake-Build
|
||||
|
||||
if ($InstallOutput) {
|
||||
# Install the build output.
|
||||
Install-Output
|
||||
}
|
||||
|
||||
Log "Done."
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
This script installs all necessary dependencies on the machine, depending
|
||||
on the provided configuration.
|
||||
|
||||
.PARAMETER Configuration
|
||||
The type of configuration to install dependencies for.
|
||||
|
||||
.EXAMPLE
|
||||
prepare-machine.ps1 -Configuration Build
|
||||
|
||||
.EXAMPLE
|
||||
prepare-machine.ps1 -Configuration Test
|
||||
|
||||
#>
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateSet("Build", "Test", "Dev")]
|
||||
[string]$Configuration
|
||||
)
|
||||
|
||||
Set-StrictMode -Version 'Latest'
|
||||
$PSDefaultParameterValues['*:ErrorAction'] = 'Stop'
|
||||
|
||||
# Important directories.
|
||||
$RootDir = Split-Path $PSScriptRoot -Parent
|
||||
$ScriptsDir = Join-Path $RootDir ".azure" "scripts"
|
||||
|
||||
if ($IsWindows) {
|
||||
|
||||
if ($Configuration -eq "Dev") {
|
||||
# TODO - Support installing VS and necessary addins
|
||||
# TODO - Install CMake
|
||||
# TODO - Check for Windows preview
|
||||
}
|
||||
|
||||
if ($Configuration -eq "Test" -or $Configuration -eq "Dev") {
|
||||
# Disable SChannel TLS 1.3 (client and server).
|
||||
$TlsServerKeyPath = "HKLM\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server"
|
||||
reg.exe add $TlsServerKeyPath /v DisabledByDefault /t REG_DWORD /d 1 /f | Out-Null
|
||||
reg.exe add $TlsServerKeyPath /v Enabled /t REG_DWORD /d 0 /f | Out-Null
|
||||
$TlsClientKeyPath = "HKLM\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client"
|
||||
reg.exe add $TlsClientKeyPath /v DisabledByDefault /t REG_DWORD /d 1 /f | Out-Null
|
||||
reg.exe add $TlsClientKeyPath /v Enabled /t REG_DWORD /d 0 /f | Out-Null
|
||||
|
||||
# Run procdump installation script.
|
||||
& (Join-Path $ScriptsDir "install-procdump.ps1")
|
||||
|
||||
# Enable SChannel TLS 1.3 (client and server).
|
||||
$TlsServerKeyPath = "HKLM\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server"
|
||||
reg.exe add $TlsServerKeyPath /v DisabledByDefault /t REG_DWORD /d 0 /f | Out-Null
|
||||
reg.exe add $TlsServerKeyPath /v Enabled /t REG_DWORD /d 1 /f | Out-Null
|
||||
$TlsClientKeyPath = "HKLM\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client"
|
||||
reg.exe add $TlsClientKeyPath /v DisabledByDefault /t REG_DWORD /d 0 /f | Out-Null
|
||||
reg.exe add $TlsClientKeyPath /v Enabled /t REG_DWORD /d 1 /f | Out-Null
|
||||
}
|
||||
|
||||
} else {
|
||||
switch ($Configuration) {
|
||||
"Build" {
|
||||
sudo apt-get install liblttng-ust-dev
|
||||
}
|
||||
"Test" {
|
||||
sudo apt-get install lttng-tools
|
||||
|
||||
# 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-get install cmake
|
||||
sudo apt-get install build-essentials
|
||||
sudo apt-get install liblttng-ust-dev
|
||||
sudo apt-get install lttng-tools
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче