Skip to content

Commit 34adb08

Browse files
committed
Fix test.
1 parent 39c4b9a commit 34adb08

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ private static IToolchain GetToolchain(Job job, Descriptor descriptor)
2727
? toolchain
2828
: GetToolchain(
2929
job.ResolveValue(EnvironmentMode.RuntimeCharacteristic, EnvironmentResolver.Instance),
30-
descriptor);
30+
descriptor,
31+
job.HasValue(InfrastructureMode.NuGetReferencesCharacteristic) || job.HasValue(InfrastructureMode.BuildConfigurationCharacteristic));
3132

32-
internal static IToolchain GetToolchain(this Runtime runtime, Descriptor descriptor = null)
33+
internal static IToolchain GetToolchain(this Runtime runtime, Descriptor descriptor = null, bool preferMsBuildToolchains = false)
3334
{
3435
switch (runtime)
3536
{
3637
case ClrRuntime clrRuntime:
37-
if (RuntimeInformation.IsFullFramework &&
38+
if (!preferMsBuildToolchains && RuntimeInformation.IsFullFramework &&
3839
// If dotnet SDK is not installed, we use RoslynToolchain (CsProjClassicNetToolchain currently does not support custom cli path).
3940
(!HostEnvironmentInfo.GetCurrent().IsDotNetCliInstalled()
4041
// Integration tests take too much time, because each benchmark run rebuilds the test suite and BenchmarkDotNet itself.

tests/BenchmarkDotNet.IntegrationTests/NugetReferenceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public NuGetReferenceTests(ITestOutputHelper output) : base(output)
2121
[FactEnvSpecific("For some reason this test is unstable on Ubuntu for both AzureDevOps and Travis CI", EnvRequirement.NonLinux)]
2222
public void UserCanSpecifyCustomNuGetPackageDependency()
2323
{
24-
var toolchain = RuntimeInformation.GetCurrentRuntime().GetToolchain();
24+
var toolchain = RuntimeInformation.GetCurrentRuntime().GetToolchain(preferMsBuildToolchains: true);
2525

2626
var job = Job.Dry.WithToolchain(toolchain).WithNuGet("Newtonsoft.Json", "13.0.2");
2727
var config = CreateSimpleConfig(job: job);

0 commit comments

Comments
 (0)