Skip to content

Commit

Permalink
add parameter handling to ensure exclusive execution of km stress tes…
Browse files Browse the repository at this point in the history
…ts (#2775)

Co-authored-by: Dhiren Vispute <[email protected]>
  • Loading branch information
dv-msft and Dhiren Vispute authored Aug 30, 2023
1 parent 6eac414 commit d24f4da
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ jobs:
with:
name: km_mt_stress_tests
pre_test: .\setup_ebpf_cicd_stress_tests.ps1
test_command: .\execute_ebpf_cicd_tests.ps1 -RunKmStressTests $true
test_command: .\execute_ebpf_cicd_tests.ps1 -RunKmStressTestsOnly $true
post_test: .\cleanup_ebpf_cicd_tests.ps1
build_artifact: Build-x64
environment: ebpf_cicd_tests
Expand All @@ -465,7 +465,7 @@ jobs:
with:
name: km_mt_stress_tests_restart_extension
pre_test: .\setup_ebpf_cicd_stress_tests.ps1
test_command: .\execute_ebpf_cicd_stress_tests.ps1 -RunKmStressTests $true -RestartExtension $true
test_command: .\execute_ebpf_cicd_stress_tests.ps1 -RunKmStressTestsOnly $true -RestartExtension $true
post_test: .\cleanup_ebpf_cicd_tests.ps1
build_artifact: Build-x64
environment: ebpf_cicd_tests
Expand Down
26 changes: 18 additions & 8 deletions scripts/execute_ebpf_cicd_tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ param ([parameter(Mandatory=$false)][string] $AdminTarget = "TEST_VM",
[parameter(Mandatory=$false)][string] $WorkingDirectory = $pwd.ToString(),
[parameter(Mandatory=$false)][string] $TestExecutionJsonFileName = "test_execution.json",
[parameter(Mandatory=$false)][bool] $Coverage = $false,
[parameter(Mandatory=$false)][bool] $RunKmStressTests = $false,
[parameter(Mandatory=$false)][bool] $RunKmStressTestsOnly = $false,
[parameter(Mandatory=$false)][bool] $RestartExtension = $false,
[parameter(Mandatory=$false)][string] $SelfHostedRunnerName)

Expand All @@ -29,16 +29,26 @@ foreach ($VM in $VMList) {
Invoke-CICDTestsOnVM `
-VMName $VM.Name `
-Coverage $Coverage `
-RunKmStressTests $RunKmStressTests `
-RunKmStressTestsOnly $RunKmStressTestsOnly `
-RestartExtension $RestartExtension
}

# Run XDP Tests.
Invoke-XDPTestsOnVM $Config.Interfaces $VMList[0].Name

# Run Connect Redirect Tests.
Invoke-ConnectRedirectTestsOnVM $Config.Interfaces $Config.ConnectRedirectTest -UserType "Administrator" $VMList[0].Name
Invoke-ConnectRedirectTestsOnVM $Config.Interfaces $Config.ConnectRedirectTest -UserType "StandardUser" $VMList[0].Name
# This script is used to execute the regular kernel mode tests as well as the scheduled kernel mode stress tests. The
# required behavior is selected by the $RunKmStressTestsOnly parameter which is set to 'true' only for the scheduled
# runs. The other tests i.e., Invoke-XDPTestsOnVM, Invoke-ConnectRedirectTestsOnVM and
# Invoke-ConnectRedirectTestsOnVM are already handled by other jobs, so re-executing them again along with the stress
# tests is redundant.
if ($RunKmStressTestsOnly -eq $false) {

# Run XDP Tests.
Invoke-XDPTestsOnVM $Config.Interfaces $VMList[0].Name

# Run Connect Redirect Tests.
Invoke-ConnectRedirectTestsOnVM $Config.Interfaces $Config.ConnectRedirectTest `
-UserType "Administrator" $VMList[0].Name
Invoke-ConnectRedirectTestsOnVM $Config.Interfaces $Config.ConnectRedirectTest `
-UserType "StandardUser" $VMList[0].Name
}

# Stop eBPF components on test VMs.
foreach ($VM in $VMList) {
Expand Down
13 changes: 8 additions & 5 deletions scripts/vm_run_tests.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ function Invoke-CICDTestsOnVM
param([parameter(Mandatory=$true)] [string] $VMName,
[parameter(Mandatory=$false)] [bool] $VerboseLogs = $false,
[parameter(Mandatory=$false)] [bool] $Coverage = $false,
[parameter(Mandatory=$false)][bool] $RunKmStressTests = $false,
[parameter(Mandatory=$false)][bool] $RunKmStressTestsOnly = $false,
[parameter(Mandatory=$false)][bool] $RestartExtension = $false)

if ($RunKmStressTests -eq $true) {
if ($RunKmStressTestsOnly -eq $true) {
Write-Log "Executing eBPF kernel mode multi-threaded stress tests on $VMName"
} else {
Write-Log "Running eBPF CI/CD tests on $VMName"
Expand All @@ -34,19 +34,22 @@ function Invoke-CICDTestsOnVM
param([Parameter(Mandatory=$True)] [string] $WorkingDirectory,
[Parameter(Mandatory=$True)] [string] $LogFileName,
[Parameter(Mandatory=$True)] [bool] $VerboseLogs,
[Parameter(Mandatory=$True)] [bool] $Coverage)
[Parameter(Mandatory=$True)] [bool] $Coverage,
[parameter(Mandatory=$True)][bool] $RunKmStressTestsOnly,
[parameter(Mandatory=$True)][bool] $RestartExtension)

$WorkingDirectory = "$Env:SystemDrive\$WorkingDirectory"
Import-Module $WorkingDirectory\common.psm1 -ArgumentList ($LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\run_driver_tests.psm1 -ArgumentList ($WorkingDirectory, $LogFileName) -Force -WarningAction SilentlyContinue

if ($RunKmStressTests -eq $true) {
if ($RunKmStressTestsOnly -eq $true) {
Invoke-CICDStressTests -VerboseLogs $VerboseLogs -Coverage $Coverage `
-RestartExtension $RestartExtension 2>&1 | Write-Log
} else {
Invoke-CICDTests -VerboseLogs $VerboseLogs -Coverage $Coverage 2>&1 | Write-Log
}

} -ArgumentList ("eBPF", $LogFileName, $VerboseLogs, $Coverage) -ErrorAction Stop
} -ArgumentList ("eBPF", $LogFileName, $VerboseLogs, $Coverage, $RunKmStressTestsOnly, $RestartExtension) -ErrorAction Stop
}

function Add-eBPFProgramOnVM
Expand Down

0 comments on commit d24f4da

Please sign in to comment.