34 lines
1.1 KiB
PowerShell
34 lines
1.1 KiB
PowerShell
param(
|
|
[ValidateSet('Debug', 'Release')]
|
|
[string]$Configuration = 'Debug',
|
|
[ValidateSet('x64', 'Win32')]
|
|
[string]$Platform = 'x64'
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$probe = Join-Path $root "build\$Platform\$Configuration\EasyX.ThreadProbe.exe"
|
|
if (-not (Test-Path -LiteralPath $probe)) {
|
|
throw "Thread probe not built: $probe"
|
|
}
|
|
|
|
$resultRoot = Join-Path $root 'TestResults\easyx-thread-probe'
|
|
New-Item -ItemType Directory -Force -Path $resultRoot | Out-Null
|
|
$resultPath = Join-Path $resultRoot ((Get-Date -Format 'yyyyMMdd-HHmmss-fff') + "-$PID.json")
|
|
|
|
& $probe $resultPath
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "EasyX thread probe failed with exit code $LASTEXITCODE"
|
|
}
|
|
if (-not (Test-Path -LiteralPath $resultPath)) {
|
|
throw "Thread probe result not found: $resultPath"
|
|
}
|
|
|
|
$result = Get-Content -Raw -LiteralPath $resultPath | ConvertFrom-Json
|
|
if (-not $result.completed) {
|
|
throw "Thread probe did not complete: $resultPath"
|
|
}
|
|
|
|
$result | Add-Member -NotePropertyName resultPath -NotePropertyValue $resultPath
|
|
$result
|