Skip to content

Commit c8e386e

Browse files
committed
Split LargeAddressAwareTests.
Ignore NoHangs test on full Framework on non-x86.
1 parent 407b1eb commit c8e386e

File tree

2 files changed

+39
-17
lines changed

2 files changed

+39
-17
lines changed

tests/BenchmarkDotNet.IntegrationTests/FailingProcessSpawnTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ public void NoHangs()
2323
_ => Platform.X64
2424
};
2525

26+
if (wrongPlatform == Platform.X64 && RuntimeInformation.IsFullFramework)
27+
{
28+
// It seems full Framework on Arm ignores the platform and simply runs the native platform, causing this test to fail.
29+
return;
30+
}
31+
2632
var invalidPlatformJob = Job.Dry.WithPlatform(wrongPlatform);
2733
var config = CreateSimpleConfig(job: invalidPlatformJob);
2834

tests/BenchmarkDotNet.IntegrationTests/LargeAddressAwareTest.cs

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,14 @@ public class LargeAddressAwareTest
2020

2121
public LargeAddressAwareTest(ITestOutputHelper outputHelper) => output = outputHelper;
2222

23-
[FactEnvSpecific("CLR is a valid job only on Windows", EnvRequirement.WindowsOnly)]
24-
public void BenchmarkCanAllocateMoreThan2Gb()
23+
[Fact]
24+
public void BenchmarkCanAllocateMoreThan2Gb_Core()
2525
{
2626
var platform = RuntimeInformation.GetCurrentPlatform();
2727
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-
}
28+
// Running 32-bit benchmarks with .Net Core requires passing the path to 32-bit SDK,
29+
// which makes this test more complex than it's worth in CI, so we only test 64-bit.
30+
config.AddJob(Job.Dry.WithRuntime(CoreRuntime.Core80).WithPlatform(platform).WithId(platform.ToString()));
3631
config.AddColumnProvider(DefaultColumnProviders.Instance)
3732
.AddLogger(new OutputLogger(output));
3833

@@ -43,16 +38,37 @@ public void BenchmarkCanAllocateMoreThan2Gb()
4338
.All(executeResult => executeResult.FoundExecutable)));
4439

4540
Assert.True(summary.Reports.All(report => report.AllMeasurements.Any()));
41+
Assert.True(summary.Reports.All(report => report.ExecuteResults.Any()));
42+
Assert.Equal(1, summary.Reports.Count(report => report.BenchmarkCase.Job.Environment.Runtime is CoreRuntime));
4643

47-
Assert.True(summary.Reports
48-
.Single(report => report.BenchmarkCase.Job.Environment.Runtime is ClrRuntime)
49-
.ExecuteResults
50-
.Any());
44+
Assert.Contains(".NET 8.0", summary.AllRuntimes);
45+
}
46+
47+
[FactEnvSpecific("Framework is only on Windows", EnvRequirement.WindowsOnly)]
48+
public void BenchmarkCanAllocateMoreThan2Gb_Framework()
49+
{
50+
var platform = RuntimeInformation.GetCurrentPlatform();
51+
var config = ManualConfig.CreateEmpty();
52+
// Net481 officially only supports x86, x64, and Arm64.
53+
config.AddJob(Job.Dry.WithRuntime(ClrRuntime.Net481).WithPlatform(platform).WithGcServer(false).WithLargeAddressAware().WithId(platform.ToString()));
54+
int jobCount = 1;
55+
if (platform == Platform.X64)
56+
{
57+
++jobCount;
58+
config.AddJob(Job.Dry.WithRuntime(ClrRuntime.Net462).WithPlatform(Platform.X86).WithGcServer(false).WithLargeAddressAware().WithId("X86"));
59+
}
60+
config.AddColumnProvider(DefaultColumnProviders.Instance)
61+
.AddLogger(new OutputLogger(output));
62+
63+
var summary = BenchmarkRunner.Run<NeedsMoreThan2GB>(config);
5164

5265
Assert.True(summary.Reports
53-
.Single(report => report.BenchmarkCase.Job.Environment.Runtime is CoreRuntime)
54-
.ExecuteResults
55-
.Any());
66+
.All(report => report.ExecuteResults
67+
.All(executeResult => executeResult.FoundExecutable)));
68+
69+
Assert.True(summary.Reports.All(report => report.AllMeasurements.Any()));
70+
Assert.True(summary.Reports.All(report => report.ExecuteResults.Any()));
71+
Assert.Equal(jobCount, summary.Reports.Count(report => report.BenchmarkCase.Job.Environment.Runtime is ClrRuntime));
5672

5773
Assert.Contains(".NET Framework", summary.AllRuntimes);
5874
Assert.Contains(DotNetRuntimeHelper.GetExpectedDotNetCoreRuntimeName(), summary.AllRuntimes);

0 commit comments

Comments
 (0)