From d9427800e81a4536716e5e933440042832d3f91a Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 18 May 2022 17:34:39 -0700 Subject: [PATCH 1/2] Make Assembly Load Native test work on a FX Dependent Linux Install --- .../engine/Basic/Assembly.LoadNative.Tests.ps1 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/powershell/engine/Basic/Assembly.LoadNative.Tests.ps1 b/test/powershell/engine/Basic/Assembly.LoadNative.Tests.ps1 index 9196ccc0e133..d7df04cc197d 100644 --- a/test/powershell/engine/Basic/Assembly.LoadNative.Tests.ps1 +++ b/test/powershell/engine/Basic/Assembly.LoadNative.Tests.ps1 @@ -24,15 +24,21 @@ Describe "Can load a native assembly" -Tags "CI" { if ($IsWindows) { $arch = "win-" + $processArch $nativeDllName = "nativedll.dll" - $sourceDllName = "hostpolicy.dll" + $sourceDllName = Join-Path $PSHome "hostpolicy.dll" } elseif ($IsLinux) { $arch = "linux-" + $processArch $nativeDllName = "nativedll.so" - $sourceDllName = "libhostpolicy.so" + $sourceDllName = Join-Path $PSHome "libhostpolicy.so" + # This won't be in PSHome in a FX Dependent install + # Fallback to finding it using the process object + if (!(Test-Path $sourceDllName)) { + $thisProcess = Get-Process -pid $pid + $sourceDllName = ($thisProcess.Modules | Where-Object {$_.moduleName -eq 'libhostpolicy.so'}).FileName + } } elseif ($IsMacOS) { $arch = "osx-" + $processArch $nativeDllName = "nativedll.dylib" - $sourceDllName = "libhostpolicy.dylib" + $sourceDllName = Join-Path $PSHome "libhostpolicy.dylib" } else { throw "Unsupported OS" } From 8a2797a9e65c2df332329c42a532373a12da23df Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 20 May 2022 13:26:04 -0700 Subject: [PATCH 2/2] Update Assembly.LoadNative.Tests.ps1 --- test/powershell/engine/Basic/Assembly.LoadNative.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/powershell/engine/Basic/Assembly.LoadNative.Tests.ps1 b/test/powershell/engine/Basic/Assembly.LoadNative.Tests.ps1 index d7df04cc197d..0dd8b23c7ee6 100644 --- a/test/powershell/engine/Basic/Assembly.LoadNative.Tests.ps1 +++ b/test/powershell/engine/Basic/Assembly.LoadNative.Tests.ps1 @@ -46,7 +46,7 @@ Describe "Can load a native assembly" -Tags "CI" { $archFolder = Join-Path $root $arch New-Item -Path $archFolder -ItemType Directory -Force > $null #New-Item -Path $archFolder\$nativeDllName -ItemType File -Force > $null - Copy-Item -Path $PSHOME\$sourceDllName -Destination $archFolder\$nativeDllName + Copy-Item -Path $sourceDllName -Destination $archFolder\$nativeDllName $managedDllPath = Join-Path $root managed.dll