Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/v7.2.5] Make Assembly Load Native test work on a FX Dependent Linux Install #17496

Merged
merged 2 commits into from Jun 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions test/powershell/engine/Basic/Assembly.LoadNative.Tests.ps1
Expand Up @@ -24,23 +24,29 @@ 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"
}

$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

Expand Down