Skip to content

Commit

Permalink
Depend on specific build of corenet-ci repo (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfriesen authored Jun 16, 2023
1 parent 54903c3 commit ef6df6c
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 28 deletions.
24 changes: 20 additions & 4 deletions tools/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,22 @@ function Get-EbpfMsiUrl {
return "/~https://github.com/microsoft/xdp-for-windows/releases/download/main-prerelease/$EbpfMsiFilename"
}

function Get-CoreNetCiCommit {
return "61af6f56ef187dcedb459bcc56f56e305f98a6e4"
}

function Get-CoreNetCiArtifactPath {
param (
[Parameter()]
[string]$Name
)

$RootDir = Split-Path $PSScriptRoot -Parent
$Commit = Get-CoreNetCiCommit

return "$RootDir\artifacts\corenet-ci-$Commit\vm-setup\$Name"
}

# Refreshes the PATH environment variable.
function Refresh-Path {
$env:Path=(
Expand All @@ -131,8 +147,8 @@ function Collect-LiveKD {
[string]$OutFile
)

$LiveKD = "C:\livekd64.exe"
$KD = "C:\kd.exe"
$LiveKD = Get-CoreNetCiArtifactPath -Name "livekd64.exe"
$KD = Get-CoreNetCiArtifactPath -Name "kd.exe"

Write-Host "Capturing live kernel dump to $OutFile"

Expand All @@ -150,7 +166,7 @@ function Collect-ProcessDump {
[string]$OutFile
)

$ProcDump = "C:\procdump64.exe"
$ProcDump = Get-CoreNetCiArtifactPath -Name "procdump64.exe"

Write-Host "Capturing process dump of $ProcessName to $OutFile"

Expand All @@ -165,7 +181,7 @@ function Initiate-Bugcheck {
[string]$Code = "0xE2"
)

$NotMyFault = "C:\notmyfault64.exe"
$NotMyFault = Get-CoreNetCiArtifactPath -Name "notmyfault64.exe"

Write-Host "$NotMyFault -accepteula -bugcheck $Code"
& $NotMyFault -accepteula -bugcheck $Code
Expand Down
4 changes: 3 additions & 1 deletion tools/log.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ $ErrorActionPreference = 'Stop'

# Important paths.
$RootDir = Split-Path $PSScriptRoot -Parent
. $RootDir\tools\common.ps1

$ArtifactsDir = "$RootDir\artifacts\bin\$($Arch)_$($Config)"
$TracePdb = "$RootDir\artifacts\corenet-ci-main\vm-setup\tracepdb.exe"
$TracePdb = Get-CoreNetCiArtifactPath -Name "tracepdb.exe"
$WprpFile = "$RootDir\tools\xdptrace.wprp"
$TmfPath = "$ArtifactsDir\tmfs"
$LogsDir = "$RootDir\artifacts\logs"
Expand Down
24 changes: 8 additions & 16 deletions tools/prepare-machine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,16 @@ $EbpfNugetRestoreDir = "$RootDir/packages/$EbpfNugetVersion"
$Reboot = $false

function Download-CoreNet-Deps {
$CoreNetCiCommit = Get-CoreNetCiCommit

# Download and extract /~https://github.com/microsoft/corenet-ci.
if (!(Test-Path "artifacts")) { mkdir artifacts }
if ($Force -and (Test-Path "artifacts/corenet-ci-main")) {
Remove-Item -Recurse -Force "artifacts/corenet-ci-main"
if ($Force -and (Test-Path "artifacts/corenet-ci-$CoreNetCiCommit")) {
Remove-Item -Recurse -Force "artifacts/corenet-ci-$CoreNetCiCommit"
}
if (!(Test-Path "artifacts/corenet-ci-main")) {
Invoke-WebRequest-WithRetry -Uri "/~https://github.com/microsoft/corenet-ci/archive/refs/heads/main.zip" -OutFile "artifacts\corenet-ci.zip"
if (!(Test-Path "artifacts/corenet-ci-$CoreNetCiCommit")) {
Remove-Item -Recurse -Force "artifacts/corenet-ci-*"
Invoke-WebRequest-WithRetry -Uri "/~https://github.com/microsoft/corenet-ci/archive/$CoreNetCiCommit.zip" -OutFile "artifacts\corenet-ci.zip"
Expand-Archive -Path "artifacts\corenet-ci.zip" -DestinationPath "artifacts" -Force
Remove-Item -Path "artifacts\corenet-ci.zip"
}
Expand Down Expand Up @@ -148,7 +151,7 @@ function Setup-TestSigning {

# Installs the XDP certificates.
function Install-Certs {
$CodeSignCertPath = "artifacts\CoreNetSignRoot.cer"
$CodeSignCertPath = Get-CoreNetCiArtifactPath -Name "CoreNetSignRoot.cer"
if (!(Test-Path $CodeSignCertPath)) {
Write-Error "$CodeSignCertPath does not exist!"
}
Expand Down Expand Up @@ -221,8 +224,6 @@ if ($Cleanup) {
if ($ForBuild) {
Download-CoreNet-Deps
Download-eBpf-Nuget
Copy-Item artifacts\corenet-ci-main\vm-setup\CoreNetSignRoot.cer artifacts\CoreNetSignRoot.cer
Copy-Item artifacts\corenet-ci-main\vm-setup\CoreNetSign.pfx artifacts\CoreNetSign.pfx
}

if ($ForEbpfBuild) {
Expand Down Expand Up @@ -294,15 +295,6 @@ if ($Cleanup) {
Setup-TestSigning
Download-CoreNet-Deps
Download-Ebpf-Msi
Copy-Item artifacts\corenet-ci-main\vm-setup\CoreNetSignRoot.cer artifacts\CoreNetSignRoot.cer
Copy-Item artifacts\corenet-ci-main\vm-setup\CoreNetSign.pfx artifacts\CoreNetSign.pfx
Copy-Item artifacts\corenet-ci-main\vm-setup\devcon.exe C:\devcon.exe
Copy-Item artifacts\corenet-ci-main\vm-setup\dswdevice.exe C:\dswdevice.exe
Copy-Item artifacts\corenet-ci-main\vm-setup\kd.exe C:\kd.exe
Copy-Item artifacts\corenet-ci-main\vm-setup\livekd64.exe C:\livekd64.exe
Copy-Item artifacts\corenet-ci-main\vm-setup\notmyfault64.exe C:\notmyfault64.exe
Copy-Item artifacts\corenet-ci-main\vm-setup\procdump64.exe C:\procdump64.exe
Copy-Item artifacts\corenet-ci-main\vm-setup\wsario.exe C:\wsario.exe
Install-Certs
Setup-VcRuntime
Setup-VsTest
Expand Down
4 changes: 2 additions & 2 deletions tools/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ $RootDir = Split-Path $PSScriptRoot -Parent
# Important paths.
$ArtifactsDir = "$RootDir\artifacts\bin\$($Arch)_$($Config)"
$LogsDir = "$RootDir\artifacts\logs"
$DevCon = "C:\devcon.exe"
$DswDevice = "C:\dswdevice.exe"
$DevCon = Get-CoreNetCiArtifactPath -Name "devcon.exe"
$DswDevice = Get-CoreNetCiArtifactPath -Name "dswdevice.exe"

# File paths.
$XdpSys = "$ArtifactsDir\xdp\xdp.sys"
Expand Down
7 changes: 5 additions & 2 deletions tools/sign.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ param (
Set-StrictMode -Version 'Latest'
$ErrorActionPreference = 'Stop'

$RootDir = Split-Path $PSScriptRoot -Parent
. $RootDir\tools\common.ps1

function Get-WindowsKitTool {
param (
[string]$Arch = "x86",
Expand Down Expand Up @@ -61,9 +64,9 @@ $RootDir = (Split-Path $PSScriptRoot -Parent)
$ArtifactsDir = Join-Path $RootDir "artifacts\bin\$($Arch)_$($Config)"

# Certificate paths.
$CodeSignCertPath = Join-Path $RootDir "artifacts\CoreNetSignRoot.cer"
$CodeSignCertPath = Get-CoreNetCiArtifactPath -Name "CoreNetSignRoot.cer"
if (!(Test-Path $CodeSignCertPath)) { Write-Error "$CodeSignCertPath does not exist!" }
$CertPath = Join-Path $RootDir "artifacts\CoreNetSign.pfx"
$CertPath = Get-CoreNetCiArtifactPath -Name "CoreNetSign.pfx"
if (!(Test-Path $CertPath)) { Write-Error "$CertPath does not exist!" }

# All the file paths.
Expand Down
6 changes: 4 additions & 2 deletions tools/spinxsk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ $ErrorActionPreference = 'Stop'

# Important paths.
$RootDir = Split-Path $PSScriptRoot -Parent
. $RootDir\tools\common.ps1

$ArtifactsDir = "$RootDir\artifacts\bin\$($Arch)_$($Config)"
$LogsDir = "$RootDir\artifacts\logs"
$SpinXsk = "$ArtifactsDir\spinxsk.exe"
$LiveKD = "C:\livekd64.exe"
$KD = "C:\kd.exe"
$LiveKD = Get-CoreNetCiArtifactPath -Name "livekd64.exe"
$KD = Get-CoreNetCiArtifactPath -Name "kd.exe"

# Verify all the files are present.
if (!(Test-Path $SpinXsk)) {
Expand Down
4 changes: 3 additions & 1 deletion tools/xskperf.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ function Wait-NetAdapterUpStatus {
}

$RootDir = Split-Path $PSScriptRoot -Parent
. $RootDir\tools\common.ps1

$ArtifactsDir = "$RootDir\artifacts\bin\$($Arch)_$($Config)"
$WsaRio = "C:\wsario.exe"
$WsaRio = Get-CoreNetCiArtifactPath -Name "wsario.exe"
$Mode = $Mode.ToUpper()
$Adapter = Get-NetAdapter $AdapterName
$AdapterIndex = $Adapter.ifIndex
Expand Down

0 comments on commit ef6df6c

Please sign in to comment.