Skip to content

Commit 407b1eb

Browse files
nietrastimcassell
authored andcommitted
BenchmarkCanAllocateMoreThan2Gb try use platform for switching
1 parent 2a6aab1 commit 407b1eb

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

tests/BenchmarkDotNet.IntegrationTests/LargeAddressAwareTest.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using BenchmarkDotNet.Configs;
66
using BenchmarkDotNet.Environments;
77
using BenchmarkDotNet.Jobs;
8+
using BenchmarkDotNet.Portability;
89
using BenchmarkDotNet.Running;
910
using BenchmarkDotNet.Tests.Loggers;
1011
using BenchmarkDotNet.Tests.XUnit;
@@ -22,13 +23,20 @@ public class LargeAddressAwareTest
2223
[FactEnvSpecific("CLR is a valid job only on Windows", EnvRequirement.WindowsOnly)]
2324
public void BenchmarkCanAllocateMoreThan2Gb()
2425
{
25-
var summary = BenchmarkRunner
26-
.Run<NeedsMoreThan2GB>(
27-
ManualConfig.CreateEmpty()
28-
.AddJob(Job.Dry.WithRuntime(CoreRuntime.Core80).WithPlatform(Platform.X64).WithId("Core"))
29-
.AddJob(Job.Dry.WithRuntime(ClrRuntime.Net462).WithPlatform(Platform.X86).WithGcServer(false).WithLargeAddressAware().WithId("Framework"))
30-
.AddColumnProvider(DefaultColumnProviders.Instance)
31-
.AddLogger(new OutputLogger(output)));
26+
var platform = RuntimeInformation.GetCurrentPlatform();
27+
var config = ManualConfig.CreateEmpty();
28+
if (platform == Platform.X64 || platform == Platform.Arm64)
29+
{
30+
config.AddJob(Job.Dry.WithRuntime(CoreRuntime.Core80).WithPlatform(platform).WithId("Core"));
31+
}
32+
if (platform == Platform.X64 || platform == Platform.X86)
33+
{
34+
config.AddJob(Job.Dry.WithRuntime(ClrRuntime.Net462).WithPlatform(Platform.X86).WithGcServer(false).WithLargeAddressAware().WithId("Framework"));
35+
}
36+
config.AddColumnProvider(DefaultColumnProviders.Instance)
37+
.AddLogger(new OutputLogger(output));
38+
39+
var summary = BenchmarkRunner.Run<NeedsMoreThan2GB>(config);
3240

3341
Assert.True(summary.Reports
3442
.All(report => report.ExecuteResults

0 commit comments

Comments
 (0)