Add a test for the powershell hang fix (#5451)

- Add test for the powershell hang fix
- Ignore the 'Sync-PSTags' warning
This commit is contained in:
Dongbo Wang 2017-11-15 09:41:11 -08:00 committed by GitHub
parent cef7762d18
commit c4f0d1c893
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View file

@ -568,7 +568,7 @@ Fix steps:
if ($ReleaseTagToUse) {
$ReleaseVersion = $ReleaseTagToUse
} else {
$ReleaseVersion = (Get-PSCommitId) -replace '^v'
$ReleaseVersion = (Get-PSCommitId -WarningAction SilentlyContinue) -replace '^v'
}
Start-NativeExecution { & "~/.rcedit/rcedit-x64.exe" "$($Options.Output)" --set-icon "$PSScriptRoot\assets\Powershell_black.ico" `

View file

@ -21,3 +21,27 @@ Describe 'Basic engine APIs' -Tags "CI" {
}
}
}
Describe "Clean up open Runspaces when exit powershell process" -Tags "Feature" {
It "PowerShell process should not freeze at exit" {
$command = @'
-c $rs = [runspacefactory]::CreateRunspacePool(1,5)
$rs.Open()
$ps = [powershell]::Create()
$ps.RunspacePool = $rs
$null = $ps.AddScript(1).Invoke()
write-host should_not_hang_at_exit
exit
'@
$process = Start-Process pwsh -ArgumentList $command -PassThru
Wait-UntilTrue -sb { $process.HasExited } -TimeoutInMilliseconds 5000 -IntervalInMilliseconds 1000 > $null
$expect = "powershell process exits in 5 seconds"
if (-not $process.HasExited) {
Stop-Process -InputObject $process -Force -ErrorAction SilentlyContinue
"powershell process doesn't exit in 5 seconds" | Should Be $expect
} else {
$expect | Should Be $expect
}
}
}