Only run the failing tests

This commit is contained in:
Vivian Thiebaut 2022-11-15 11:16:14 -05:00
parent 3c19f2aa0e
commit c5b985c66f
3 changed files with 67 additions and 66 deletions

View File

@ -200,20 +200,20 @@ function Invoke-OpenSSHTests
# ... # ...
# FixHostFilePermissions.ps1 # FixHostFilePermissions.ps1
# ... # ...
Write-Verbose -Verbose -Message "Running Unit Tests..." # Write-Verbose -Verbose -Message "Running Unit Tests..."
Write-Verbose -Verbose -Message "Unit test directory is: ${OpenSSHBinPath}" # Write-Verbose -Verbose -Message "Unit test directory is: ${OpenSSHBinPath}"
$unitTestFailed = Invoke-OpenSSHUnitTest -UnitTestDirectory $OpenSSHBinPath # $unitTestFailed = Invoke-OpenSSHUnitTest -UnitTestDirectory $OpenSSHBinPath
if($unitTestFailed) # if($unitTestFailed)
{ # {
Write-BuildMessage "At least one of the unit tests failed!" -Category Error # Write-BuildMessage "At least one of the unit tests failed!" -Category Error
$AllTestsPassed = $false # $AllTestsPassed = $false
} # }
else # else
{ # {
Write-BuildMessage -Message "All Unit tests passed!" -Category Information # Write-BuildMessage -Message "All Unit tests passed!" -Category Information
} # }
# Run all E2E tests. # Run all E2E tests.
Write-Verbose -Verbose -Message "Running E2E Tests..." Write-Verbose -Verbose -Message "Running E2E Tests..."
@ -239,62 +239,62 @@ function Invoke-OpenSSHTests
} }
} }
# Bash tests. # # Bash tests.
Write-Verbose -Verbose -Message "Running Bash Tests..." # Write-Verbose -Verbose -Message "Running Bash Tests..."
# Ensure CygWin is installed, and install from Chocolatey if needed. # # Ensure CygWin is installed, and install from Chocolatey if needed.
$cygwinInstalled = $true # $cygwinInstalled = $true
$cygwinInstallLocation = "$env:SystemDrive/cygwin" # $cygwinInstallLocation = "$env:SystemDrive/cygwin"
if (! (Test-Path -Path "$cygwinInstallLocation/bin/sh.exe")) # if (! (Test-Path -Path "$cygwinInstallLocation/bin/sh.exe"))
{ # {
Write-Verbose -Verbose -Message "CygWin not found" # Write-Verbose -Verbose -Message "CygWin not found"
Install-CygWin -InstallLocation $cygwinInstallLocation # Install-CygWin -InstallLocation $cygwinInstallLocation
# Hack to fix up mangled CygWin directory, if needed. # # Hack to fix up mangled CygWin directory, if needed.
$expectedCygWinPath = "$env:SystemDrive/cygwin/bin/sh.exe" # $expectedCygWinPath = "$env:SystemDrive/cygwin/bin/sh.exe"
if (! (Test-Path -Path $expectedCygWinPath)) # if (! (Test-Path -Path $expectedCygWinPath))
{ # {
Write-Verbose -Verbose -Message "CygWin did not install correctly, missing expected path: ${expectedCygWinPath}" # Write-Verbose -Verbose -Message "CygWin did not install correctly, missing expected path: ${expectedCygWinPath}"
$cygWinDirs = Get-Item -Path "$env:SystemDrive/cygwin*" # $cygWinDirs = Get-Item -Path "$env:SystemDrive/cygwin*"
if ($cygWinDirs.Count -gt 1) # if ($cygWinDirs.Count -gt 1)
{ # {
Write-Verbose -Verbose -Message "CygWin install failed with mangled folder locations: ${cygWinDirs}" # Write-Verbose -Verbose -Message "CygWin install failed with mangled folder locations: ${cygWinDirs}"
Write-Verbose -Verbose -Message 'TODO: Add hack to fix up CygWin folder.' # Write-Verbose -Verbose -Message 'TODO: Add hack to fix up CygWin folder.'
} # }
Write-BuildMessage -Message "All bash tests failed because CygWin install failed" -Category Error # Write-BuildMessage -Message "All bash tests failed because CygWin install failed" -Category Error
$AllTestsPassed = $false # $AllTestsPassed = $false
$cygwinInstalled = $false # $cygwinInstalled = $false
} # }
} # }
# Run UNIX bash tests. # # Run UNIX bash tests.
if ($cygwinInstalled) # if ($cygwinInstalled)
{ # {
Write-Verbose -Verbose -Message "Starting Bash Tests..." # Write-Verbose -Verbose -Message "Starting Bash Tests..."
Invoke-OpenSSHBashTests # Invoke-OpenSSHBashTests
if (-not $Global:bash_tests_summary) # if (-not $Global:bash_tests_summary)
{ # {
$errorMessage = "Failed to start OpenSSH bash tests" # $errorMessage = "Failed to start OpenSSH bash tests"
Write-BuildMessage -Message $errorMessage -Category Error # Write-BuildMessage -Message $errorMessage -Category Error
$AllTestsPassed = $false # $AllTestsPassed = $false
} # }
else # else
{ # {
if ($Global:bash_tests_summary["TotalBashTestsFailed"] -ne 0) # if ($Global:bash_tests_summary["TotalBashTestsFailed"] -ne 0)
{ # {
$total_bash_failed_tests = $Global:bash_tests_summary["TotalBashTestsFailed"] # $total_bash_failed_tests = $Global:bash_tests_summary["TotalBashTestsFailed"]
$total_bash_tests = $Global:bash_tests_summary["TotalBashTests"] # $total_bash_tests = $Global:bash_tests_summary["TotalBashTests"]
$errorMessage = "At least one of the bash tests failed. [$total_bash_failed_tests of $total_bash_tests]" # $errorMessage = "At least one of the bash tests failed. [$total_bash_failed_tests of $total_bash_tests]"
Write-BuildMessage -Message $errorMessage -Category Error # Write-BuildMessage -Message $errorMessage -Category Error
$AllTestsPassed = $false # $AllTestsPassed = $false
} # }
$OpenSSHTestInfo["BashTestSummaryFile"] = $Global:bash_tests_summary["BashTestSummaryFile"] # $OpenSSHTestInfo["BashTestSummaryFile"] = $Global:bash_tests_summary["BashTestSummaryFile"]
$OpenSSHTestInfo["BashTestLogFile"] = $Global:bash_tests_summary["BashTestLogFile"] # $OpenSSHTestInfo["BashTestLogFile"] = $Global:bash_tests_summary["BashTestLogFile"]
} # }
} # }
# OpenSSH Uninstall Tests # OpenSSH Uninstall Tests
Invoke-OpenSSHUninstallTest Invoke-OpenSSHUninstallTest

View File

@ -689,8 +689,9 @@ function Invoke-OpenSSHE2ETest
# Discover all CI tests and run them. # Discover all CI tests and run them.
Push-Location $Script:E2ETestDirectory Push-Location $Script:E2ETestDirectory
Write-Log -Message "Running OpenSSH E2E tests..." Write-Log -Message "Running OpenSSH E2E tests..."
$testFolders = @(Get-ChildItem *.tests.ps1 -Recurse | ForEach-Object{ Split-Path $_.FullName} | Sort-Object -Unique) # $testFolders = @(Get-ChildItem *.tests.ps1 -Recurse | ForEach-Object{ Split-Path $_.FullName} | Sort-Object -Unique)
Invoke-Pester $testFolders -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru # Invoke-Pester $testFolders -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru
Invoke-Pester .\FileBasedLogging.tests.ps1 -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru
Pop-Location Pop-Location
} }

View File

@ -131,11 +131,11 @@ Describe "Tests for admin and non-admin file based logs" -Tags "CI" {
if($OpenSSHTestInfo["NoLibreSSL"]) if($OpenSSHTestInfo["NoLibreSSL"])
{ {
ssh-keygen.exe -t ed25519 -f $KeyFilePath -Z -P `"`" aes128-ctr ssh-keygen.exe -t ed25519 -f $KeyFilePath -Z -P "" aes128-ctr
} }
else else
{ {
ssh-keygen.exe -t ed25519 -f $KeyFilePath -P `"`" ssh-keygen.exe -t ed25519 -f $KeyFilePath -P ""
} }
Copy-Item "$keyFilePath.pub" $authorizedkeyPath -Force -ErrorAction SilentlyContinue Copy-Item "$keyFilePath.pub" $authorizedkeyPath -Force -ErrorAction SilentlyContinue
Repair-AuthorizedKeyPermission -Filepath $authorizedkeyPath -confirm:$false Repair-AuthorizedKeyPermission -Filepath $authorizedkeyPath -confirm:$false