Skip to content

Commit

Permalink
integrate numiterations to test.ps1 script
Browse files Browse the repository at this point in the history
  • Loading branch information
ProjectsByJackHe committed Sep 5, 2023
1 parent 45a7d9b commit c3ebef9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 40 deletions.
34 changes: 0 additions & 34 deletions scripts/iter_command.ps1

This file was deleted.

32 changes: 26 additions & 6 deletions scripts/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ This script runs the MsQuic tests.
.Parameter DuoNic
Uses DuoNic instead of loopback (DuoNic must already be installed via 'prepare-machine.ps1 -InstallDuoNic').
.Parameter NumIterations
Number of times to run this particular command. Catches tricky edge cases due to random nature of networks.
.EXAMPLE
test.ps1
Expand All @@ -85,6 +88,8 @@ This script runs the MsQuic tests.
.EXAMPLE
test.ps1 -LogProfile Full.Verbose -Compress
.EXAMPLE
test.ps1 -Filter ParameterValidation* -NumIterations 10
#>

param (
Expand Down Expand Up @@ -172,7 +177,10 @@ param (
[switch]$UseQtip = $false,

[Parameter(Mandatory = $false)]
[string]$OsRunner = ""
[string]$OsRunner = "",

[Parameter(Mandatory = $false)]
[int]$NumIterations = 0
)

Set-StrictMode -Version 'Latest'
Expand Down Expand Up @@ -344,12 +352,24 @@ if (![string]::IsNullOrWhiteSpace($ExtraArtifactDir)) {
$TestArguments += " -ExtraArtifactDir $ExtraArtifactDir"
}

# Run the script.
if (!$Kernel -and !$SkipUnitTests) {
Invoke-Expression ($RunTest + " -Path $MsQuicPlatTest " + $TestArguments)
Invoke-Expression ($RunTest + " -Path $MsQuicCoreTest " + $TestArguments)
if ($NumIterations -gt 1) {
for ($iteration = 1; $iteration -le $NumIterations; $iteration++) {
Write-Host "------- Iteration $iteration -------"

if (!$Kernel -and !$SkipUnitTests) {
Invoke-Expression ($RunTest + " -Path $MsQuicPlatTest " + $TestArguments)
Invoke-Expression ($RunTest + " -Path $MsQuicCoreTest " + $TestArguments)
}
Invoke-Expression ($RunTest + " -Path $MsQuicTest " + $TestArguments)
}
} else {
# Run the script.
if (!$Kernel -and !$SkipUnitTests) {
Invoke-Expression ($RunTest + " -Path $MsQuicPlatTest " + $TestArguments)
Invoke-Expression ($RunTest + " -Path $MsQuicCoreTest " + $TestArguments)
}
Invoke-Expression ($RunTest + " -Path $MsQuicTest " + $TestArguments)
}
Invoke-Expression ($RunTest + " -Path $MsQuicTest " + $TestArguments)

if ($CodeCoverage) {
# Merge code coverage results
Expand Down

0 comments on commit c3ebef9

Please sign in to comment.