24
24
using Xunit . Abstractions ;
25
25
using BenchmarkDotNet . Toolchains . Mono ;
26
26
27
- namespace BenchmarkDotNet . IntegrationTests . ManualRunning
27
+ namespace BenchmarkDotNet . IntegrationTests
28
28
{
29
- // #1925
30
- // These tests were moved to ManualRunning to stabilize the CI.
31
- // Even after disabling tiered jit and blocking the finalizer thread, the tests are still flaky on CI.
32
29
public class MemoryDiagnoserTests
33
30
{
34
31
private readonly ITestOutputHelper output ;
@@ -54,6 +51,7 @@ public class AccurateAllocations
54
51
}
55
52
56
53
[ Theory , MemberData ( nameof ( GetToolchains ) ) ]
54
+ [ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
57
55
public void MemoryDiagnoserIsAccurate ( IToolchain toolchain )
58
56
{
59
57
long objectAllocationOverhead = IntPtr . Size * 2 ; // pointer to method table + object header word
@@ -111,6 +109,7 @@ private void AllocateUntilGcWakesUp()
111
109
}
112
110
113
111
[ Theory , MemberData ( nameof ( GetToolchains ) ) ]
112
+ [ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
114
113
public void MemoryDiagnoserDoesNotIncludeAllocationsFromSetupAndCleanup ( IToolchain toolchain )
115
114
{
116
115
AssertAllocations ( toolchain , typeof ( AllocatingGlobalSetupAndCleanup ) , new Dictionary < string , long >
@@ -136,6 +135,7 @@ public ulong TimeConsuming()
136
135
}
137
136
138
137
[ Theory , MemberData ( nameof ( GetToolchains ) ) ]
138
+ [ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
139
139
public void EngineShouldNotInterfereAllocationResults ( IToolchain toolchain )
140
140
{
141
141
AssertAllocations ( toolchain , typeof ( NoAllocationsAtAll ) , new Dictionary < string , long >
@@ -146,6 +146,7 @@ public void EngineShouldNotInterfereAllocationResults(IToolchain toolchain)
146
146
147
147
// #1542
148
148
[ Theory , MemberData ( nameof ( GetToolchains ) ) ]
149
+ [ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
149
150
public void TieredJitShouldNotInterfereAllocationResults ( IToolchain toolchain )
150
151
{
151
152
AssertAllocations ( toolchain , typeof ( NoAllocationsAtAll ) , new Dictionary < string , long >
@@ -161,6 +162,7 @@ public class NoBoxing
161
162
}
162
163
163
164
[ Theory , MemberData ( nameof ( GetToolchains ) ) ]
165
+ [ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
164
166
public void EngineShouldNotIntroduceBoxing ( IToolchain toolchain )
165
167
{
166
168
AssertAllocations ( toolchain , typeof ( NoBoxing ) , new Dictionary < string , long >
@@ -181,6 +183,7 @@ public class NonAllocatingAsynchronousBenchmarks
181
183
}
182
184
183
185
[ Theory , MemberData ( nameof ( GetToolchains ) ) ]
186
+ [ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
184
187
public void AwaitingTasksShouldNotInterfereAllocationResults ( IToolchain toolchain )
185
188
{
186
189
AssertAllocations ( toolchain , typeof ( NonAllocatingAsynchronousBenchmarks ) , new Dictionary < string , long >
@@ -205,6 +208,7 @@ private void DoNotInline(object left, object right) { }
205
208
}
206
209
207
210
[ Theory , MemberData ( nameof ( GetToolchains ) ) ]
211
+ [ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
208
212
public void AllocatedMemoryShouldBeScaledForOperationsPerInvoke ( IToolchain toolchain )
209
213
{
210
214
long objectAllocationOverhead = IntPtr . Size * 2 ; // pointer to method table + object header word
@@ -230,6 +234,7 @@ public byte[] SixtyFourBytesArray()
230
234
}
231
235
232
236
[ TheoryEnvSpecific ( "Full Framework cannot measure precisely enough for low invocation counts." , EnvRequirement . DotNetCoreOnly ) , MemberData ( nameof ( GetToolchains ) ) ]
237
+ [ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
233
238
public void AllocationQuantumIsNotAnIssueForNetCore21Plus ( IToolchain toolchain )
234
239
{
235
240
long objectAllocationOverhead = IntPtr . Size * 2 ; // pointer to method table + object header word
@@ -295,6 +300,7 @@ public void Allocate()
295
300
296
301
[ TheoryEnvSpecific ( "Full Framework cannot measure precisely enough" , EnvRequirement . DotNetCoreOnly ) ]
297
302
[ MemberData ( nameof ( GetToolchains ) ) ]
303
+ [ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
298
304
public void MemoryDiagnoserIsAccurateForMultiThreadedBenchmarks ( IToolchain toolchain )
299
305
{
300
306
long objectAllocationOverhead = IntPtr . Size * 2 ; // pointer to method table + object header word
@@ -319,8 +325,12 @@ private void AssertAllocations(IToolchain toolchain, Type benchmarkType, Diction
319
325
}
320
326
catch ( MisconfiguredEnvironmentException e )
321
327
{
322
- output . WriteLine ( e . SkipMessage ) ;
323
- return ;
328
+ if ( ContinuousIntegration . IsLocalRun ( ) )
329
+ {
330
+ output . WriteLine ( e . SkipMessage ) ;
331
+ return ;
332
+ }
333
+ throw ;
324
334
}
325
335
326
336
foreach ( var benchmarkAllocationsValidator in benchmarksAllocationsValidators )
0 commit comments