microsoft / microsoft/MSBuildSdks
Tests are not truly parallelized when run with Traversal project
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 508
- Forks
- 94
- Avg merge
- 6h 40m
- Merged PRs (30d)
- 2
Description
Hi!
For the same set of test projects, tests that are run from .sln file are executed faster than tests, that are run from traversal project file.
How it looks in Process Explorer:
For a solution with dozens of test projects, when tests are run from traversal project, they are split among nodes, but when a node finishes its tests the node does not "steal" work from other nodes. As a result, one node does the most part of the work.
How to reproduce:
See instructions in https://github.com/batkaevruslan/dotCoverParallelizationIssue (ignore repo name, as at first we thought it's dotCover fault).
We tested it on several machines\OS with sdk 7.0.401 and got similar results:
~/Repos/batkaevruslan/dotCoverParallelizationIssue (main*) » /usr/bin/time -h dotnet test dotCoverParallelizationIssue.sln -maxcpucount:2
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 1 s - Tests1.dll (net7.0)
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 1 s - Tests3.dll (net7.0)
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 1 s - Tests4.dll (net7.0)
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 1 s - Tests5.dll (net7.0)
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 10 s - Tests6.dll (net7.0)
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 30 s - Tests2.dll (net7.0)
31.71s real 6.47s user 1.51s sys
~/Repos/batkaevruslan/dotCoverParallelizationIssue (main*) » /usr/bin/time -h dotnet test affected.proj -maxcpucount:2 -v:q
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 1 s - Tests1.dll (net7.0)
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 1 s - Tests4.dll (net7.0)
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 10 s - Tests6.dll (net7.0)
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 30 s - Tests2.dll (net7.0)
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 1 s - Tests3.dll (net7.0)
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 1 s - Tests5.dll (net7.0)
35.04s real 6.28s user 1.70s sys
Pay attention to the second run: Tests3.dll and Tests5.dll could have been executed in parallel with Tests2.dll, but they haven't.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked dotCoverParallelizationIssue reproduction and compare dotnet test dotCoverParallelizationIssue.sln with dotnet test affected.proj, both using -maxcpucount:2. Investigate how traversal project execution schedules the listed test projects; done when work is balanced like the solution run and the reproduction confirms parallel execution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100