Skip to content

Commit 94ebb0f

Browse files
committed
[tests] Segment Microsoft.Diagnostics.NETCore.Client relevant tests for Linux arm coreclr
1 parent b029bad commit 94ebb0f

File tree

18 files changed

+556
-18
lines changed

18 files changed

+556
-18
lines changed

eng/Versions.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
<NETStandardLibraryRefVersion>2.1.0</NETStandardLibraryRefVersion>
138138
<NetStandardLibraryVersion>2.0.3</NetStandardLibraryVersion>
139139
<MicrosoftDiagnosticsToolsRuntimeClientVersion>1.0.4-preview6.19326.1</MicrosoftDiagnosticsToolsRuntimeClientVersion>
140+
<MicrosoftDiagnosticsNETCoreClientVersion>0.2.61701</MicrosoftDiagnosticsNETCoreClientVersion>
140141
<DNNEVersion>1.0.27</DNNEVersion>
141142
<MicrosoftBuildVersion>16.10.0</MicrosoftBuildVersion>
142143
<MicrosoftBuildTasksCoreVersion>$(MicrosoftBuildVersion)</MicrosoftBuildTasksCoreVersion>

src/tests/Directory.Build.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,5 +194,12 @@
194194
<TestFramework>GeneratedRunner</TestFramework>
195195
</PropertyGroup>
196196

197+
<PropertyGroup>
198+
<!-- On Linux arm coreclr, the updated tracing/eventpipe/common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj project
199+
does not yet work for several eventpipe runtime tests. We segment those tests with the following property and symbol -->
200+
<UseUpdatedNETCoreClient Condition="!('$(TargetOS)' == 'Linux' And '$(TargetArchitecture)' == 'arm' And '$(RuntimeFlavor)' == 'coreclr')">true</UseUpdatedNETCoreClient>
201+
<DefineConstants Condition="'$(UseUpdatedNETCoreClient)' == 'true'">$(DefineConstants);UPDATED_NETCORE_CLIENT</DefineConstants>
202+
</PropertyGroup>
203+
197204
<Import Project="$(RepositoryEngineeringDir)testing\tests.props" Condition="'$(IsTestsCommonProject)' != 'true'" />
198205
</Project>

src/tests/JIT/Directed/debugging/debuginfo/tester.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
using System.Linq;
99
using System.Reflection;
1010
using System.Runtime.CompilerServices;
11+
#if UPDATED_NETCORE_CLIENT
1112
using Microsoft.Diagnostics.NETCore.Client;
13+
#else
14+
using Microsoft.Diagnostics.Tools.RuntimeClient;
15+
#endif
1216
using Microsoft.Diagnostics.Tracing;
1317
using Microsoft.Diagnostics.Tracing.Parsers;
1418
using Microsoft.Diagnostics.Tracing.Parsers.Clr;
@@ -23,6 +27,7 @@ public static unsafe int Main()
2327
var keywords =
2428
ClrTraceEventParser.Keywords.Jit | ClrTraceEventParser.Keywords.JittedMethodILToNativeMap;
2529

30+
#if UPDATED_NETCORE_CLIENT
2631
var dotnetRuntimeProvider = new List<EventPipeProvider>
2732
{
2833
new EventPipeProvider("Microsoft-Windows-DotNETRuntime", eventLevel: EventLevel.Verbose, keywords: (long)keywords)
@@ -35,6 +40,21 @@ public static unsafe int Main()
3540
dotnetRuntimeProvider,
3641
1024,
3742
ValidateMappings);
43+
#else
44+
var dotnetRuntimeProvider = new List<Provider>
45+
{
46+
new Provider("Microsoft-Windows-DotNETRuntime", eventLevel: EventLevel.Verbose, keywords: (ulong)keywords)
47+
};
48+
49+
var config = new SessionConfiguration(1024, EventPipeSerializationFormat.NetTrace, dotnetRuntimeProvider);
50+
51+
return
52+
IpcTraceTest.RunAndValidateEventCounts(
53+
new Dictionary<string, ExpectedEventCount>(),
54+
JitMethods,
55+
config,
56+
ValidateMappings);
57+
#endif
3858
}
3959

4060
private static void JitMethods()

src/tests/JIT/Directed/debugging/debuginfo/tester.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<ProjectReference Include="tests_r.ilproj" Aliases="tests_r" />
1313
<ProjectReference Include="attribute.csproj" />
1414
<ProjectReference Include="../../../../tracing/eventpipe/common/common.csproj" />
15-
<ProjectReference Include="../../../../tracing/eventpipe/common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
15+
<ProjectReference Condition="'$(UseUpdatedNETCoreClient)' == 'true'" Include="../../../../tracing/eventpipe/common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
1616
<Compile Include="$(MSBuildProjectName).cs" />
1717
</ItemGroup>
1818
</Project>

src/tests/tracing/eventpipe/bigevent/bigevent.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
using Microsoft.Diagnostics.Tracing;
1212
using Tracing.Tests.Common;
1313
using Microsoft.Diagnostics.Tracing.Parsers.Clr;
14-
using Microsoft.Diagnostics.NETCore.Client;
14+
#if (UPDATED_NETCORE_CLIENT == true)
15+
using Microsoft.Diagnostics.NETCore.Client;
16+
#else
17+
using Microsoft.Diagnostics.Tools.RuntimeClient;
18+
#endif
1519

1620
namespace Tracing.Tests.BigEventsValidation
1721
{
@@ -45,12 +49,22 @@ public static int Main(string[] args)
4549
{
4650
// This test tries to send a big event (>100KB) and checks that the app does not crash
4751
// See https://github.com/dotnet/runtime/issues/50515 for the regression issue
52+
#if (UPDATED_NETCORE_CLIENT == true)
4853
var providers = new List<EventPipeProvider>()
4954
{
5055
new EventPipeProvider("BigEventSource", EventLevel.Verbose)
5156
};
5257

5358
return IpcTraceTest.RunAndValidateEventCounts(_expectedEventCounts, _eventGeneratingAction, providers, 1024, _Verify);
59+
#else
60+
var providers = new List<Provider>()
61+
{
62+
new Provider("BigEventSource")
63+
};
64+
65+
var configuration = new SessionConfiguration(circularBufferSizeMB: 1024, format: EventPipeSerializationFormat.NetTrace, providers: providers);
66+
return IpcTraceTest.RunAndValidateEventCounts(_expectedEventCounts, _eventGeneratingAction, configuration, _Verify);
67+
#endif
5468
}
5569

5670
private static Dictionary<string, ExpectedEventCount> _expectedEventCounts = new Dictionary<string, ExpectedEventCount>()

src/tests/tracing/eventpipe/bigevent/bigevent.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
<ItemGroup>
1212
<Compile Include="$(MSBuildProjectName).cs" />
1313
<ProjectReference Include="../common/common.csproj" />
14-
<ProjectReference Include="../common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
14+
<ProjectReference Condition="'$(UseUpdatedNETCoreClient)' == 'true'" Include="../common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
1515
</ItemGroup>
1616
</Project>

src/tests/tracing/eventpipe/buffersize/buffersize.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
using System.Collections.Generic;
1111
using System.Text.RegularExpressions;
1212
using Tracing.Tests.Common;
13+
#if (UPDATED_NETCORE_CLIENT == true)
1314
using Microsoft.Diagnostics.NETCore.Client;
15+
#else
16+
using Microsoft.Diagnostics.Tools.RuntimeClient;
17+
#endif
1418

1519
namespace Tracing.Tests.BufferValidation
1620
{
@@ -27,7 +31,7 @@ public static int Main(string[] args)
2731
{
2832
// This tests the resilience of message sending with
2933
// smaller buffers, specifically 1MB and 4MB
30-
34+
#if (UPDATED_NETCORE_CLIENT == true)
3135
var providers = new List<EventPipeProvider>()
3236
{
3337
new EventPipeProvider("MyEventSource", EventLevel.Verbose)
@@ -44,6 +48,26 @@ public static int Main(string[] args)
4448
}
4549

4650
return 100;
51+
#else
52+
var providers = new List<Provider>()
53+
{
54+
new Provider("MyEventSource")
55+
};
56+
57+
var tests = new int[] { 0, 2 }
58+
.Select(x => (uint)Math.Pow(2, x))
59+
.Select(bufferSize => new SessionConfiguration(circularBufferSizeMB: bufferSize, format: EventPipeSerializationFormat.NetTrace, providers: providers))
60+
.Select<SessionConfiguration, Func<int>>(configuration => () => IpcTraceTest.RunAndValidateEventCounts(_expectedEventCounts, _eventGeneratingAction, configuration));
61+
62+
foreach (var test in tests)
63+
{
64+
var ret = test();
65+
if (ret < 0)
66+
return ret;
67+
}
68+
69+
return 100;
70+
#endif
4771
}
4872

4973
private static Dictionary<string, ExpectedEventCount> _expectedEventCounts = new Dictionary<string, ExpectedEventCount>()

src/tests/tracing/eventpipe/buffersize/buffersize.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
<ItemGroup>
1111
<Compile Include="$(MSBuildProjectName).cs" />
1212
<ProjectReference Include="../common/common.csproj" />
13-
<ProjectReference Include="../common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
13+
<ProjectReference Condition="'$(UseUpdatedNETCoreClient)' == 'true'" Include="../common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
1414
</ItemGroup>
1515
</Project>

0 commit comments

Comments
 (0)