Skip to content

Commit 7eba36e

Browse files
authored
[dotnet test MTP] Separate evaluation parallelization level from running test apps (#50805)
1 parent fcc1641 commit 7eba36e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static (IEnumerable<ParallelizableTestModuleGroupWithSequentialInnerModul
6767
return (projects, isBuiltOrRestored);
6868
}
6969

70-
public static BuildOptions GetBuildOptions(ParseResult parseResult, int degreeOfParallelism)
70+
public static BuildOptions GetBuildOptions(ParseResult parseResult)
7171
{
7272
LoggerUtility.SeparateBinLogArguments(parseResult.UnmatchedTokens, out var binLogArgs, out var otherArgs);
7373

@@ -106,7 +106,6 @@ public static BuildOptions GetBuildOptions(ParseResult parseResult, int degreeOf
106106
parseResult.HasOption(TestCommandParser.VerbosityOption) ? parseResult.GetValue(TestCommandParser.VerbosityOption) : null,
107107
parseResult.GetValue(MicrosoftTestingPlatformOptions.NoLaunchProfileOption),
108108
parseResult.GetValue(MicrosoftTestingPlatformOptions.NoLaunchProfileArgumentsOption),
109-
degreeOfParallelism,
110109
otherArgs,
111110
msbuildArgs);
112111
}
@@ -137,7 +136,9 @@ private static ConcurrentBag<ParallelizableTestModuleGroupWithSequentialInnerMod
137136

138137
Parallel.ForEach(
139138
projects,
140-
new ParallelOptions { MaxDegreeOfParallelism = buildOptions.DegreeOfParallelism },
139+
// We don't use --max-parallel-test-modules here.
140+
// If user wants to limit the test applications run in parallel, we don't want to punish them and force the evaluation to also be limited.
141+
new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount },
141142
(project) =>
142143
{
143144
IEnumerable<ParallelizableTestModuleGroupWithSequentialInnerModules> projectsMetadata = SolutionAndProjectUtility.GetProjectProperties(project, projectCollection, evaluationContext, buildOptions);

src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private int RunInternal(ParseResult parseResult, bool isHelp)
5151

5252
SetupCancelKeyPressHandler();
5353

54-
BuildOptions buildOptions = MSBuildUtility.GetBuildOptions(parseResult, degreeOfParallelism);
54+
BuildOptions buildOptions = MSBuildUtility.GetBuildOptions(parseResult);
5555

5656
bool filterModeEnabled = parseResult.HasOption(MicrosoftTestingPlatformOptions.TestModulesFilterOption);
5757
TestApplicationActionQueue actionQueue;

src/Cli/dotnet/Commands/Test/MTP/Options.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ internal record BuildOptions(
1414
Utils.VerbosityOptions? Verbosity,
1515
bool NoLaunchProfile,
1616
bool NoLaunchProfileArguments,
17-
int DegreeOfParallelism,
1817
List<string> UnmatchedTokens,
1918
IEnumerable<string> MSBuildArgs);

0 commit comments

Comments
 (0)