Skip to content

Commit 806eb63

Browse files
committed
Enable all tests
1 parent fea0542 commit 806eb63

File tree

3 files changed

+71
-73
lines changed

3 files changed

+71
-73
lines changed

contrib/win32/openssh/AzDOBuildTools/AzDOBuildTools.psm1

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -200,20 +200,20 @@ function Invoke-OpenSSHTests
200200
# ...
201201
# FixHostFilePermissions.ps1
202202
# ...
203-
# Write-Verbose -Verbose -Message "Running Unit Tests..."
204-
# Write-Verbose -Verbose -Message "Unit test directory is: ${OpenSSHBinPath}"
203+
Write-Verbose -Verbose -Message "Running Unit Tests..."
204+
Write-Verbose -Verbose -Message "Unit test directory is: ${OpenSSHBinPath}"
205205

206-
# $unitTestFailed = Invoke-OpenSSHUnitTest -UnitTestDirectory $OpenSSHBinPath
206+
$unitTestFailed = Invoke-OpenSSHUnitTest -UnitTestDirectory $OpenSSHBinPath
207207

208-
# if($unitTestFailed)
209-
# {
210-
# Write-BuildMessage "At least one of the unit tests failed!" -Category Error
211-
# $AllTestsPassed = $false
212-
# }
213-
# else
214-
# {
215-
# Write-BuildMessage -Message "All Unit tests passed!" -Category Information
216-
# }
208+
if($unitTestFailed)
209+
{
210+
Write-BuildMessage "At least one of the unit tests failed!" -Category Error
211+
$AllTestsPassed = $false
212+
}
213+
else
214+
{
215+
Write-BuildMessage -Message "All Unit tests passed!" -Category Information
216+
}
217217

218218
# Run all E2E tests.
219219
Write-Verbose -Verbose -Message "Running E2E Tests..."
@@ -239,62 +239,62 @@ function Invoke-OpenSSHTests
239239
}
240240
}
241241

242-
# # Bash tests.
243-
# Write-Verbose -Verbose -Message "Running Bash Tests..."
244-
245-
# # Ensure CygWin is installed, and install from Chocolatey if needed.
246-
# $cygwinInstalled = $true
247-
# $cygwinInstallLocation = "$env:SystemDrive/cygwin"
248-
# if (! (Test-Path -Path "$cygwinInstallLocation/bin/sh.exe"))
249-
# {
250-
# Write-Verbose -Verbose -Message "CygWin not found"
251-
# Install-CygWin -InstallLocation $cygwinInstallLocation
252-
253-
# # Hack to fix up mangled CygWin directory, if needed.
254-
# $expectedCygWinPath = "$env:SystemDrive/cygwin/bin/sh.exe"
255-
# if (! (Test-Path -Path $expectedCygWinPath))
256-
# {
257-
# Write-Verbose -Verbose -Message "CygWin did not install correctly, missing expected path: ${expectedCygWinPath}"
258-
259-
# $cygWinDirs = Get-Item -Path "$env:SystemDrive/cygwin*"
260-
# if ($cygWinDirs.Count -gt 1)
261-
# {
262-
# Write-Verbose -Verbose -Message "CygWin install failed with mangled folder locations: ${cygWinDirs}"
263-
# Write-Verbose -Verbose -Message 'TODO: Add hack to fix up CygWin folder.'
264-
# }
265-
266-
# Write-BuildMessage -Message "All bash tests failed because CygWin install failed" -Category Error
267-
# $AllTestsPassed = $false
268-
# $cygwinInstalled = $false
269-
# }
270-
# }
271-
272-
# # Run UNIX bash tests.
273-
# if ($cygwinInstalled)
274-
# {
275-
# Write-Verbose -Verbose -Message "Starting Bash Tests..."
276-
# Invoke-OpenSSHBashTests
277-
# if (-not $Global:bash_tests_summary)
278-
# {
279-
# $errorMessage = "Failed to start OpenSSH bash tests"
280-
# Write-BuildMessage -Message $errorMessage -Category Error
281-
# $AllTestsPassed = $false
282-
# }
283-
# else
284-
# {
285-
# if ($Global:bash_tests_summary["TotalBashTestsFailed"] -ne 0)
286-
# {
287-
# $total_bash_failed_tests = $Global:bash_tests_summary["TotalBashTestsFailed"]
288-
# $total_bash_tests = $Global:bash_tests_summary["TotalBashTests"]
289-
# $errorMessage = "At least one of the bash tests failed. [$total_bash_failed_tests of $total_bash_tests]"
290-
# Write-BuildMessage -Message $errorMessage -Category Error
291-
# $AllTestsPassed = $false
292-
# }
293-
294-
# $OpenSSHTestInfo["BashTestSummaryFile"] = $Global:bash_tests_summary["BashTestSummaryFile"]
295-
# $OpenSSHTestInfo["BashTestLogFile"] = $Global:bash_tests_summary["BashTestLogFile"]
296-
# }
297-
# }
242+
# Bash tests.
243+
Write-Verbose -Verbose -Message "Running Bash Tests..."
244+
245+
# Ensure CygWin is installed, and install from Chocolatey if needed.
246+
$cygwinInstalled = $true
247+
$cygwinInstallLocation = "$env:SystemDrive/cygwin"
248+
if (! (Test-Path -Path "$cygwinInstallLocation/bin/sh.exe"))
249+
{
250+
Write-Verbose -Verbose -Message "CygWin not found"
251+
Install-CygWin -InstallLocation $cygwinInstallLocation
252+
253+
# Hack to fix up mangled CygWin directory, if needed.
254+
$expectedCygWinPath = "$env:SystemDrive/cygwin/bin/sh.exe"
255+
if (! (Test-Path -Path $expectedCygWinPath))
256+
{
257+
Write-Verbose -Verbose -Message "CygWin did not install correctly, missing expected path: ${expectedCygWinPath}"
258+
259+
$cygWinDirs = Get-Item -Path "$env:SystemDrive/cygwin*"
260+
if ($cygWinDirs.Count -gt 1)
261+
{
262+
Write-Verbose -Verbose -Message "CygWin install failed with mangled folder locations: ${cygWinDirs}"
263+
Write-Verbose -Verbose -Message 'TODO: Add hack to fix up CygWin folder.'
264+
}
265+
266+
Write-BuildMessage -Message "All bash tests failed because CygWin install failed" -Category Error
267+
$AllTestsPassed = $false
268+
$cygwinInstalled = $false
269+
}
270+
}
271+
272+
# Run UNIX bash tests.
273+
if ($cygwinInstalled)
274+
{
275+
Write-Verbose -Verbose -Message "Starting Bash Tests..."
276+
Invoke-OpenSSHBashTests
277+
if (-not $Global:bash_tests_summary)
278+
{
279+
$errorMessage = "Failed to start OpenSSH bash tests"
280+
Write-BuildMessage -Message $errorMessage -Category Error
281+
$AllTestsPassed = $false
282+
}
283+
else
284+
{
285+
if ($Global:bash_tests_summary["TotalBashTestsFailed"] -ne 0)
286+
{
287+
$total_bash_failed_tests = $Global:bash_tests_summary["TotalBashTestsFailed"]
288+
$total_bash_tests = $Global:bash_tests_summary["TotalBashTests"]
289+
$errorMessage = "At least one of the bash tests failed. [$total_bash_failed_tests of $total_bash_tests]"
290+
Write-BuildMessage -Message $errorMessage -Category Error
291+
$AllTestsPassed = $false
292+
}
293+
294+
$OpenSSHTestInfo["BashTestSummaryFile"] = $Global:bash_tests_summary["BashTestSummaryFile"]
295+
$OpenSSHTestInfo["BashTestLogFile"] = $Global:bash_tests_summary["BashTestLogFile"]
296+
}
297+
}
298298

299299
# OpenSSH Uninstall Tests
300300
Invoke-OpenSSHUninstallTest

contrib/win32/openssh/OpenSSHTestHelper.psm1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -689,10 +689,8 @@ function Invoke-OpenSSHE2ETest
689689
# Discover all CI tests and run them.
690690
Push-Location $Script:E2ETestDirectory
691691
Write-Log -Message "Running OpenSSH E2E tests..."
692-
# $testFolders = @(Get-ChildItem *.tests.ps1 -Recurse | ForEach-Object{ Split-Path $_.FullName} | Sort-Object -Unique)
693-
# Invoke-Pester $testFolders -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru
694-
Invoke-Pester .\SSH.tests.ps1 -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru
695-
Invoke-Pester .\ShellHost.tests.ps1 -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru
692+
$testFolders = @(Get-ChildItem *.tests.ps1 -Recurse | ForEach-Object{ Split-Path $_.FullName} | Sort-Object -Unique)
693+
Invoke-Pester $testFolders -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru
696694
Pop-Location
697695
}
698696

regress/pesterTests/PlatformAbstractLayer.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Enum PlatformType {
1919
function Set-Platform {
2020
# Use the .NET Core APIs to determine the current platform; if a runtime
2121
# exception is thrown, we are on FullCLR, not .NET Core.
22-
if($IsOSX) {
22+
if($IsMacOS) {
2323
[PlatformType]::OSX
2424
} elseif($IsLinux) {
2525
[PlatformType]::Linux

0 commit comments

Comments
 (0)