Skip to content

Commit 406b828

Browse files
committed
Disabled InProcessEmit tests.
1 parent 5ec44f5 commit 406b828

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/BenchmarkDotNet.IntegrationTests.ManualRunning/ExpectedBenchmarkResultsTests.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Diagnostics;
43
using System.Linq;
54
using BenchmarkDotNet.Analysers;
65
using BenchmarkDotNet.Attributes;
@@ -13,6 +12,7 @@
1312
using BenchmarkDotNet.Portability;
1413
using BenchmarkDotNet.Reports;
1514
using BenchmarkDotNet.Tests.XUnit;
15+
using BenchmarkDotNet.Toolchains;
1616
using BenchmarkDotNet.Toolchains.InProcess.Emit;
1717
using Perfolizer.Horology;
1818
using Perfolizer.Mathematics.Thresholds;
@@ -123,8 +123,12 @@ private void AssertZeroResults(Type benchmarkType, IConfig config)
123123
bool isZero = ZeroMeasurementHelper.CheckZeroMeasurementTwoSamples(workloadMeasurements, overheadMeasurements, threshold);
124124
Assert.True(isZero, $"Actual time was not 0.");
125125

126-
isZero = ZeroMeasurementHelper.CheckZeroMeasurementTwoSamples(overheadMeasurements, workloadMeasurements, threshold);
127-
Assert.True(isZero, "Overhead took more time than workload.");
126+
// IL Emit has incorrect overhead measurement in net7. https://github.com/dotnet/runtime/issues/89685
127+
if (!RuntimeInformation.IsNetCore || report.BenchmarkCase.GetToolchain() is not InProcessEmitToolchain)
128+
{
129+
isZero = ZeroMeasurementHelper.CheckZeroMeasurementTwoSamples(overheadMeasurements, workloadMeasurements, threshold);
130+
Assert.True(isZero, "Overhead took more time than workload.");
131+
}
128132

129133
Assert.True((report.GcStats.GetBytesAllocatedPerOperation(report.BenchmarkCase) ?? 0L) == 0L, "Memory allocations measured above 0.");
130134
}
@@ -163,7 +167,7 @@ public static IEnumerable<object[]> NonEmptyFrameworkData()
163167
}
164168
}
165169

166-
[Theory]
170+
[Theory(Skip = "IL Emit currently has incorrect overhead measurement, but it only matters for sub-nanosecond benchmarks like this. https://github.com/dotnet/runtime/issues/89685")]
167171
[MemberData(nameof(NonEmptyInProcessData))]
168172
public void NonEmptyBenchmarksReportsNonZeroTimeAndZeroAllocated_InProcess(Type benchmarkType)
169173
{
@@ -259,11 +263,7 @@ public class ActualWork
259263
public int _field;
260264

261265
[Benchmark]
262-
public void IncrementField()
263-
{
264-
_field++;
265-
_field++;
266-
}
266+
public void IncrementField() => _field++;
267267
}
268268

269269
public class EmptyVoid { [Benchmark] public void Void() { } }

0 commit comments

Comments
 (0)