# SPDX-License-Identifier: AGPL-3.0-or-later # QA-CORPUS-401-031: Deterministic runner for reachability corpus tests (Windows) [CmdletBinding()] param( [Parameter(HelpMessage = "xUnit filter pattern (e.g., 'CorpusFixtureTests')")] [string]$Filter, [Parameter(HelpMessage = "Test verbosity level")] [ValidateSet("quiet", "minimal", "normal", "detailed", "diagnostic")] [string]$Verbosity = "normal", [Parameter(HelpMessage = "Build configuration")] [ValidateSet("Debug", "Release")] [string]$Configuration = "Release", [Parameter(HelpMessage = "Skip build step")] [switch]$NoBuild ) $ErrorActionPreference = "Stop" $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $RepoRoot = (Resolve-Path (Join-Path $ScriptDir "..\..")).Path $TestProject = Join-Path $RepoRoot "tests\reachability\StellaOps.Reachability.FixtureTests\StellaOps.Reachability.FixtureTests.csproj" function Write-LogInfo { param($Message) Write-Host "[INFO] $Message" -ForegroundColor Green } function Write-LogWarn { param($Message) Write-Host "[WARN] $Message" -ForegroundColor Yellow } function Write-LogError { param($Message) Write-Host "[ERROR] $Message" -ForegroundColor Red } Write-LogInfo "Reachability Corpus Test Runner (Windows)" Write-LogInfo "Repository root: $RepoRoot" Write-LogInfo "Test project: $TestProject" # Verify prerequisites $dotnetPath = Get-Command dotnet -ErrorAction SilentlyContinue if (-not $dotnetPath) { Write-LogError "dotnet CLI not found. Please install .NET SDK." exit 1 } # Verify corpus exists $corpusManifest = Join-Path $RepoRoot "tests\reachability\corpus\manifest.json" if (-not (Test-Path $corpusManifest)) { Write-LogError "Corpus manifest not found at $corpusManifest" exit 1 } $reachbenchIndex = Join-Path $RepoRoot "tests\reachability\fixtures\reachbench-2025-expanded\INDEX.json" if (-not (Test-Path $reachbenchIndex)) { Write-LogError "Reachbench INDEX not found at $reachbenchIndex" exit 1 } # Build if needed if (-not $NoBuild) { Write-LogInfo "Building test project ($Configuration)..." & dotnet build $TestProject -c $Configuration --nologo if ($LASTEXITCODE -ne 0) { Write-LogError "Build failed" exit $LASTEXITCODE } } # Build test command arguments $testArgs = @( "test" $TestProject "-c" $Configuration "--no-build" "--verbosity" $Verbosity ) if ($Filter) { $testArgs += "--filter" $testArgs += "FullyQualifiedName~$Filter" Write-LogInfo "Running tests with filter: $Filter" } else { Write-LogInfo "Running all fixture tests..." } # Run tests Write-LogInfo "Executing: dotnet $($testArgs -join ' ')" & dotnet @testArgs $exitCode = $LASTEXITCODE if ($exitCode -eq 0) { Write-LogInfo "All tests passed!" } else { Write-LogError "Some tests failed (exit code: $exitCode)" } exit $exitCode