Skip to content

[2.x] Add testForkedParallelism setting for forked test thread count#8453

Merged
eed3si9n merged 7 commits intosbt:developfrom
MkDev11:fix/testForkedParallelism-8004
Jan 9, 2026
Merged

[2.x] Add testForkedParallelism setting for forked test thread count#8453
eed3si9n merged 7 commits intosbt:developfrom
MkDev11:fix/testForkedParallelism-8004

Conversation

@MkDev11
Copy link
Copy Markdown
Contributor

@MkDev11 MkDev11 commented Jan 9, 2026

Add testForkedParallelism setting

Fixes #8004

Steps

Configure a project to run forked tests in parallel:

fork := true
testForkedParallel := true

Problems

When running forked tests, sbt uses Runtime.getRuntime().availableProcessors() to determine the thread pool size, ignoring concurrentRestrictions. This is inconsistent with non-forked parallel tests.

Expectations

Users should be able to control the number of parallel test threads in forked mode, similar to how concurrentRestrictions works for non-forked tests.

Notes

Added a new setting testForkedParallelism that allows explicit control:

testForkedParallelism := Some(2)  // Use 2 threads
testForkedParallelism := None     // Use availableProcessors() (default)

Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=94194147

@MkDev11 MkDev11 force-pushed the fix/testForkedParallelism-8004 branch from 0e2dbbd to 38c8805 Compare January 9, 2026 05:03
@MkDev11 MkDev11 force-pushed the fix/testForkedParallelism-8004 branch from 38c8805 to dd24331 Compare January 9, 2026 05:21
@eed3si9n eed3si9n changed the title Add testForkedParallelism setting for forked test thread count [2.x] Add testForkedParallelism setting for forked test thread count Jan 9, 2026
@eed3si9n eed3si9n merged commit 061145e into sbt:develop Jan 9, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

testForkedParallel does not behave the same as parallelExecution

2 participants