Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,18 @@ jobs:
run: |
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\ParallelKit.Harness.ps1
exit $LASTEXITCODE

# PowerShell 7 isn't a supported target. This job is informational, to see
# whether the kit keeps working there; it isn't a required check.
harness-pwsh:
name: Harness (PowerShell 7)
runs-on: windows-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4

- name: Run ParallelKit.Harness.ps1 under pwsh
shell: pwsh
run: |
& pwsh -NoProfile -ExecutionPolicy Bypass -File .\ParallelKit.Harness.ps1
exit $LASTEXITCODE
7 changes: 5 additions & 2 deletions ParallelKit.Harness.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ function New-JobList {
}

$cmdExe = Join-Path $env:SystemRoot "System32\cmd.exe"
# Whichever PowerShell is running the harness (powershell.exe or pwsh.exe),
# for the tests that need a fresh process of the same version.
$selfExe = [System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName
$pingExe = Join-Path $env:SystemRoot "System32\ping.exe"

# A user function the workers share.
Expand Down Expand Up @@ -681,7 +684,7 @@ $kitPath = Join-Path $PSScriptRoot "ParallelKit.ps1"
[System.Threading.ThreadPool]::GetMinThreads([ref]`$w, [ref]`$io)
Write-Output ("before=" + `$before + " after=" + [PkChildProcessJob]::IsInitialized + " threads=" + `$w)
"@)
$probe = Invoke-PkProcessWithTimeout -FilePath (Join-Path $PSHOME "powershell.exe") -Arguments ('-NoProfile -ExecutionPolicy Bypass -File "' + $probeScript + '"') -TimeoutMs 60000
$probe = Invoke-PkProcessWithTimeout -FilePath $selfExe -Arguments ('-NoProfile -ExecutionPolicy Bypass -File "' + $probeScript + '"') -TimeoutMs 60000
[System.IO.File]::Delete($probeScript)
Test-Assert ($probe.Stdout -match 'before=False after=True') ("starting a process sets up child cleanup by itself (" + ([string]$probe.Stdout).Trim() + ")")
$probeThreads = 0
Expand Down Expand Up @@ -973,7 +976,7 @@ $staleScript = Join-Path $env:TEMP ("pk-stale-" + [guid]::NewGuid().ToString("N"
Add-Type -TypeDefinition 'public static class PkConsoleCtrl { } public static class PkState { }'
try { . '$kitPath'; Write-Output 'LOADED' } catch { Write-Output ('REFUSED: ' + `$_) }
"@)
$stale = Invoke-PkProcessWithTimeout -FilePath (Join-Path $PSHOME "powershell.exe") -Arguments ('-NoProfile -ExecutionPolicy Bypass -File "' + $staleScript + '"') -TimeoutMs 60000
$stale = Invoke-PkProcessWithTimeout -FilePath $selfExe -Arguments ('-NoProfile -ExecutionPolicy Bypass -File "' + $staleScript + '"') -TimeoutMs 60000
[System.IO.File]::Delete($staleScript)
Test-Assert ($stale.Stdout -like '*REFUSED:*older version of the kit*start a new one*') "loading the kit over an older copy's types is refused with a clear message"

Expand Down
Loading