mirror of
https://github.com/PowerShell/PowerShell.git
synced 2024-11-23 09:43:57 +08:00
Make the event handler leaking test stable (#10790)
This commit is contained in:
parent
25286eb047
commit
48db3de03e
13
build.psm1
13
build.psm1
@ -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"
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user