Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gtrevi committed Feb 21, 2024
1 parent f44d4ba commit 30ffe7b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
3 changes: 2 additions & 1 deletion scripts/cleanup_ebpf_cicd_tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Import-ResultsFromVM -VMList $VMList -KmTracing $KmTracing
# Uninstall eBPF Components on the test VM.
foreach($VM in $VMList) {
$VMName = $VM.Name
Uninstall-eBPFComponentsOnVM -VMName $VMname -ErrorAction Stop
Write-Host "Uninstalling eBPF components on VM $VMName..."
Uninstall-eBPFComponentsOnVM -VMName $VMname -WorkingDirectory $WorkingDirectory -ErrorAction Stop
}

# Stop the VMs.
Expand Down
4 changes: 2 additions & 2 deletions scripts/execute_ebpf_cicd_tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ $AdminTestVMCredential = Get-StoredCredential -Target $AdminTarget -ErrorAction
$StandardUserTestVMCredential = Get-StoredCredential -Target $StandardUserTarget -ErrorAction Stop

# Load other utility modules.
Import-Module .\common.psm1 -Force -ArgumentList ($LogFileName) -WarningAction SilentlyContinue
Import-Module .\vm_run_tests.psm1 -Force -ArgumentList ($AdminTestVMCredential.UserName, $AdminTestVMCredential.Password, $StandardUserTestVMCredential.UserName, $StandardUserTestVMCredential.Password, $WorkingDirectory, $LogFileName) -WarningAction SilentlyContinue
Import-Module $PSScriptRoot\common.psm1 -Force -ArgumentList ($LogFileName) -WarningAction SilentlyContinue
Import-Module $PSScriptRoot\vm_run_tests.psm1 -Force -ArgumentList ($AdminTestVMCredential.UserName, $AdminTestVMCredential.Password, $StandardUserTestVMCredential.UserName, $StandardUserTestVMCredential.Password, $WorkingDirectory, $LogFileName) -WarningAction SilentlyContinue

# Read the test execution json.
$Config = Get-Content ("{0}\{1}" -f $PSScriptRoot, $TestExecutionJsonFileName) | ConvertFrom-Json
Expand Down
19 changes: 10 additions & 9 deletions scripts/run_driver_tests.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Push-Location $WorkingDirectory
Import-Module .\common.psm1 -Force -ArgumentList ($LogFileName) -WarningAction SilentlyContinue
Import-Module .\install_ebpf.psm1 -Force -ArgumentList ($WorkingDirectory, $LogFileName) -WarningAction SilentlyContinue

$TestDirectory = "$env:ProgramFiles\ebpf-for-windows\testing"
$CodeCoverage = "$env:ProgramFiles\OpenCppCoverage\OpenCppCoverage.exe"

#
Expand Down Expand Up @@ -102,7 +103,7 @@ function Invoke-CICDTests
param([parameter(Mandatory = $true)][bool] $VerboseLogs,
[parameter(Mandatory = $false)][bool] $Coverage = $false)

pushd $WorkingDirectory
Push-Location $WorkingDirectory
$env:EBPF_ENABLE_WER_REPORT = "yes"

try {
Expand All @@ -113,7 +114,7 @@ function Invoke-CICDTests
"socket_tests.exe")

foreach ($Test in $TestList) {
Invoke-Test -TestName $Test -VerboseLogs $VerboseLogs -Coverage $Coverage
Invoke-Test -TestName "$TestDirectory\$Test" -VerboseLogs $VerboseLogs -Coverage $Coverage
}

if ($Coverage) {
Expand All @@ -136,7 +137,7 @@ function Invoke-CICDTests
throw
}

popd
Pop-Location
}

function Invoke-XDPTest
Expand All @@ -146,7 +147,7 @@ function Invoke-XDPTest
[parameter(Mandatory=$true)][string] $XDPTestName,
[parameter(Mandatory=$true)][string] $WorkingDirectory)

pushd $WorkingDirectory
Push-Location $WorkingDirectory

Write-Log "Executing $XDPTestName with remote address: $RemoteIPV4Address."
$LASTEXITCODE = 0
Expand All @@ -164,7 +165,7 @@ function Invoke-XDPTest

Write-Log "$XDPTestName Test Passed" -ForegroundColor Green

popd
Pop-Location
}

function Invoke-ConnectRedirectTest
Expand All @@ -182,7 +183,7 @@ function Invoke-ConnectRedirectTest
[parameter(Mandatory=$true)][string] $UserType,
[parameter(Mandatory=$true)][string] $WorkingDirectory)

pushd $WorkingDirectory
Push-Location $WorkingDirectory

## First run the test with both v4 and v6 programs attached.
$Parameters = "--virtual-ip-v4 $VirtualIPv4Address --virtual-ip-v6 $VirtualIPv6Address --local-ip-v4 $LocalIPv4Address --local-ip-v6 $LocalIPv6Address --remote-ip-v4 $RemoteIPv4Address --remote-ip-v6 $RemoteIPv6Address --destination-port $DestinationPort --proxy-port $ProxyPort --user-type $UserType"
Expand Down Expand Up @@ -242,7 +243,7 @@ function Invoke-ConnectRedirectTest

Write-Log "Connect-Redirect Test Passed" -ForegroundColor Green

popd
Pop-Location
}

function Invoke-CICDStressTests
Expand All @@ -251,7 +252,7 @@ function Invoke-CICDStressTests
[parameter(Mandatory = $false)][bool] $Coverage = $false,
[parameter(Mandatory = $false)][bool] $RestartExtension = $false)

pushd $WorkingDirectory
Push-Location $WorkingDirectory
$env:EBPF_ENABLE_WER_REPORT = "yes"

Write-Log "Executing eBPF kernel mode multi-threaded stress tests (restart extension:$RestartExtension)."
Expand All @@ -271,7 +272,7 @@ function Invoke-CICDStressTests
throw "*** ERROR *** eBPF kernel mode multi-threaded stress tests FAILED (restart extension:$RestartExtension)"
}

popd
Pop-Location
}

function Invoke-CICDPerformanceTests
Expand Down
10 changes: 3 additions & 7 deletions scripts/vm_run_tests.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ function Invoke-CICDTestsOnVM
[parameter(Mandatory=$True)][string[]] $Options)

$WorkingDirectory = "$Env:SystemDrive\$WorkingDirectory"
$TestDirectory = "$env:ProgramFiles\ebpf-for-windows\testing"
Import-Module $WorkingDirectory\common.psm1 -ArgumentList ($LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\run_driver_tests.psm1 -ArgumentList ($TestDirectory, $LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\run_driver_tests.psm1 -ArgumentList ($WorkingDirectory, $LogFileName) -Force -WarningAction SilentlyContinue

$TestMode = $TestMode.ToLower()
switch ($TestMode)
Expand Down Expand Up @@ -81,9 +80,8 @@ function Add-eBPFProgramOnVM
[Parameter(Mandatory=$True)] [string] $WorkingDirectory,
[Parameter(Mandatory=$True)] [string] $LogFileName)
$WorkingDirectory = "$Env:SystemDrive\$WorkingDirectory"
$TestDirectory = "$env:ProgramFiles\ebpf-for-windows\testing"
Import-Module $WorkingDirectory\common.psm1 -ArgumentList ($LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\run_driver_tests.psm1 -ArgumentList ($TestDirectory, $LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\run_driver_tests.psm1 -ArgumentList ($WorkingDirectory, $LogFileName) -Force -WarningAction SilentlyContinue

if ([System.String]::IsNullOrEmpty($Interface)){
Write-Log "Loading $Program on $VM."
Expand Down Expand Up @@ -116,9 +114,8 @@ function Set-eBPFProgramOnVM
[Parameter(Mandatory=$True)] [string] $WorkingDirectory,
[Parameter(Mandatory=$True)] [string] $LogFileName)
$WorkingDirectory = "$Env:SystemDrive\$WorkingDirectory"
$TestDirectory = "$env:ProgramFiles\ebpf-for-windows\testing"
Import-Module $WorkingDirectory\common.psm1 -ArgumentList ($LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\run_driver_tests.psm1 -ArgumentList ($TestDirectory, $LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\run_driver_tests.psm1 -ArgumentList ($TestDWorkingDirectoryirectory, $LogFileName) -Force -WarningAction SilentlyContinue

Write-Log "Setting program $ProgId at interface $Interface on $VM."
Invoke-NetshEbpfCommand -Arguments "set program $ProgId xdp_test interface=""$Interface"""
Expand All @@ -139,7 +136,6 @@ function Remove-eBPFProgramFromVM
[Parameter(Mandatory=$True)] [string] $WorkingDirectory,
[Parameter(Mandatory=$True)] [string] $LogFileName)
$WorkingDirectory = "$Env:SystemDrive\$WorkingDirectory"
$TestDirectory = "$env:ProgramFiles\ebpf-for-windows\testing"
Import-Module $WorkingDirectory\common.psm1 -ArgumentList ($LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\run_driver_tests.psm1 -ArgumentList ($WorkingDirectory, $LogFileName) -Force -WarningAction SilentlyContinue

Expand Down

0 comments on commit 30ffe7b

Please sign in to comment.