diff options
Diffstat (limited to 'scripts/windows_check.ps1')
| -rw-r--r-- | scripts/windows_check.ps1 | 68 |
1 files changed, 50 insertions, 18 deletions
diff --git a/scripts/windows_check.ps1 b/scripts/windows_check.ps1 index 7c225301..1907d66b 100644 --- a/scripts/windows_check.ps1 +++ b/scripts/windows_check.ps1 @@ -29,6 +29,53 @@ function Invoke-CargoWithZigCacheRecovery { Invoke-Checked cargo $Arguments } +function Invoke-CargoTestFilter { + param( + [Parameter(Mandatory)] + [string]$Filter, + [switch]$Exact + ) + + $commonArguments = @( + "test", + "--locked", + "--target", + "x86_64-pc-windows-msvc", + "--bin", + "herdr", + $Filter + ) + $harnessArguments = @("--list") + if ($Exact) { + $harnessArguments += "--exact" + } + + $listArguments = $commonArguments + @("--") + $harnessArguments + $listOutput = @(& cargo @listArguments) + if ($LASTEXITCODE -ne 0) { + throw "could not enumerate tests for filter '$Filter': $($listOutput -join [Environment]::NewLine)" + } + + $testNames = @( + foreach ($line in $listOutput) { + $match = [regex]::Match([string]$line, '^\s*(\S+): test\s*$') + if ($match.Success) { + $match.Groups[1].Value + } + } + ) + if ($testNames.Count -eq 0) { + throw "test filter '$Filter' selected zero tests" + } + + Write-Host "Running $($testNames.Count) test(s) for '$Filter'" + $runArguments = $commonArguments + if ($Exact) { + $runArguments += @("--", "--exact") + } + Invoke-Checked cargo $runArguments +} + Invoke-Checked rustup @("target", "add", "x86_64-pc-windows-msvc") Invoke-Checked cargo @("fmt", "--check") Invoke-CargoWithZigCacheRecovery @( @@ -47,22 +94,7 @@ if ($Mode -eq "lint") { return } -Invoke-Checked cargo @( - "test", - "--locked", - "--target", - "x86_64-pc-windows-msvc", - "--bin", - "herdr", - "windows_" -) -Invoke-Checked cargo @( - "test", - "--locked", - "--target", - "x86_64-pc-windows-msvc", - "--bin", - "herdr", - "server::client_transport::tests" -) +Invoke-CargoTestFilter "windows_" +Invoke-CargoTestFilter "server::client_transport::tests" +Invoke-CargoTestFilter "app::tests::native_repeats_and_releases_follow_the_pressed_pane" -Exact Invoke-Checked cargo @("build", "--locked", "--target", "x86_64-pc-windows-msvc") |
