Make the event handler leaking test stable (#10790)

This commit is contained in:
Dongbo Wang 2019-10-16 09:55:41 -07:00 committed by GitHub
parent 25286eb047
commit 48db3de03e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 19 deletions

View file

@ -390,11 +390,10 @@ Fix steps:
}
try {
# Relative paths do not work well if cwd is not changed to project
Push-Location $Options.Top
if ($Options.Runtime -notlike 'fxdependent*') {
# Relative paths do not work well if cwd is not changed to project
Push-Location $Options.Top
if ($Options.Runtime -like 'win-arm*') {
$Arguments += "/property:SDKToUse=Microsoft.NET.Sdk"
} else {
@ -410,7 +409,6 @@ Fix steps:
Start-CrossGen -PublishPath $publishPath -Runtime $script:Options.Runtime
Write-Log "pwsh.exe with ngen binaries is available at: $($Options.Output)"
}
} else {
$globalToolSrcFolder = Resolve-Path (Join-Path $Options.Top "../Microsoft.PowerShell.GlobalTool.Shim") | Select-Object -ExpandProperty Path
@ -420,8 +418,6 @@ Fix steps:
$Arguments += "/property:SDKToUse=Microsoft.NET.Sdk.WindowsDesktop"
}
# Relative paths do not work well if cwd is not changed to project
Push-Location $Options.Top
Write-Log "Run dotnet $Arguments from $pwd"
Start-NativeExecution { dotnet $Arguments }
Write-Log "PowerShell output: $($Options.Output)"
@ -440,6 +436,11 @@ Fix steps:
Pop-Location
}
# No extra post-building task will run if '-SMAOnly' is specified, because its purpose is for a quick update of S.M.A.dll after full build.
if ($SMAOnly) {
return
}
# publish reference assemblies
try {
Push-Location "$PSScriptRoot/src/TypeCatalogGen"

View file

@ -12,19 +12,14 @@ namespace PSTests.Parallel
[Fact]
public static void TestScanContent()
{
Assert.Equal(AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED, AmsiUtils.ScanContent(string.Empty, string.Empty));
}
[Fact]
public static void TestCloseSession()
{
AmsiUtils.CloseSession();
}
[Fact]
public static void TestUninitialize()
{
AmsiUtils.Uninitialize();
try
{
Assert.Equal(AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED, AmsiUtils.ScanContent(string.Empty, string.Empty));
}
finally
{
AmsiUtils.Uninitialize();
}
}
}
}