param(
[string]$Library = 'artifacts/galaxy-thargoid-tests/publish/Standalone/release_win-x64/XFEEDNavigation.dll',
[string]$Report = 'artifacts/galaxy-thargoid-tests/thargoid-selftest.json',
[ValidateSet('XFENavigationGalaxyThargoidSelfTest','XFENavigationGalaxyPowerOptionsSelfTest','XFENavigationGalaxyPowerOuterSelfTest','XFENavigationGalaxyPowerOuterWireSelfTest','XFENavigationGalaxyAccountFleetSelfTest','XFENavigationGalaxyAccountMissionsSelfTest')]
[string]$Export = 'XFENavigationGalaxyThargoidSelfTest'
)
$ErrorActionPreference = 'Stop'
$libraryPath = (Resolve-Path -LiteralPath $Library).Path
Add-Type -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
public static class GalaxyThargoidFixture {
[DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)]
public static extern IntPtr LoadLibraryW(string path);
[DllImport("kernel32.dll", CharSet=CharSet.Ansi, ExactSpelling=true)]
public static extern IntPtr GetProcAddress(IntPtr library,string name);
[UnmanagedFunctionPointer(CallingConvention.Winapi)] public delegate uint Probe();
}
'@
$handle = [GalaxyThargoidFixture]::LoadLibraryW($libraryPath)
if ($handle -eq [IntPtr]::Zero) { throw 'Could not load the private fixture library.' }
$entry = [GalaxyThargoidFixture]::GetProcAddress($handle, $Export)
if ($entry -eq [IntPtr]::Zero) { throw 'Missing isolated fixture export.' }
$probe = [Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer[GalaxyThargoidFixture+Probe]($entry)
$masks = @(1..8 | ForEach-Object { $probe.Invoke() })
$expected = if ($Export -eq 'XFENavigationGalaxyPowerOuterWireSelfTest') { 255 } else { 65535 }
if (@($masks | Where-Object { $_ -ne $expected }).Count -ne 0) { throw "Galaxy fixture failed: $($masks -join ',')" }
$result = [ordered]@{
passed = $true; gameAccess = $false; networkAccess = $false
processScope = 'own fixture process and private allocations'
export = $Export; expected = $expected; masks = $masks
library = $libraryPath; sha256 = (Get-FileHash -LiteralPath $libraryPath -Algorithm SHA256).Hash.ToLowerInvariant()
}
$result | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $Report -Encoding utf8
$result | ConvertTo-Json -Depth 5
# NativeAOT DLL intentionally remains loaded until this fixture process exits.
# Do not call XFENavigationStart or any other export in this isolated runner.
param(
[string]$Library = 'artifacts/galaxy-thargoid-tests/publish/Standalone/release_win-x64/XFEEDNavigation.dll',
[string]$Report = 'artifacts/galaxy-thargoid-tests/thargoid-selftest.json',
[ValidateSet('XFENavigationGalaxyThargoidSelfTest','XFENavigationGalaxyPowerOptionsSelfTest','XFENavigationGalaxyPowerOuterSelfTest','XFENavigationGalaxyPowerOuterWireSelfTest','XFENavigationGalaxyAccountFleetSelfTest','XFENavigationGalaxyAccountMissionsSelfTest')]
[string]$Export = 'XFENavigationGalaxyThargoidSelfTest'
)
$ErrorActionPreference = 'Stop'
$libraryPath = (Resolve-Path -LiteralPath $Library).Path
Add-Type -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
public static class GalaxyThargoidFixture {
[DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)]
public static extern IntPtr LoadLibraryW(string path);
[DllImport("kernel32.dll", CharSet=CharSet.Ansi, ExactSpelling=true)]
public static extern IntPtr GetProcAddress(IntPtr library,string name);
[UnmanagedFunctionPointer(CallingConvention.Winapi)] public delegate uint Probe();
}
'@
$handle = [GalaxyThargoidFixture]::LoadLibraryW($libraryPath)
if ($handle -eq [IntPtr]::Zero) { throw 'Could not load the private fixture library.' }
$entry = [GalaxyThargoidFixture]::GetProcAddress($handle, $Export)
if ($entry -eq [IntPtr]::Zero) { throw 'Missing isolated fixture export.' }
$probe = [Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer[GalaxyThargoidFixture+Probe]($entry)
$masks = @(1..8 | ForEach-Object { $probe.Invoke() })
$expected = if ($Export -eq 'XFENavigationGalaxyPowerOuterWireSelfTest') { 255 } else { 65535 }
if (@($masks | Where-Object { $_ -ne $expected }).Count -ne 0) { throw "Galaxy fixture failed: $($masks -join ',')" }
$result = [ordered]@{
passed = $true; gameAccess = $false; networkAccess = $false
processScope = 'own fixture process and private allocations'
export = $Export; expected = $expected; masks = $masks
library = $libraryPath; sha256 = (Get-FileHash -LiteralPath $libraryPath -Algorithm SHA256).Hash.ToLowerInvariant()
}
$result | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $Report -Encoding utf8
$result | ConvertTo-Json -Depth 5
# NativeAOT DLL intentionally remains loaded until this fixture process exits.
# Do not call XFENavigationStart or any other export in this isolated runner.