32 lines
1.9 KiB
PowerShell
32 lines
1.9 KiB
PowerShell
|
|
param([switch]$RequireToolchain)
|
||
|
|
$ErrorActionPreference = 'Stop'
|
||
|
|
$workspace = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..')).Path
|
||
|
|
|
||
|
|
function Run-CheckedPowerShell([string]$Path) {
|
||
|
|
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File $Path
|
||
|
|
if ($LASTEXITCODE -ne 0) { throw "PowerShell test failed: $Path" }
|
||
|
|
}
|
||
|
|
Run-CheckedPowerShell (Join-Path $workspace 'tests\kernel-source-contract.ps1')
|
||
|
|
Run-CheckedPowerShell (Join-Path $workspace 'tests\source-contract.ps1')
|
||
|
|
|
||
|
|
$node = Get-Command node -ErrorAction SilentlyContinue
|
||
|
|
if ($node) {
|
||
|
|
foreach ($test in @('js-syntax.mjs','module-clone.mjs','precision-reference.mjs','analytic-interior.mjs','pixel-mapping.mjs','pixel-contract.mjs','runtime-budget.mjs')) {
|
||
|
|
& $node.Source (Join-Path $workspace "tests\$test")
|
||
|
|
if ($LASTEXITCODE -ne 0) { throw "Node regression test failed: $test" }
|
||
|
|
}
|
||
|
|
} elseif ($RequireToolchain) { throw 'Node.js is required by -RequireToolchain.' }
|
||
|
|
else { Write-Warning 'Node.js is unavailable; executable JavaScript/WASM tests were skipped.' }
|
||
|
|
|
||
|
|
$clang = Get-Command clang -ErrorAction SilentlyContinue
|
||
|
|
$sourceGolden = $false
|
||
|
|
if ($clang -and $node -and ((& $clang.Source --version | Select-Object -First 1) -match '17\.0\.6')) {
|
||
|
|
$generated = & powershell.exe -NoProfile -ExecutionPolicy Bypass -File (Join-Path $workspace 'scripts\build-wasm.ps1') -Compiler $clang.Source
|
||
|
|
if ($LASTEXITCODE -ne 0) { throw 'Source-WASM build failed.' }
|
||
|
|
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File (Join-Path $workspace 'tests\kernel-golden.ps1') -GeneratedDirectory (Split-Path $generated)
|
||
|
|
if ($LASTEXITCODE -ne 0) { throw 'Generated-WASM golden failed.' }
|
||
|
|
$sourceGolden = $true
|
||
|
|
} elseif ($RequireToolchain) { throw 'clang 17.0.6 is required by -RequireToolchain.' }
|
||
|
|
else { Write-Warning 'clang 17.0.6 is unavailable; source-WASM build/golden was skipped.' }
|
||
|
|
|
||
|
|
[ordered]@{ status='pass'; nodeTests=[bool]$node; sourceWasmGolden=$sourceGolden } | ConvertTo-Json
|