-
Notifications
You must be signed in to change notification settings - Fork 309
Add MSTestParallelizeScope/Workers MSBuild properties (#4116) #8233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b4dc7f3
Add MSTestParallelizeScope/Workers MSBuild SDK properties (#4116)
Evangelink 79355ca
Move MSTestParallelize* properties to MSTest.TestAdapter targets
Evangelink 6e7eb8f
Address PR review: rename ParallelizeAssertSourceCode to ParallelizeA…
Evangelink 6eacaa6
Address PR review: dedupe Parallelize targets, add tests, revert unre…
Evangelink cc3403b
Address PR review: drop redundant Parallelize validation checks
Evangelink File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/Adapter/MSTest.TestAdapter/buildTransitive/Parallelize.targets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <Project> | ||
|
|
||
| <!-- | ||
| MSTestParallelizeScope and MSTestParallelizeWorkers let users opt-in to assembly-level | ||
| parallelization without authoring an MSTestSettings.cs file, by emitting the corresponding | ||
| [assembly: Parallelize(...)] / [assembly: DoNotParallelize] attribute via the standard | ||
| AssemblyAttribute MSBuild item (consumed by WriteCodeFragment when GenerateAssemblyInfo is true). | ||
| --> | ||
| <!-- | ||
| Only validate the silent-failure modes here. Invalid Scope values and non-integer Workers | ||
| flow through to WriteCodeFragment and produce a clear C# compile error on the generated source. | ||
| --> | ||
| <Target Name="_MSTestValidateParallelizeProperties" BeforeTargets="GenerateAssemblyInfo;CoreCompile"> | ||
|
Evangelink marked this conversation as resolved.
|
||
| <Error Condition=" '$(MSTestParallelizeScope)' == 'None' and '$(MSTestParallelizeWorkers)' != '' " | ||
| Text="Property MSTestParallelizeWorkers cannot be set when MSTestParallelizeScope is 'None'." /> | ||
| <Warning Condition=" ('$(MSTestParallelizeScope)' != '' or '$(MSTestParallelizeWorkers)' != '') and '$(GenerateAssemblyInfo)' == 'false' " | ||
|
Evangelink marked this conversation as resolved.
|
||
| Text="MSTestParallelizeScope and MSTestParallelizeWorkers require GenerateAssemblyInfo to be true to take effect." /> | ||
| </Target> | ||
|
|
||
| <!-- Scope set to a parallel level, no explicit Workers => [assembly: Parallelize(Scope = ...)] --> | ||
| <ItemGroup Condition=" '$(MSTestParallelizeScope)' != '' and '$(MSTestParallelizeScope)' != 'None' and '$(MSTestParallelizeWorkers)' == '' "> | ||
| <AssemblyAttribute Include="Microsoft.VisualStudio.TestTools.UnitTesting.Parallelize"> | ||
| <_Parameter1>Scope = Microsoft.VisualStudio.TestTools.UnitTesting.ExecutionScope.$(MSTestParallelizeScope)</_Parameter1> | ||
| <_Parameter1_IsLiteral>true</_Parameter1_IsLiteral> | ||
| </AssemblyAttribute> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Workers set, Scope unset => [assembly: Parallelize(Workers = ...)] --> | ||
| <ItemGroup Condition=" '$(MSTestParallelizeScope)' == '' and '$(MSTestParallelizeWorkers)' != '' "> | ||
| <AssemblyAttribute Include="Microsoft.VisualStudio.TestTools.UnitTesting.Parallelize"> | ||
| <_Parameter1>Workers = $(MSTestParallelizeWorkers)</_Parameter1> | ||
| <_Parameter1_IsLiteral>true</_Parameter1_IsLiteral> | ||
| </AssemblyAttribute> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Both set => [assembly: Parallelize(Scope = ..., Workers = ...)] --> | ||
| <ItemGroup Condition=" '$(MSTestParallelizeScope)' != '' and '$(MSTestParallelizeScope)' != 'None' and '$(MSTestParallelizeWorkers)' != '' "> | ||
| <AssemblyAttribute Include="Microsoft.VisualStudio.TestTools.UnitTesting.Parallelize"> | ||
| <_Parameter1>Scope = Microsoft.VisualStudio.TestTools.UnitTesting.ExecutionScope.$(MSTestParallelizeScope)</_Parameter1> | ||
| <_Parameter1_IsLiteral>true</_Parameter1_IsLiteral> | ||
| <_Parameter2>Workers = $(MSTestParallelizeWorkers)</_Parameter2> | ||
| <_Parameter2_IsLiteral>true</_Parameter2_IsLiteral> | ||
| </AssemblyAttribute> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Scope set to None => [assembly: DoNotParallelize] --> | ||
| <ItemGroup Condition=" '$(MSTestParallelizeScope)' == 'None' "> | ||
| <AssemblyAttribute Include="Microsoft.VisualStudio.TestTools.UnitTesting.DoNotParallelize" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,4 +51,6 @@ | |
| </ItemGroup> | ||
| </Target> | ||
|
|
||
| <Import Project="$(MSBuildThisFileDirectory)Parallelize.targets" /> | ||
|
|
||
| </Project> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.