Skip to content

Commit

Permalink
Don't show /aggressive with unlimited threads
Browse files Browse the repository at this point in the history
  • Loading branch information
bradwilson committed Apr 23, 2024
1 parent 46cdf06 commit 7b0ff93
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected override string GetTestFrameworkEnvironment()
threadCountText += " thread";
if (maxParallelThreads != 1)
threadCountText += 's';
if (parallelAlgorithm == ParallelAlgorithm.Aggressive)
if (maxParallelThreads > 0 && parallelAlgorithm == ParallelAlgorithm.Aggressive)
threadCountText += "/aggressive";

return string.Format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ protected override bool Visit(ITestAssemblyExecutionStarting executionStarting)
"on [{0} thread{1}{2}]",
threadCount < 0 ? "unlimited" : threadCount.ToString(CultureInfo.CurrentCulture),
threadCount == 1 ? string.Empty : "s",
parallelAlgorithm == ParallelAlgorithm.Aggressive ? "/aggressive" : string.Empty
threadCount > 0 && parallelAlgorithm == ParallelAlgorithm.Aggressive ? "/aggressive" : string.Empty
);

Logger.LogImportantMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ protected virtual void HandleTestAssemblyExecutionStarting(MessageHandlerArgs<IT
"on [{0} thread{1}{2}]",
threadCount < 0 ? "unlimited" : threadCount.ToString(CultureInfo.CurrentCulture),
threadCount == 1 ? string.Empty : "s",
parallelAlgorithm == ParallelAlgorithm.Aggressive ? "/aggressive" : string.Empty
threadCount > 0 && parallelAlgorithm == ParallelAlgorithm.Aggressive ? "/aggressive" : string.Empty
);

Logger.LogImportantMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,14 @@ public static void TestOptions_MaxThreads_Aggressive()
Assert.EndsWith("[collection-per-class, parallel (3 threads/aggressive)]", result);
}

[Fact]
public static void TestOptions_Unlimited()
[Theory]
[InlineData(ParallelAlgorithm.Conservative)]
[InlineData(ParallelAlgorithm.Aggressive)]
public static void TestOptions_Unlimited(ParallelAlgorithm parallelAlgorithm)
{
var options = TestFrameworkOptions.ForExecution();
options.SetMaxParallelThreads(-1);
options.SetParallelAlgorithm(parallelAlgorithm); // Either way shouldn't show in the output because unlimited
var runner = TestableXunitTestAssemblyRunner.Create(executionOptions: options);

var result = runner.GetTestFrameworkEnvironment();
Expand Down

0 comments on commit 7b0ff93

Please sign in to comment.